stdlib.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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. #define MB_CUR_MAX ((size_t)+4)
  60. #define RAND_MAX (0x7fffffff)
  61. #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  62. || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
  63. || defined(_BSD_SOURCE)
  64. #define WNOHANG 1
  65. #define WUNTRACED 2
  66. #define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
  67. #define WTERMSIG(s) ((s) & 0x7f)
  68. #define WSTOPSIG(s) WEXITSTATUS(s)
  69. #define WIFEXITED(s) (!WTERMSIG(s))
  70. #define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001)>>8) > 0x7f00)
  71. #define WIFSIGNALED(s) (((s)&0xffff)-1 < 0xffu)
  72. int posix_memalign (void **, size_t, size_t);
  73. int setenv (const char *, const char *, int);
  74. int unsetenv (const char *);
  75. int mkstemp (char *);
  76. int mkostemp (char *, int);
  77. char *mkdtemp (char *);
  78. int getsubopt (char **, char *const *, char **);
  79. int rand_r (unsigned *);
  80. #endif
  81. #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
  82. || defined(_BSD_SOURCE)
  83. char *realpath (const char *__restrict, char *__restrict);
  84. long int random (void);
  85. void srandom (unsigned int);
  86. char *initstate (unsigned int, char *, size_t);
  87. char *setstate (char *);
  88. #endif
  89. #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
  90. int putenv (char *);
  91. int posix_openpt (int);
  92. int grantpt (int);
  93. int unlockpt (int);
  94. char *ptsname (int);
  95. char *l64a (long);
  96. long a64l (const char *);
  97. void setkey (const char *);
  98. double drand48 (void);
  99. double erand48 (unsigned short [3]);
  100. long int lrand48 (void);
  101. long int nrand48 (unsigned short [3]);
  102. long mrand48 (void);
  103. long jrand48 (unsigned short [3]);
  104. void srand48 (long);
  105. unsigned short *seed48 (unsigned short [3]);
  106. void lcong48 (unsigned short [7]);
  107. #endif
  108. #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  109. #include <alloca.h>
  110. char *mktemp (char *);
  111. int mkstemps (char *, int);
  112. int mkostemps (char *, int, int);
  113. void *valloc (size_t);
  114. void *memalign(size_t, size_t);
  115. int getloadavg(double *, int);
  116. #define WCOREDUMP(s) ((s) & 0x80)
  117. #define WIFCONTINUED(s) ((s) == 0xffff)
  118. #endif
  119. #ifdef _GNU_SOURCE
  120. int clearenv(void);
  121. int ptsname_r(int, char *, size_t);
  122. char *ecvt(double, int, int *, int *);
  123. char *fcvt(double, int, int *, int *);
  124. char *gcvt(double, int, char *);
  125. struct __locale_struct;
  126. float strtof_l(const char *__restrict, char **__restrict, struct __locale_struct *);
  127. double strtod_l(const char *__restrict, char **__restrict, struct __locale_struct *);
  128. long double strtold_l(const char *__restrict, char **__restrict, struct __locale_struct *);
  129. #endif
  130. #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
  131. #define mkstemp64 mkstemp
  132. #define mkostemp64 mkostemp
  133. #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  134. #define mkstemps64 mkstemps
  135. #define mkostemps64 mkostemps
  136. #endif
  137. #endif
  138. #ifdef __cplusplus
  139. }
  140. #endif
  141. #endif