stdlib.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. #ifndef _STDLIB_H
  2. #define _STDLIB_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include <features.h>
  7. #undef NULL
  8. #ifdef __cplusplus
  9. #define NULL 0
  10. #else
  11. #define NULL ((void*)0)
  12. #endif
  13. #define __NEED_size_t
  14. #define __NEED_wchar_t
  15. #include <bits/alltypes.h>
  16. int atoi (const char *);
  17. long atol (const char *);
  18. long long atoll (const char *);
  19. double atof (const char *);
  20. float strtof (const char *__restrict, char **__restrict);
  21. double strtod (const char *__restrict, char **__restrict);
  22. long double strtold (const char *__restrict, char **__restrict);
  23. long strtol (const char *__restrict, char **__restrict, int);
  24. unsigned long strtoul (const char *__restrict, char **__restrict, int);
  25. long long strtoll (const char *__restrict, char **__restrict, int);
  26. unsigned long long strtoull (const char *__restrict, char **__restrict, int);
  27. int rand (void);
  28. void srand (unsigned);
  29. void *malloc (size_t);
  30. void *calloc (size_t, size_t);
  31. void *realloc (void *, size_t);
  32. void free (void *);
  33. void *aligned_alloc(size_t alignment, size_t size);
  34. _Noreturn void abort (void);
  35. int atexit (void (*) (void));
  36. _Noreturn void exit (int);
  37. _Noreturn void _Exit (int);
  38. int at_quick_exit (void (*) (void));
  39. _Noreturn void quick_exit (int);
  40. char *getenv (const char *);
  41. int system (const char *);
  42. void *bsearch (const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
  43. void qsort (void *, size_t, size_t, int (*)(const void *, const void *));
  44. int abs (int);
  45. long labs (long);
  46. long long llabs (long long);
  47. typedef struct { int quot, rem; } div_t;
  48. typedef struct { long quot, rem; } ldiv_t;
  49. typedef struct { long long quot, rem; } lldiv_t;
  50. div_t div (int, int);
  51. ldiv_t ldiv (long, long);
  52. lldiv_t lldiv (long long, long long);
  53. int mblen (const char *, size_t);
  54. int mbtowc (wchar_t *__restrict, const char *__restrict, size_t);
  55. int wctomb (char *, wchar_t);
  56. size_t mbstowcs (wchar_t *__restrict, const char *__restrict, size_t);
  57. size_t wcstombs (char *__restrict, const wchar_t *__restrict, size_t);
  58. #define EXIT_FAILURE 1
  59. #define EXIT_SUCCESS 0
  60. #define MB_CUR_MAX ((size_t)+4)
  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) (((s) & 0xff) == 0x7f)
  72. #define WIFSIGNALED(s) (((signed char) (((s) & 0x7f) + 1) >> 1) > 0)
  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. 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. void *valloc (size_t);
  112. void *memalign(size_t, size_t);
  113. #define WCOREDUMP(s) ((s) & 0x80)
  114. #define WIFCONTINUED(s) ((s) == 0xffff)
  115. #endif
  116. #ifdef _GNU_SOURCE
  117. int clearenv(void);
  118. int ptsname_r(int, char *, size_t);
  119. char *ecvt(double, int, int *, int *);
  120. char *fcvt(double, int, int *, int *);
  121. char *gcvt(double, int, char *);
  122. #endif
  123. #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
  124. #define mkstemp64 mkstemp
  125. #endif
  126. #ifdef __cplusplus
  127. }
  128. #endif
  129. #endif