(root)/
glibc-2.38/
include/
stdlib.h
       1  #ifndef _STDLIB_H
       2  
       3  #ifndef _ISOMAC
       4  # include <stdbool.h>
       5  # include <stddef.h>
       6  #endif
       7  
       8  /* Workaround PR90731 with GCC 9 when using ldbl redirects in C++.  */
       9  #include <bits/floatn.h>
      10  #if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
      11  # if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3)
      12  #   pragma GCC system_header
      13  # endif
      14  #endif
      15  
      16  #include <stdlib/stdlib.h>
      17  
      18  /* Now define the internal interfaces.  */
      19  #if !defined _ISOMAC
      20  # include <sys/stat.h>
      21  
      22  # include <rtld-malloc.h>
      23  
      24  extern __typeof (strtol_l) __strtol_l;
      25  extern __typeof (strtoul_l) __strtoul_l;
      26  extern __typeof (strtoll_l) __strtoll_l;
      27  extern __typeof (strtoull_l) __strtoull_l;
      28  extern __typeof (strtod_l) __strtod_l;
      29  extern __typeof (strtof_l) __strtof_l;
      30  extern __typeof (strtold_l) __strtold_l;
      31  libc_hidden_proto (__strtol_l)
      32  libc_hidden_proto (__strtoul_l)
      33  libc_hidden_proto (__strtoll_l)
      34  libc_hidden_proto (__strtoull_l)
      35  libc_hidden_proto (__strtod_l)
      36  libc_hidden_proto (__strtof_l)
      37  libc_hidden_proto (__strtold_l)
      38  
      39  extern __typeof (strtol) __isoc23_strtol __attribute_copy__ (strtol);
      40  extern __typeof (strtoul) __isoc23_strtoul __attribute_copy__ (strtoul);
      41  extern __typeof (strtoll) __isoc23_strtoll __attribute_copy__ (strtoll);
      42  extern __typeof (strtoull) __isoc23_strtoull __attribute_copy__ (strtoull);
      43  extern __typeof (strtol_l) __isoc23_strtol_l __attribute_copy__ (strtol_l);
      44  extern __typeof (strtoul_l) __isoc23_strtoul_l __attribute_copy__ (strtoul_l);
      45  extern __typeof (strtoll_l) __isoc23_strtoll_l __attribute_copy__ (strtoll_l);
      46  extern __typeof (strtoull_l) __isoc23_strtoull_l __attribute_copy__ (strtoull_l);
      47  libc_hidden_proto (__isoc23_strtol)
      48  libc_hidden_proto (__isoc23_strtoul)
      49  libc_hidden_proto (__isoc23_strtoll)
      50  libc_hidden_proto (__isoc23_strtoull)
      51  libc_hidden_proto (__isoc23_strtol_l)
      52  libc_hidden_proto (__isoc23_strtoul_l)
      53  libc_hidden_proto (__isoc23_strtoll_l)
      54  libc_hidden_proto (__isoc23_strtoull_l)
      55  
      56  #if __GLIBC_USE (C2X_STRTOL)
      57  /* Redirect internal uses of these functions to the C2X versions; the
      58     redirection in the installed header does not work with
      59     libc_hidden_proto.  */
      60  # undef strtol
      61  # define strtol __isoc23_strtol
      62  # undef strtoul
      63  # define strtoul __isoc23_strtoul
      64  # undef strtoll
      65  # define strtoll __isoc23_strtoll
      66  # undef strtoull
      67  # define strtoull __isoc23_strtoull
      68  # undef strtol_l
      69  # define strtol_l __isoc23_strtol_l
      70  # undef strtoul_l
      71  # define strtoul_l __isoc23_strtoul_l
      72  # undef strtoll_l
      73  # define strtoll_l __isoc23_strtoll_l
      74  # undef strtoull_l
      75  # define strtoull_l __isoc23_strtoull_l
      76  #endif
      77  
      78  libc_hidden_proto (exit)
      79  libc_hidden_proto (abort)
      80  libc_hidden_proto (getenv)
      81  extern __typeof (secure_getenv) __libc_secure_getenv;
      82  libc_hidden_proto (__libc_secure_getenv)
      83  libc_hidden_proto (bsearch)
      84  libc_hidden_proto (qsort)
      85  extern __typeof (qsort_r) __qsort_r;
      86  libc_hidden_proto (__qsort_r)
      87  libc_hidden_proto (lrand48_r)
      88  libc_hidden_proto (wctomb)
      89  
      90  extern long int __random (void) attribute_hidden;
      91  extern void __srandom (unsigned int __seed);
      92  extern char *__initstate (unsigned int __seed, char *__statebuf,
      93  			  size_t __statelen);
      94  extern char *__setstate (char *__statebuf);
      95  extern int __random_r (struct random_data *__buf, int32_t *__result)
      96       attribute_hidden;
      97  extern int __srandom_r (unsigned int __seed, struct random_data *__buf)
      98       attribute_hidden;
      99  extern int __initstate_r (unsigned int __seed, char *__statebuf,
     100  			  size_t __statelen, struct random_data *__buf)
     101       attribute_hidden;
     102  extern int __setstate_r (char *__statebuf, struct random_data *__buf)
     103       attribute_hidden;
     104  extern int __rand_r (unsigned int *__seed);
     105  extern int __erand48_r (unsigned short int __xsubi[3],
     106  			struct drand48_data *__buffer, double *__result)
     107       attribute_hidden;
     108  extern int __nrand48_r (unsigned short int __xsubi[3],
     109  			struct drand48_data *__buffer,
     110  			long int *__result) attribute_hidden;
     111  extern int __jrand48_r (unsigned short int __xsubi[3],
     112  			struct drand48_data *__buffer,
     113  			long int *__result) attribute_hidden;
     114  extern int __srand48_r (long int __seedval,
     115  			struct drand48_data *__buffer) attribute_hidden;
     116  extern int __seed48_r (unsigned short int __seed16v[3],
     117  		       struct drand48_data *__buffer) attribute_hidden;
     118  extern int __lcong48_r (unsigned short int __param[7],
     119  			struct drand48_data *__buffer) attribute_hidden;
     120  
     121  /* Internal function to compute next state of the generator.  */
     122  extern int __drand48_iterate (unsigned short int __xsubi[3],
     123  			      struct drand48_data *__buffer)
     124       attribute_hidden;
     125  
     126  /* Global state for non-reentrant functions.  Defined in drand48-iter.c.  */
     127  extern struct drand48_data __libc_drand48_data attribute_hidden;
     128  
     129  extern int __setenv (const char *__name, const char *__value, int __replace)
     130       attribute_hidden;
     131  extern int __unsetenv (const char *__name) attribute_hidden;
     132  extern int __clearenv (void) attribute_hidden;
     133  extern char *__mktemp (char *__template) __THROW __nonnull ((1));
     134  libc_hidden_proto (__mktemp)
     135  extern char *__canonicalize_file_name (const char *__name);
     136  extern char *__realpath (const char *__name, char *__resolved);
     137  libc_hidden_proto (__realpath)
     138  extern int __ptsname_r (int __fd, char *__buf, size_t __buflen)
     139       attribute_hidden;
     140  # ifndef _ISOMAC
     141  extern int __ptsname_internal (int fd, char *buf, size_t buflen,
     142  			       struct stat64 *stp) attribute_hidden;
     143  # endif
     144  extern int __getpt (void);
     145  extern int __posix_openpt (int __oflag) attribute_hidden;
     146  
     147  extern int __add_to_environ (const char *name, const char *value,
     148  			     const char *combines, int replace)
     149       attribute_hidden;
     150  extern void _quicksort (void *const pbase, size_t total_elems,
     151  			size_t size, __compar_d_fn_t cmp, void *arg);
     152  
     153  extern int __on_exit (void (*__func) (int __status, void *__arg), void *__arg);
     154  
     155  extern int __cxa_atexit (void (*func) (void *), void *arg, void *d);
     156  libc_hidden_proto (__cxa_atexit);
     157  
     158  extern int __cxa_thread_atexit_impl (void (*func) (void *), void *arg,
     159  				     void *d);
     160  extern void __call_tls_dtors (void)
     161  #ifndef SHARED
     162    __attribute__ ((weak))
     163  #endif
     164    ;
     165  libc_hidden_proto (__call_tls_dtors)
     166  
     167  extern void __cxa_finalize (void *d);
     168  
     169  extern int __posix_memalign (void **memptr, size_t alignment, size_t size);
     170  
     171  extern void *__libc_memalign (size_t alignment, size_t size)
     172       __attribute_malloc__;
     173  
     174  extern void *__libc_reallocarray (void *__ptr, size_t __nmemb, size_t __size)
     175       __THROW __attribute_warn_unused_result__;
     176  libc_hidden_proto (__libc_reallocarray)
     177  
     178  extern int __libc_system (const char *line);
     179  
     180  extern __typeof (getpt) __getpt;
     181  extern __typeof (ptsname_r) __ptsname_r;
     182  libc_hidden_proto (__getpt)
     183  libc_hidden_proto (__ptsname_r)
     184  libc_hidden_proto (grantpt)
     185  libc_hidden_proto (unlockpt)
     186  
     187  __typeof (arc4random) __arc4random;
     188  libc_hidden_proto (__arc4random);
     189  __typeof (arc4random_buf) __arc4random_buf;
     190  libc_hidden_proto (__arc4random_buf);
     191  __typeof (arc4random_uniform) __arc4random_uniform;
     192  libc_hidden_proto (__arc4random_uniform);
     193  extern void __arc4random_buf_internal (void *buffer, size_t len)
     194       attribute_hidden;
     195  
     196  extern double __strtod_internal (const char *__restrict __nptr,
     197  				 char **__restrict __endptr, int __group)
     198       __THROW __nonnull ((1)) __wur;
     199  extern float __strtof_internal (const char *__restrict __nptr,
     200  				char **__restrict __endptr, int __group)
     201       __THROW __nonnull ((1)) __wur;
     202  extern long double __strtold_internal (const char *__restrict __nptr,
     203  				       char **__restrict __endptr,
     204  				       int __group)
     205       __THROW __nonnull ((1)) __wur;
     206  extern long int __strtol_internal (const char *__restrict __nptr,
     207  				   char **__restrict __endptr,
     208  				   int __base, int __group)
     209       __THROW __nonnull ((1)) __wur;
     210  extern unsigned long int __strtoul_internal (const char *__restrict __nptr,
     211  					     char **__restrict __endptr,
     212  					     int __base, int __group)
     213       __THROW __nonnull ((1)) __wur;
     214  __extension__
     215  extern long long int __strtoll_internal (const char *__restrict __nptr,
     216  					 char **__restrict __endptr,
     217  					 int __base, int __group)
     218       __THROW __nonnull ((1)) __wur;
     219  __extension__
     220  extern unsigned long long int __strtoull_internal (const char *
     221  						   __restrict __nptr,
     222  						   char **__restrict __endptr,
     223  						   int __base, int __group)
     224       __THROW __nonnull ((1)) __wur;
     225  libc_hidden_proto (__strtof_internal)
     226  libc_hidden_proto (__strtod_internal)
     227  libc_hidden_proto (__strtold_internal)
     228  libc_hidden_proto (__strtol_internal)
     229  libc_hidden_proto (__strtoll_internal)
     230  libc_hidden_proto (__strtoul_internal)
     231  libc_hidden_proto (__strtoull_internal)
     232  
     233  extern double ____strtod_l_internal (const char *__restrict __nptr,
     234  				     char **__restrict __endptr, int __group,
     235  				     locale_t __loc);
     236  extern float ____strtof_l_internal (const char *__restrict __nptr,
     237  				    char **__restrict __endptr, int __group,
     238  				    locale_t __loc);
     239  extern long double ____strtold_l_internal (const char *__restrict __nptr,
     240  					   char **__restrict __endptr,
     241  					   int __group, locale_t __loc);
     242  extern long int ____strtol_l_internal (const char *__restrict __nptr,
     243  				       char **__restrict __endptr,
     244  				       int __base, int __group,
     245  				       bool __bin_cst, locale_t __loc);
     246  extern unsigned long int ____strtoul_l_internal (const char *
     247  						 __restrict __nptr,
     248  						 char **__restrict __endptr,
     249  						 int __base, int __group,
     250  						 bool __bin_cst,
     251  						 locale_t __loc);
     252  __extension__
     253  extern long long int ____strtoll_l_internal (const char *__restrict __nptr,
     254  					     char **__restrict __endptr,
     255  					     int __base, int __group,
     256  					     bool __bin_cst, locale_t __loc);
     257  __extension__
     258  extern unsigned long long int ____strtoull_l_internal (const char *
     259  						       __restrict __nptr,
     260  						       char **
     261  						       __restrict __endptr,
     262  						       int __base, int __group,
     263  						       bool __bin_cst,
     264  						       locale_t __loc);
     265  
     266  libc_hidden_proto (____strtof_l_internal)
     267  libc_hidden_proto (____strtod_l_internal)
     268  libc_hidden_proto (____strtold_l_internal)
     269  libc_hidden_proto (____strtol_l_internal)
     270  libc_hidden_proto (____strtoll_l_internal)
     271  libc_hidden_proto (____strtoul_l_internal)
     272  libc_hidden_proto (____strtoull_l_internal)
     273  
     274  #include <bits/floatn.h>
     275  libc_hidden_proto (strtof)
     276  libc_hidden_proto (strtod)
     277  #if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
     278  libc_hidden_proto (strtold)
     279  #endif
     280  libc_hidden_proto (strtol)
     281  libc_hidden_proto (strtoll)
     282  libc_hidden_proto (strtoul)
     283  libc_hidden_proto (strtoull)
     284  
     285  libc_hidden_proto (atoi)
     286  
     287  extern float __strtof_nan (const char *, char **, char);
     288  extern double __strtod_nan (const char *, char **, char);
     289  extern long double __strtold_nan (const char *, char **, char);
     290  extern float __wcstof_nan (const wchar_t *, wchar_t **, wchar_t);
     291  extern double __wcstod_nan (const wchar_t *, wchar_t **, wchar_t);
     292  extern long double __wcstold_nan (const wchar_t *, wchar_t **, wchar_t);
     293  
     294  libc_hidden_proto (__strtof_nan)
     295  libc_hidden_proto (__strtod_nan)
     296  libc_hidden_proto (__strtold_nan)
     297  libc_hidden_proto (__wcstof_nan)
     298  libc_hidden_proto (__wcstod_nan)
     299  libc_hidden_proto (__wcstold_nan)
     300  
     301  /* Enable _FloatN bits as needed.  */
     302  #include <bits/floatn.h>
     303  
     304  #if __HAVE_DISTINCT_FLOAT128
     305  extern __typeof (strtof128_l) __strtof128_l;
     306  
     307  libc_hidden_proto (__strtof128_l)
     308  libc_hidden_proto (strtof128)
     309  
     310  extern _Float128 __strtof128_nan (const char *, char **, char);
     311  extern _Float128 __wcstof128_nan (const wchar_t *, wchar_t **, wchar_t);
     312  
     313  libc_hidden_proto (__strtof128_nan)
     314  libc_hidden_proto (__wcstof128_nan)
     315  
     316  extern _Float128 __strtof128_internal (const char *__restrict __nptr,
     317  				       char **__restrict __endptr,
     318  				       int __group);
     319  libc_hidden_proto (__strtof128_internal)
     320  
     321  extern _Float128 ____strtof128_l_internal (const char *__restrict __nptr,
     322  					   char **__restrict __endptr,
     323  					   int __group, locale_t __loc);
     324  
     325  libc_hidden_proto (____strtof128_l_internal)
     326  #endif
     327  
     328  extern char *__ecvt (double __value, int __ndigit, int *__restrict __decpt,
     329  		     int *__restrict __sign);
     330  extern char *__fcvt (double __value, int __ndigit, int *__restrict __decpt,
     331  		     int *__restrict __sign);
     332  extern char *__gcvt (double __value, int __ndigit, char *__buf);
     333  extern int __ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
     334  		     int *__restrict __sign, char *__restrict __buf,
     335  		     size_t __len);
     336  libc_hidden_proto (__ecvt_r)
     337  extern int __fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
     338  		     int *__restrict __sign, char *__restrict __buf,
     339  		     size_t __len);
     340  libc_hidden_proto (__fcvt_r)
     341  extern char *__qecvt (long double __value, int __ndigit,
     342  		      int *__restrict __decpt, int *__restrict __sign);
     343  extern char *__qfcvt (long double __value, int __ndigit,
     344  		      int *__restrict __decpt, int *__restrict __sign);
     345  extern char *__qgcvt (long double __value, int __ndigit, char *__buf);
     346  extern int __qecvt_r (long double __value, int __ndigit,
     347  		      int *__restrict __decpt, int *__restrict __sign,
     348  		      char *__restrict __buf, size_t __len);
     349  libc_hidden_proto (__qecvt_r)
     350  extern int __qfcvt_r (long double __value, int __ndigit,
     351  		      int *__restrict __decpt, int *__restrict __sign,
     352  		      char *__restrict __buf, size_t __len);
     353  libc_hidden_proto (__qfcvt_r)
     354  
     355  # if IS_IN (libc)
     356  #  undef MB_CUR_MAX
     357  #  define MB_CUR_MAX (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MB_CUR_MAX))
     358  # endif
     359  
     360  struct abort_msg_s
     361  {
     362    unsigned int size;
     363    char msg[0];
     364  };
     365  extern struct abort_msg_s *__abort_msg;
     366  libc_hidden_proto (__abort_msg)
     367  
     368  # if IS_IN (rtld)
     369  extern __typeof (unsetenv) unsetenv attribute_hidden;
     370  extern __typeof (__strtoul_internal) __strtoul_internal attribute_hidden;
     371  # endif
     372  
     373  #endif
     374  
     375  #endif  /* include/stdlib.h */