stdlib.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. #ifndef _STDLIB_H
  2. #define _STDLIB_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include <features.h>
  7. #ifdef __cplusplus
  8. #define NULL 0L
  9. #else
  10. #define NULL ((void*)0)
  11. #endif
  12. #define __NEED_size_t
  13. #define __NEED_wchar_t
  14. #include <bits/alltypes.h>
  15. int atoi (const char *);
  16. long atol (const char *);
  17. long long atoll (const char *);
  18. double atof (const char *);
  19. float strtof (const char *__restrict, char **__restrict);
  20. double strtod (const char *__restrict, char **__restrict);
  21. long double strtold (const char *__restrict, char **__restrict);
  22. long strtol (const char *__restrict, char **__restrict, int);
  23. unsigned long strtoul (const char *__restrict, char **__restrict, int);
  24. long long strtoll (const char *__restrict, char **__restrict, int);
  25. unsigned long long strtoull (const char *__restrict, char **__restrict, int);
  26. int rand (void);
  27. void srand (unsigned);
  28. void *malloc (size_t);
  29. void *calloc (size_t, size_t);
  30. void *realloc (void *, size_t);
  31. void free (void *);
  32. void *aligned_alloc(size_t alignment, size_t size);
  33. _Noreturn void abort (void);
  34. int atexit (void (*) (void));
  35. _Noreturn void exit (int);
  36. _Noreturn void _Exit (int);
  37. int at_quick_exit (void (*) (void));
  38. _Noreturn void quick_exit (int);
  39. char *getenv (const char *);
  40. int system (const char *);
  41. void *bsearch (const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
  42. void qsort (void *, size_t, size_t, int (*)(const void *, const void *));
  43. int abs (int);
  44. long labs (long);
  45. long long llabs (long long);
  46. typedef struct { int quot, rem; } div_t;
  47. typedef struct { long quot, rem; } ldiv_t;
  48. typedef struct { long long quot, rem; } lldiv_t;
  49. div_t div (int, int);
  50. ldiv_t ldiv (long, long);
  51. lldiv_t lldiv (long long, long long);
  52. int mblen (const char *, size_t);
  53. int mbtowc (wchar_t *__restrict, const char *__restrict, size_t);
  54. int wctomb (char *, wchar_t);
  55. size_t mbstowcs (wchar_t *__restrict, const char *__restrict, size_t);
  56. size_t wcstombs (char *__restrict, const wchar_t *__restrict, size_t);
  57. #define EXIT_FAILURE 1
  58. #define EXIT_SUCCESS 0
  59. size_t __ctype_get_mb_cur_max(void);
  60. #define MB_CUR_MAX (__ctype_get_mb_cur_max())
  61. #define RAND_MAX (0x7fffffff)
  62. #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  63. || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
  64. || defined(_BSD_SOURCE)
  65. #define WNOHANG 1
  66. #define WUNTRACED 2
  67. #define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
  68. #define WTERMSIG(s) ((s) & 0x7f)
  69. #define WSTOPSIG(s) WEXITSTATUS(s)
  70. #define WIFEXITED(s) (!WTERMSIG(s))
  71. #define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001)>>8) > 0x7f00)
  72. #define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu)
  73. int posix_memalign (void **, size_t, size_t);
  74. int setenv (const char *, const char *, int);
  75. int unsetenv (const char *);
  76. int mkstemp (char *);
  77. int mkostemp (char *, int);
  78. char *mkdtemp (char *);
  79. int getsubopt (char **, char *const *, char **);
  80. int rand_r (unsigned *);
  81. #endif
  82. #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
  83. || defined(_BSD_SOURCE)
  84. char *realpath (const char *__restrict, char *__restrict);
  85. long int random (void);
  86. void srandom (unsigned int);
  87. char *initstate (unsigned int, char *, size_t);
  88. char *setstate (char *);
  89. int putenv (char *);
  90. int posix_openpt (int);
  91. int grantpt (int);
  92. int unlockpt (int);
  93. char *ptsname (int);
  94. char *l64a (long);
  95. long a64l (const char *);
  96. void setkey (const char *);
  97. double drand48 (void);
  98. double erand48 (unsigned short [3]);
  99. long int lrand48 (void);
  100. long int nrand48 (unsigned short [3]);
  101. long mrand48 (void);
  102. long jrand48 (unsigned short [3]);
  103. void srand48 (long);
  104. unsigned short *seed48 (unsigned short [3]);
  105. void lcong48 (unsigned short [7]);
  106. #endif
  107. #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  108. #include <alloca.h>
  109. char *mktemp (char *);
  110. int mkstemps (char *, int);
  111. int mkostemps (char *, int, int);
  112. void *valloc (size_t);
  113. void *memalign(size_t, size_t);
  114. int getloadavg(double *, int);
  115. int clearenv(void);
  116. #define WCOREDUMP(s) ((s) & 0x80)
  117. #define WIFCONTINUED(s) ((s) == 0xffff)
  118. #endif
  119. #ifdef _GNU_SOURCE
  120. int ptsname_r(int, char *, size_t);
  121. char *ecvt(double, int, int *, int *);
  122. char *fcvt(double, int, int *, int *);
  123. char *gcvt(double, int, char *);
  124. struct __locale_struct;
  125. float strtof_l(const char *__restrict, char **__restrict, struct __locale_struct *);
  126. double strtod_l(const char *__restrict, char **__restrict, struct __locale_struct *);
  127. long double strtold_l(const char *__restrict, char **__restrict, struct __locale_struct *);
  128. #endif
  129. #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
  130. #define mkstemp64 mkstemp
  131. #define mkostemp64 mkostemp
  132. #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  133. #define mkstemps64 mkstemps
  134. #define mkostemps64 mkostemps
  135. #endif
  136. #endif
  137. #ifdef __cplusplus
  138. }
  139. #endif
  140. #endif