platform.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * Copyright 2006, Bernhard Reutner-Fischer
  4. *
  5. * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  6. */
  7. #ifndef BB_PLATFORM_H
  8. #define BB_PLATFORM_H 1
  9. /* Convenience macros to test the version of gcc. */
  10. #undef __GNUC_PREREQ
  11. #if defined __GNUC__ && defined __GNUC_MINOR__
  12. # define __GNUC_PREREQ(maj, min) \
  13. ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
  14. #else
  15. # define __GNUC_PREREQ(maj, min) 0
  16. #endif
  17. /* __restrict is known in EGCS 1.2 and above. */
  18. #if !__GNUC_PREREQ(2,92)
  19. # ifndef __restrict
  20. # define __restrict
  21. # endif
  22. #endif
  23. #if !__GNUC_PREREQ(2,7)
  24. # ifndef __attribute__
  25. # define __attribute__(x)
  26. # endif
  27. #endif
  28. #undef inline
  29. #if defined(__STDC_VERSION__) && __STDC_VERSION__ > 199901L
  30. /* it's a keyword */
  31. #elif __GNUC_PREREQ(2,7)
  32. # define inline __inline__
  33. #else
  34. # define inline
  35. #endif
  36. #ifndef __const
  37. # define __const const
  38. #endif
  39. #define UNUSED_PARAM __attribute__ ((__unused__))
  40. #define NORETURN __attribute__ ((__noreturn__))
  41. /* "The malloc attribute is used to tell the compiler that a function
  42. * may be treated as if any non-NULL pointer it returns cannot alias
  43. * any other pointer valid when the function returns. This will often
  44. * improve optimization. Standard functions with this property include
  45. * malloc and calloc. realloc-like functions have this property as long
  46. * as the old pointer is never referred to (including comparing it
  47. * to the new pointer) after the function returns a non-NULL value."
  48. */
  49. #define RETURNS_MALLOC __attribute__ ((malloc))
  50. #define PACKED __attribute__ ((__packed__))
  51. #define ALIGNED(m) __attribute__ ((__aligned__(m)))
  52. /* __NO_INLINE__: some gcc's do not honor inlining! :( */
  53. #if __GNUC_PREREQ(3,0) && !defined(__NO_INLINE__)
  54. # define ALWAYS_INLINE __attribute__ ((always_inline)) inline
  55. /* I've seen a toolchain where I needed __noinline__ instead of noinline */
  56. # define NOINLINE __attribute__((__noinline__))
  57. # if !ENABLE_WERROR
  58. # define DEPRECATED __attribute__ ((__deprecated__))
  59. # define UNUSED_PARAM_RESULT __attribute__ ((warn_unused_result))
  60. # else
  61. # define DEPRECATED
  62. # define UNUSED_PARAM_RESULT
  63. # endif
  64. #else
  65. # define ALWAYS_INLINE inline
  66. # define NOINLINE
  67. # define DEPRECATED
  68. # define UNUSED_PARAM_RESULT
  69. #endif
  70. /* used by unit test machinery to run registration functions before calling main() */
  71. #define INIT_FUNC __attribute__ ((constructor))
  72. /* -fwhole-program makes all symbols local. The attribute externally_visible
  73. * forces a symbol global. */
  74. #if __GNUC_PREREQ(4,1)
  75. # define EXTERNALLY_VISIBLE __attribute__(( visibility("default") ))
  76. //__attribute__ ((__externally_visible__))
  77. #else
  78. # define EXTERNALLY_VISIBLE
  79. #endif
  80. /* At 4.4 gcc become much more anal about this, need to use "aliased" types */
  81. #if __GNUC_PREREQ(4,4)
  82. # define FIX_ALIASING __attribute__((__may_alias__))
  83. #else
  84. # define FIX_ALIASING
  85. #endif
  86. /* We use __extension__ in some places to suppress -pedantic warnings
  87. * about GCC extensions. This feature didn't work properly before
  88. * gcc 2.8. */
  89. #if !__GNUC_PREREQ(2,8)
  90. # ifndef __extension__
  91. # define __extension__
  92. # endif
  93. #endif
  94. /* FAST_FUNC is a qualifier which (possibly) makes function call faster
  95. * and/or smaller by using modified ABI. It is usually only needed
  96. * on non-static, busybox internal functions. Recent versions of gcc
  97. * optimize statics automatically. FAST_FUNC on static is required
  98. * only if you need to match a function pointer's type */
  99. #if __GNUC_PREREQ(3,0) && defined(i386) /* || defined(__x86_64__)? */
  100. /* stdcall makes callee to pop arguments from stack, not caller */
  101. # define FAST_FUNC __attribute__((regparm(3),stdcall))
  102. /* #elif ... - add your favorite arch today! */
  103. #else
  104. # define FAST_FUNC
  105. #endif
  106. /* Make all declarations hidden (-fvisibility flag only affects definitions) */
  107. /* (don't include system headers after this until corresponding pop!) */
  108. #if __GNUC_PREREQ(4,1) && !defined(__CYGWIN__)
  109. # define PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN _Pragma("GCC visibility push(hidden)")
  110. # define POP_SAVED_FUNCTION_VISIBILITY _Pragma("GCC visibility pop")
  111. #else
  112. # define PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
  113. # define POP_SAVED_FUNCTION_VISIBILITY
  114. #endif
  115. /* gcc-2.95 had no va_copy but only __va_copy. */
  116. #if !__GNUC_PREREQ(3,0)
  117. # include <stdarg.h>
  118. # if !defined va_copy && defined __va_copy
  119. # define va_copy(d,s) __va_copy((d),(s))
  120. # endif
  121. #endif
  122. /* ---- Endian Detection ------------------------------------ */
  123. #include <limits.h>
  124. #if defined(__digital__) && defined(__unix__)
  125. # include <sex.h>
  126. #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \
  127. || defined(__APPLE__)
  128. # include <sys/resource.h> /* rlimit */
  129. # include <machine/endian.h>
  130. # define bswap_64 __bswap64
  131. # define bswap_32 __bswap32
  132. # define bswap_16 __bswap16
  133. #else
  134. # include <byteswap.h>
  135. # include <endian.h>
  136. #endif
  137. #if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN
  138. # define BB_BIG_ENDIAN 1
  139. # define BB_LITTLE_ENDIAN 0
  140. #elif defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN
  141. # define BB_BIG_ENDIAN 0
  142. # define BB_LITTLE_ENDIAN 1
  143. #elif defined(_BYTE_ORDER) && _BYTE_ORDER == _BIG_ENDIAN
  144. # define BB_BIG_ENDIAN 1
  145. # define BB_LITTLE_ENDIAN 0
  146. #elif defined(_BYTE_ORDER) && _BYTE_ORDER == _LITTLE_ENDIAN
  147. # define BB_BIG_ENDIAN 0
  148. # define BB_LITTLE_ENDIAN 1
  149. #elif defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN
  150. # define BB_BIG_ENDIAN 1
  151. # define BB_LITTLE_ENDIAN 0
  152. #elif defined(BYTE_ORDER) && BYTE_ORDER == LITTLE_ENDIAN
  153. # define BB_BIG_ENDIAN 0
  154. # define BB_LITTLE_ENDIAN 1
  155. #elif defined(__386__)
  156. # define BB_BIG_ENDIAN 0
  157. # define BB_LITTLE_ENDIAN 1
  158. #else
  159. # error "Can't determine endianness"
  160. #endif
  161. #if ULONG_MAX > 0xffffffff
  162. # define bb_bswap_64(x) bswap_64(x)
  163. #endif
  164. /* SWAP_LEnn means "convert CPU<->little_endian by swapping bytes" */
  165. #if BB_BIG_ENDIAN
  166. # define SWAP_BE16(x) (x)
  167. # define SWAP_BE32(x) (x)
  168. # define SWAP_BE64(x) (x)
  169. # define SWAP_LE16(x) bswap_16(x)
  170. # define SWAP_LE32(x) bswap_32(x)
  171. # define SWAP_LE64(x) bb_bswap_64(x)
  172. # define IF_BIG_ENDIAN(...) __VA_ARGS__
  173. # define IF_LITTLE_ENDIAN(...)
  174. #else
  175. # define SWAP_BE16(x) bswap_16(x)
  176. # define SWAP_BE32(x) bswap_32(x)
  177. # define SWAP_BE64(x) bb_bswap_64(x)
  178. # define SWAP_LE16(x) (x)
  179. # define SWAP_LE32(x) (x)
  180. # define SWAP_LE64(x) (x)
  181. # define IF_BIG_ENDIAN(...)
  182. # define IF_LITTLE_ENDIAN(...) __VA_ARGS__
  183. #endif
  184. /* ---- Unaligned access ------------------------------------ */
  185. #include <stdint.h>
  186. typedef int bb__aliased_int FIX_ALIASING;
  187. typedef long bb__aliased_long FIX_ALIASING;
  188. typedef uint16_t bb__aliased_uint16_t FIX_ALIASING;
  189. typedef uint32_t bb__aliased_uint32_t FIX_ALIASING;
  190. typedef uint64_t bb__aliased_uint64_t FIX_ALIASING;
  191. /* NB: unaligned parameter should be a pointer, aligned one -
  192. * a lvalue. This makes it more likely to not swap them by mistake
  193. */
  194. #if defined(i386) || defined(__x86_64__) || defined(__powerpc__)
  195. # define move_from_unaligned_int(v, intp) ((v) = *(bb__aliased_int*)(intp))
  196. # define move_from_unaligned_long(v, longp) ((v) = *(bb__aliased_long*)(longp))
  197. # define move_from_unaligned16(v, u16p) ((v) = *(bb__aliased_uint16_t*)(u16p))
  198. # define move_from_unaligned32(v, u32p) ((v) = *(bb__aliased_uint32_t*)(u32p))
  199. # define move_to_unaligned16(u16p, v) (*(bb__aliased_uint16_t*)(u16p) = (v))
  200. # define move_to_unaligned32(u32p, v) (*(bb__aliased_uint32_t*)(u32p) = (v))
  201. /* #elif ... - add your favorite arch today! */
  202. #else
  203. /* performs reasonably well (gcc usually inlines memcpy here) */
  204. # define move_from_unaligned_int(v, intp) (memcpy(&(v), (intp), sizeof(int)))
  205. # define move_from_unaligned_long(v, longp) (memcpy(&(v), (longp), sizeof(long)))
  206. # define move_from_unaligned16(v, u16p) (memcpy(&(v), (u16p), 2))
  207. # define move_from_unaligned32(v, u32p) (memcpy(&(v), (u32p), 4))
  208. # define move_to_unaligned16(u16p, v) do { \
  209. uint16_t __t = (v); \
  210. memcpy((u16p), &__t, 2); \
  211. } while (0)
  212. # define move_to_unaligned32(u32p, v) do { \
  213. uint32_t __t = (v); \
  214. memcpy((u32p), &__t, 4); \
  215. } while (0)
  216. #endif
  217. /* ---- Size-saving "small" ints (arch-dependent) ----------- */
  218. #if defined(i386) || defined(__x86_64__) || defined(__mips__) || defined(__cris__)
  219. /* add other arches which benefit from this... */
  220. typedef signed char smallint;
  221. typedef unsigned char smalluint;
  222. #else
  223. /* for arches where byte accesses generate larger code: */
  224. typedef int smallint;
  225. typedef unsigned smalluint;
  226. #endif
  227. /* ISO C Standard: 7.16 Boolean type and values <stdbool.h> */
  228. #if (defined __digital__ && defined __unix__)
  229. /* old system without (proper) C99 support */
  230. # define bool smalluint
  231. #else
  232. /* modern system, so use it */
  233. # include <stdbool.h>
  234. #endif
  235. /*----- Kernel versioning ------------------------------------*/
  236. #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
  237. #ifdef __UCLIBC__
  238. # define UCLIBC_VERSION KERNEL_VERSION(__UCLIBC_MAJOR__, __UCLIBC_MINOR__, __UCLIBC_SUBLEVEL__)
  239. #else
  240. # define UCLIBC_VERSION 0
  241. #endif
  242. /* ---- Miscellaneous --------------------------------------- */
  243. #if defined __GLIBC__ \
  244. || defined __UCLIBC__ \
  245. || defined __dietlibc__ \
  246. || defined __BIONIC__ \
  247. || defined _NEWLIB_VERSION
  248. # include <features.h>
  249. #endif
  250. /* Define bb_setpgrp */
  251. #if defined(__digital__) && defined(__unix__)
  252. /* use legacy setpgrp(pid_t, pid_t) for now. move to platform.c */
  253. # define bb_setpgrp() do { pid_t __me = getpid(); setpgrp(__me, __me); } while (0)
  254. #else
  255. # define bb_setpgrp() setpgrp()
  256. #endif
  257. /* fdprintf is more readable, we used it before dprintf was standardized */
  258. #include <unistd.h>
  259. #define fdprintf dprintf
  260. /* Useful for defeating gcc's alignment of "char message[]"-like data */
  261. #if !defined(__s390__)
  262. /* on s390[x], non-word-aligned data accesses require larger code */
  263. # define ALIGN1 __attribute__((aligned(1)))
  264. # define ALIGN2 __attribute__((aligned(2)))
  265. # define ALIGN4 __attribute__((aligned(4)))
  266. #else
  267. /* Arches which MUST have 2 or 4 byte alignment for everything are here */
  268. # define ALIGN1
  269. # define ALIGN2
  270. # define ALIGN4
  271. #endif
  272. /*
  273. * For 0.9.29 and svn, __ARCH_USE_MMU__ indicates no-mmu reliably.
  274. * For earlier versions there is no reliable way to check if we are building
  275. * for a mmu-less system.
  276. */
  277. #if ENABLE_NOMMU || \
  278. (defined __UCLIBC__ && \
  279. UCLIBC_VERSION > KERNEL_VERSION(0, 9, 28) && \
  280. !defined __ARCH_USE_MMU__)
  281. # define BB_MMU 0
  282. # define USE_FOR_NOMMU(...) __VA_ARGS__
  283. # define USE_FOR_MMU(...)
  284. #else
  285. # define BB_MMU 1
  286. # define USE_FOR_NOMMU(...)
  287. # define USE_FOR_MMU(...) __VA_ARGS__
  288. #endif
  289. #if defined(__digital__) && defined(__unix__)
  290. # include <standards.h>
  291. # include <inttypes.h>
  292. # define PRIu32 "u"
  293. # if !defined ADJ_OFFSET_SINGLESHOT && defined MOD_CLKA && defined MOD_OFFSET
  294. # define ADJ_OFFSET_SINGLESHOT (MOD_CLKA | MOD_OFFSET)
  295. # endif
  296. # if !defined ADJ_FREQUENCY && defined MOD_FREQUENCY
  297. # define ADJ_FREQUENCY MOD_FREQUENCY
  298. # endif
  299. # if !defined ADJ_TIMECONST && defined MOD_TIMECONST
  300. # define ADJ_TIMECONST MOD_TIMECONST
  301. # endif
  302. # if !defined ADJ_TICK && defined MOD_CLKB
  303. # define ADJ_TICK MOD_CLKB
  304. # endif
  305. #endif
  306. #if defined(__CYGWIN__)
  307. # define MAXSYMLINKS SYMLOOP_MAX
  308. #endif
  309. #if defined(ANDROID) || defined(__ANDROID__)
  310. # define BB_ADDITIONAL_PATH ":/system/sbin:/system/bin:/system/xbin"
  311. # define SYS_ioprio_set __NR_ioprio_set
  312. # define SYS_ioprio_get __NR_ioprio_get
  313. #endif
  314. /* ---- Who misses what? ------------------------------------ */
  315. /* Assume all these functions and header files exist by default.
  316. * Platforms where it is not true will #undef them below.
  317. */
  318. #define HAVE_CLEARENV 1
  319. #define HAVE_FDATASYNC 1
  320. #define HAVE_DPRINTF 1
  321. #define HAVE_MEMRCHR 1
  322. #define HAVE_MKDTEMP 1
  323. #define HAVE_PTSNAME_R 1
  324. #define HAVE_SETBIT 1
  325. #define HAVE_SIGHANDLER_T 1
  326. #define HAVE_STPCPY 1
  327. #define HAVE_STRCASESTR 1
  328. #define HAVE_STRCHRNUL 1
  329. #define HAVE_STRSEP 1
  330. #define HAVE_STRSIGNAL 1
  331. #define HAVE_STRVERSCMP 1
  332. #define HAVE_VASPRINTF 1
  333. #define HAVE_USLEEP 1
  334. #define HAVE_UNLOCKED_STDIO 1
  335. #define HAVE_UNLOCKED_LINE_OPS 1
  336. #define HAVE_GETLINE 1
  337. #define HAVE_XTABS 1
  338. #define HAVE_MNTENT_H 1
  339. #define HAVE_NET_ETHERNET_H 1
  340. #define HAVE_SYS_STATFS_H 1
  341. #if defined(__UCLIBC__)
  342. # if UCLIBC_VERSION < KERNEL_VERSION(0, 9, 32)
  343. # undef HAVE_STRVERSCMP
  344. # endif
  345. # if UCLIBC_VERSION >= KERNEL_VERSION(0, 9, 30)
  346. # ifndef __UCLIBC_SUSV3_LEGACY__
  347. # undef HAVE_USLEEP
  348. # endif
  349. # endif
  350. #endif
  351. #if defined(__WATCOMC__)
  352. # undef HAVE_DPRINTF
  353. # undef HAVE_GETLINE
  354. # undef HAVE_MEMRCHR
  355. # undef HAVE_MKDTEMP
  356. # undef HAVE_SETBIT
  357. # undef HAVE_STPCPY
  358. # undef HAVE_STRCASESTR
  359. # undef HAVE_STRCHRNUL
  360. # undef HAVE_STRSEP
  361. # undef HAVE_STRSIGNAL
  362. # undef HAVE_STRVERSCMP
  363. # undef HAVE_VASPRINTF
  364. # undef HAVE_UNLOCKED_STDIO
  365. # undef HAVE_UNLOCKED_LINE_OPS
  366. # undef HAVE_NET_ETHERNET_H
  367. #endif
  368. #if defined(__CYGWIN__)
  369. # undef HAVE_CLEARENV
  370. # undef HAVE_FDPRINTF
  371. # undef HAVE_MEMRCHR
  372. # undef HAVE_PTSNAME_R
  373. # undef HAVE_STRVERSCMP
  374. # undef HAVE_UNLOCKED_LINE_OPS
  375. #endif
  376. /* These BSD-derived OSes share many similarities */
  377. #if (defined __digital__ && defined __unix__) \
  378. || defined __APPLE__ \
  379. || defined __OpenBSD__ || defined __NetBSD__
  380. # undef HAVE_CLEARENV
  381. # undef HAVE_FDATASYNC
  382. # undef HAVE_GETLINE
  383. # undef HAVE_MNTENT_H
  384. # undef HAVE_PTSNAME_R
  385. # undef HAVE_SYS_STATFS_H
  386. # undef HAVE_SIGHANDLER_T
  387. # undef HAVE_STRVERSCMP
  388. # undef HAVE_XTABS
  389. # undef HAVE_DPRINTF
  390. # undef HAVE_UNLOCKED_STDIO
  391. # undef HAVE_UNLOCKED_LINE_OPS
  392. #endif
  393. #if defined(__dietlibc__)
  394. # undef HAVE_STRCHRNUL
  395. #endif
  396. #if defined(__APPLE__)
  397. # undef HAVE_STRCHRNUL
  398. #endif
  399. #if defined(__FreeBSD__)
  400. # undef HAVE_CLEARENV
  401. # undef HAVE_FDATASYNC
  402. # undef HAVE_MNTENT_H
  403. # undef HAVE_PTSNAME_R
  404. # undef HAVE_SYS_STATFS_H
  405. # undef HAVE_SIGHANDLER_T
  406. # undef HAVE_STRVERSCMP
  407. # undef HAVE_XTABS
  408. # undef HAVE_UNLOCKED_LINE_OPS
  409. # include <osreldate.h>
  410. # if __FreeBSD_version < 1000029
  411. # undef HAVE_STRCHRNUL /* FreeBSD added strchrnul() between 1000028 and 1000029 */
  412. # endif
  413. #endif
  414. #if defined(__NetBSD__)
  415. # define HAVE_GETLINE 1 /* Recent NetBSD versions have getline() */
  416. #endif
  417. #if defined(__digital__) && defined(__unix__)
  418. # undef HAVE_STPCPY
  419. #endif
  420. #if defined(ANDROID) || defined(__ANDROID__)
  421. # undef HAVE_DPRINTF
  422. # undef HAVE_GETLINE
  423. # undef HAVE_STPCPY
  424. # undef HAVE_STRCHRNUL
  425. # undef HAVE_STRVERSCMP
  426. # undef HAVE_UNLOCKED_LINE_OPS
  427. # undef HAVE_NET_ETHERNET_H
  428. #endif
  429. /*
  430. * Now, define prototypes for all the functions defined in platform.c
  431. * These must come after all the HAVE_* macros are defined (or not)
  432. */
  433. #ifndef HAVE_DPRINTF
  434. extern int dprintf(int fd, const char *format, ...);
  435. #endif
  436. #ifndef HAVE_MEMRCHR
  437. extern void *memrchr(const void *s, int c, size_t n) FAST_FUNC;
  438. #endif
  439. #ifndef HAVE_MKDTEMP
  440. extern char *mkdtemp(char *template) FAST_FUNC;
  441. #endif
  442. #ifndef HAVE_SETBIT
  443. # define setbit(a, b) ((a)[(b) >> 3] |= 1 << ((b) & 7))
  444. # define clrbit(a, b) ((a)[(b) >> 3] &= ~(1 << ((b) & 7)))
  445. #endif
  446. #ifndef HAVE_SIGHANDLER_T
  447. typedef void (*sighandler_t)(int);
  448. #endif
  449. #ifndef HAVE_STPCPY
  450. extern char *stpcpy(char *p, const char *to_add) FAST_FUNC;
  451. #endif
  452. #ifndef HAVE_STRCASESTR
  453. extern char *strcasestr(const char *s, const char *pattern) FAST_FUNC;
  454. #endif
  455. #ifndef HAVE_STRCHRNUL
  456. extern char *strchrnul(const char *s, int c) FAST_FUNC;
  457. #endif
  458. #ifndef HAVE_STRSEP
  459. extern char *strsep(char **stringp, const char *delim) FAST_FUNC;
  460. #endif
  461. #ifndef HAVE_STRSIGNAL
  462. /* Not exactly the same: instead of "Stopped" it shows "STOP" etc */
  463. # define strsignal(sig) get_signame(sig)
  464. #endif
  465. #ifndef HAVE_USLEEP
  466. extern int usleep(unsigned) FAST_FUNC;
  467. #endif
  468. #ifndef HAVE_VASPRINTF
  469. extern int vasprintf(char **string_ptr, const char *format, va_list p) FAST_FUNC;
  470. #endif
  471. #ifndef HAVE_GETLINE
  472. # include <stdio.h> /* for FILE */
  473. # include <sys/types.h> /* size_t */
  474. extern ssize_t getline(char **lineptr, size_t *n, FILE *stream) FAST_FUNC;
  475. #endif
  476. #endif