stdlib.h 4.2 KB

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