stdlib.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. char *mkdtemp (char *);
  73. int getsubopt (char **, char *const *, char **);
  74. int rand_r (unsigned *);
  75. #endif
  76. #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
  77. || defined(_BSD_SOURCE)
  78. char *realpath (const char *__restrict, char *__restrict);
  79. long int random (void);
  80. void srandom (unsigned int);
  81. char *initstate (unsigned int, char *, size_t);
  82. char *setstate (char *);
  83. #endif
  84. #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
  85. int putenv (char *);
  86. int posix_openpt (int);
  87. int grantpt (int);
  88. int unlockpt (int);
  89. char *ptsname (int);
  90. char *l64a (long);
  91. long a64l (const char *);
  92. void setkey (const char *);
  93. double drand48 (void);
  94. double erand48 (unsigned short [3]);
  95. long int lrand48 (void);
  96. long int nrand48 (unsigned short [3]);
  97. long mrand48 (void);
  98. long jrand48 (unsigned short [3]);
  99. void srand48 (long);
  100. unsigned short *seed48 (unsigned short [3]);
  101. void lcong48 (unsigned short [7]);
  102. #endif
  103. #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  104. #include <alloca.h>
  105. char *mktemp (char *);
  106. void *valloc (size_t);
  107. void *memalign(size_t, size_t);
  108. #define WCOREDUMP(s) ((s) & 0x80)
  109. #define WIFCONTINUED(s) ((s) == 0xffff)
  110. #endif
  111. #ifdef _GNU_SOURCE
  112. int clearenv(void);
  113. int ptsname_r(int, char *, size_t);
  114. char *ecvt(double, int, int *, int *);
  115. char *fcvt(double, int, int *, int *);
  116. char *gcvt(double, int, char *);
  117. #endif
  118. #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
  119. #define mkstemp64 mkstemp
  120. #endif
  121. #ifdef __cplusplus
  122. }
  123. #endif
  124. #endif