master
   1/* Copyright (C) 1991-2025 Free Software Foundation, Inc.
   2   Copyright The GNU Toolchain Authors.
   3   This file is part of the GNU C Library.
   4
   5   The GNU C Library is free software; you can redistribute it and/or
   6   modify it under the terms of the GNU Lesser General Public
   7   License as published by the Free Software Foundation; either
   8   version 2.1 of the License, or (at your option) any later version.
   9
  10   The GNU C Library is distributed in the hope that it will be useful,
  11   but WITHOUT ANY WARRANTY; without even the implied warranty of
  12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13   Lesser General Public License for more details.
  14
  15   You should have received a copy of the GNU Lesser General Public
  16   License along with the GNU C Library; if not, see
  17   <https://www.gnu.org/licenses/>.  */
  18
  19/*
  20 *	ISO C99 Standard: 7.20 General utilities	<stdlib.h>
  21 */
  22
  23#ifndef	_STDLIB_H
  24
  25#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
  26#include <bits/libc-header-start.h>
  27
  28/* Get size_t, wchar_t and NULL from <stddef.h>.  */
  29#define __need_size_t
  30#define __need_wchar_t
  31#define __need_NULL
  32#include <stddef.h>
  33
  34__BEGIN_DECLS
  35
  36#define	_STDLIB_H	1
  37
  38#if (defined __USE_XOPEN || defined __USE_XOPEN2K8) && !defined _SYS_WAIT_H
  39/* XPG requires a few symbols from <sys/wait.h> being defined.  */
  40# include <bits/waitflags.h>
  41# include <bits/waitstatus.h>
  42
  43/* Define the macros <sys/wait.h> also would define this way.  */
  44# define WEXITSTATUS(status)	__WEXITSTATUS (status)
  45# define WTERMSIG(status)	__WTERMSIG (status)
  46# define WSTOPSIG(status)	__WSTOPSIG (status)
  47# define WIFEXITED(status)	__WIFEXITED (status)
  48# define WIFSIGNALED(status)	__WIFSIGNALED (status)
  49# define WIFSTOPPED(status)	__WIFSTOPPED (status)
  50# ifdef __WIFCONTINUED
  51#  define WIFCONTINUED(status)	__WIFCONTINUED (status)
  52# endif
  53#endif	/* X/Open or XPG7 and <sys/wait.h> not included.  */
  54
  55/* _FloatN API tests for enablement.  */
  56#include <bits/floatn.h>
  57
  58/* Returned by `div'.  */
  59typedef struct
  60  {
  61    int quot;			/* Quotient.  */
  62    int rem;			/* Remainder.  */
  63  } div_t;
  64
  65/* Returned by `ldiv'.  */
  66#ifndef __ldiv_t_defined
  67typedef struct
  68  {
  69    long int quot;		/* Quotient.  */
  70    long int rem;		/* Remainder.  */
  71  } ldiv_t;
  72# define __ldiv_t_defined	1
  73#endif
  74
  75#if defined __USE_ISOC99 && !defined __lldiv_t_defined
  76/* Returned by `lldiv'.  */
  77__extension__ typedef struct
  78  {
  79    long long int quot;		/* Quotient.  */
  80    long long int rem;		/* Remainder.  */
  81  } lldiv_t;
  82# define __lldiv_t_defined	1
  83#endif
  84
  85
  86/* The largest number rand will return (same as INT_MAX).  */
  87#define	RAND_MAX	2147483647
  88
  89
  90/* We define these the same for all machines.
  91   Changes from this to the outside world should be done in `_exit'.  */
  92#define	EXIT_FAILURE	1	/* Failing exit status.  */
  93#define	EXIT_SUCCESS	0	/* Successful exit status.  */
  94
  95
  96/* Maximum length of a multibyte character in the current locale.  */
  97#define	MB_CUR_MAX	(__ctype_get_mb_cur_max ())
  98extern size_t __ctype_get_mb_cur_max (void) __THROW __wur;
  99
 100
 101/* Convert a string to a floating-point number.  */
 102extern double atof (const char *__nptr)
 103     __THROW __attribute_pure__ __nonnull ((1)) __wur;
 104/* Convert a string to an integer.  */
 105extern int atoi (const char *__nptr)
 106     __THROW __attribute_pure__ __nonnull ((1)) __wur;
 107/* Convert a string to a long integer.  */
 108extern long int atol (const char *__nptr)
 109     __THROW __attribute_pure__ __nonnull ((1)) __wur;
 110
 111#ifdef __USE_ISOC99
 112/* Convert a string to a long long integer.  */
 113__extension__ extern long long int atoll (const char *__nptr)
 114     __THROW __attribute_pure__ __nonnull ((1)) __wur;
 115#endif
 116
 117/* Convert a string to a floating-point number.  */
 118extern double strtod (const char *__restrict __nptr,
 119		      char **__restrict __endptr)
 120     __THROW __nonnull ((1));
 121
 122#ifdef	__USE_ISOC99
 123/* Likewise for `float' and `long double' sizes of floating-point numbers.  */
 124extern float strtof (const char *__restrict __nptr,
 125		     char **__restrict __endptr) __THROW __nonnull ((1));
 126
 127extern long double strtold (const char *__restrict __nptr,
 128			    char **__restrict __endptr)
 129     __THROW __nonnull ((1));
 130#endif
 131
 132/* Likewise for '_FloatN' and '_FloatNx'.  */
 133
 134#if __HAVE_FLOAT16 && __GLIBC_USE (IEC_60559_TYPES_EXT)
 135extern _Float16 strtof16 (const char *__restrict __nptr,
 136			  char **__restrict __endptr)
 137     __THROW __nonnull ((1));
 138#endif
 139
 140#if __HAVE_FLOAT32 && __GLIBC_USE (IEC_60559_TYPES_EXT)
 141extern _Float32 strtof32 (const char *__restrict __nptr,
 142			  char **__restrict __endptr)
 143     __THROW __nonnull ((1));
 144#endif
 145
 146#if __HAVE_FLOAT64 && __GLIBC_USE (IEC_60559_TYPES_EXT)
 147extern _Float64 strtof64 (const char *__restrict __nptr,
 148			  char **__restrict __endptr)
 149     __THROW __nonnull ((1));
 150#endif
 151
 152#if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)
 153extern _Float128 strtof128 (const char *__restrict __nptr,
 154			    char **__restrict __endptr)
 155     __THROW __nonnull ((1));
 156#endif
 157
 158#if __HAVE_FLOAT32X && __GLIBC_USE (IEC_60559_TYPES_EXT)
 159extern _Float32x strtof32x (const char *__restrict __nptr,
 160			    char **__restrict __endptr)
 161     __THROW __nonnull ((1));
 162#endif
 163
 164#if __HAVE_FLOAT64X && __GLIBC_USE (IEC_60559_TYPES_EXT)
 165extern _Float64x strtof64x (const char *__restrict __nptr,
 166			    char **__restrict __endptr)
 167     __THROW __nonnull ((1));
 168#endif
 169
 170#if __HAVE_FLOAT128X && __GLIBC_USE (IEC_60559_TYPES_EXT)
 171extern _Float128x strtof128x (const char *__restrict __nptr,
 172			      char **__restrict __endptr)
 173     __THROW __nonnull ((1));
 174#endif
 175
 176/* Convert a string to a long integer.  */
 177extern long int strtol (const char *__restrict __nptr,
 178			char **__restrict __endptr, int __base)
 179     __THROW __nonnull ((1));
 180/* Convert a string to an unsigned long integer.  */
 181extern unsigned long int strtoul (const char *__restrict __nptr,
 182				  char **__restrict __endptr, int __base)
 183     __THROW __nonnull ((1));
 184
 185#ifdef __USE_MISC
 186/* Convert a string to a quadword integer.  */
 187__extension__
 188extern long long int strtoq (const char *__restrict __nptr,
 189			     char **__restrict __endptr, int __base)
 190     __THROW __nonnull ((1));
 191/* Convert a string to an unsigned quadword integer.  */
 192__extension__
 193extern unsigned long long int strtouq (const char *__restrict __nptr,
 194				       char **__restrict __endptr, int __base)
 195     __THROW __nonnull ((1));
 196#endif /* Use misc.  */
 197
 198#ifdef __USE_ISOC99
 199/* Convert a string to a quadword integer.  */
 200__extension__
 201extern long long int strtoll (const char *__restrict __nptr,
 202			      char **__restrict __endptr, int __base)
 203     __THROW __nonnull ((1));
 204/* Convert a string to an unsigned quadword integer.  */
 205__extension__
 206extern unsigned long long int strtoull (const char *__restrict __nptr,
 207					char **__restrict __endptr, int __base)
 208     __THROW __nonnull ((1));
 209#endif /* ISO C99 or use MISC.  */
 210
 211/* Versions of the above functions that handle '0b' and '0B' prefixes
 212   in base 0 or 2.  */
 213#if __GLIBC_USE (C23_STRTOL)
 214# ifdef __REDIRECT
 215extern long int __REDIRECT_NTH (strtol, (const char *__restrict __nptr,
 216					 char **__restrict __endptr,
 217					 int __base), __isoc23_strtol)
 218     __nonnull ((1));
 219extern unsigned long int __REDIRECT_NTH (strtoul,
 220					 (const char *__restrict __nptr,
 221					  char **__restrict __endptr,
 222					  int __base), __isoc23_strtoul)
 223     __nonnull ((1));
 224#  ifdef __USE_MISC
 225__extension__
 226extern long long int __REDIRECT_NTH (strtoq, (const char *__restrict __nptr,
 227					      char **__restrict __endptr,
 228					      int __base), __isoc23_strtoll)
 229     __nonnull ((1));
 230__extension__
 231extern unsigned long long int __REDIRECT_NTH (strtouq,
 232					      (const char *__restrict __nptr,
 233					       char **__restrict __endptr,
 234					       int __base), __isoc23_strtoull)
 235     __nonnull ((1));
 236#  endif
 237__extension__
 238extern long long int __REDIRECT_NTH (strtoll, (const char *__restrict __nptr,
 239					       char **__restrict __endptr,
 240					       int __base), __isoc23_strtoll)
 241     __nonnull ((1));
 242__extension__
 243extern unsigned long long int __REDIRECT_NTH (strtoull,
 244					      (const char *__restrict __nptr,
 245					       char **__restrict __endptr,
 246					       int __base), __isoc23_strtoull)
 247     __nonnull ((1));
 248# else
 249extern long int __isoc23_strtol (const char *__restrict __nptr,
 250				 char **__restrict __endptr, int __base)
 251     __THROW __nonnull ((1));
 252extern unsigned long int __isoc23_strtoul (const char *__restrict __nptr,
 253					   char **__restrict __endptr,
 254					   int __base)
 255     __THROW __nonnull ((1));
 256__extension__
 257extern long long int __isoc23_strtoll (const char *__restrict __nptr,
 258				       char **__restrict __endptr, int __base)
 259     __THROW __nonnull ((1));
 260__extension__
 261extern unsigned long long int __isoc23_strtoull (const char *__restrict __nptr,
 262						 char **__restrict __endptr,
 263						 int __base)
 264     __THROW __nonnull ((1));
 265#  define strtol __isoc23_strtol
 266#  define strtoul __isoc23_strtoul
 267#  ifdef __USE_MISC
 268#   define strtoq __isoc23_strtoll
 269#   define strtouq __isoc23_strtoull
 270#  endif
 271#  define strtoll __isoc23_strtoll
 272#  define strtoull __isoc23_strtoull
 273# endif
 274#endif
 275
 276/* Convert a floating-point number to a string.  */
 277#if __GLIBC_USE (IEC_60559_BFP_EXT_C23)
 278extern int strfromd (char *__dest, size_t __size, const char *__format,
 279		     double __f)
 280     __THROW __nonnull ((3));
 281
 282extern int strfromf (char *__dest, size_t __size, const char *__format,
 283		     float __f)
 284     __THROW __nonnull ((3));
 285
 286extern int strfroml (char *__dest, size_t __size, const char *__format,
 287		     long double __f)
 288     __THROW __nonnull ((3));
 289#endif
 290
 291#if __HAVE_FLOAT16 && __GLIBC_USE (IEC_60559_TYPES_EXT)
 292extern int strfromf16 (char *__dest, size_t __size, const char * __format,
 293		       _Float16 __f)
 294     __THROW __nonnull ((3));
 295#endif
 296
 297#if __HAVE_FLOAT32 && __GLIBC_USE (IEC_60559_TYPES_EXT)
 298extern int strfromf32 (char *__dest, size_t __size, const char * __format,
 299		       _Float32 __f)
 300     __THROW __nonnull ((3));
 301#endif
 302
 303#if __HAVE_FLOAT64 && __GLIBC_USE (IEC_60559_TYPES_EXT)
 304extern int strfromf64 (char *__dest, size_t __size, const char * __format,
 305		       _Float64 __f)
 306     __THROW __nonnull ((3));
 307#endif
 308
 309#if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)
 310extern int strfromf128 (char *__dest, size_t __size, const char * __format,
 311			_Float128 __f)
 312     __THROW __nonnull ((3));
 313#endif
 314
 315#if __HAVE_FLOAT32X && __GLIBC_USE (IEC_60559_TYPES_EXT)
 316extern int strfromf32x (char *__dest, size_t __size, const char * __format,
 317			_Float32x __f)
 318     __THROW __nonnull ((3));
 319#endif
 320
 321#if __HAVE_FLOAT64X && __GLIBC_USE (IEC_60559_TYPES_EXT)
 322extern int strfromf64x (char *__dest, size_t __size, const char * __format,
 323			_Float64x __f)
 324     __THROW __nonnull ((3));
 325#endif
 326
 327#if __HAVE_FLOAT128X && __GLIBC_USE (IEC_60559_TYPES_EXT)
 328extern int strfromf128x (char *__dest, size_t __size, const char * __format,
 329			 _Float128x __f)
 330     __THROW __nonnull ((3));
 331#endif
 332
 333
 334#ifdef __USE_GNU
 335/* Parallel versions of the functions above which take the locale to
 336   use as an additional parameter.  These are GNU extensions inspired
 337   by the POSIX.1-2008 extended locale API.  */
 338# include <bits/types/locale_t.h>
 339
 340extern long int strtol_l (const char *__restrict __nptr,
 341			  char **__restrict __endptr, int __base,
 342			  locale_t __loc) __THROW __nonnull ((1, 4));
 343
 344extern unsigned long int strtoul_l (const char *__restrict __nptr,
 345				    char **__restrict __endptr,
 346				    int __base, locale_t __loc)
 347     __THROW __nonnull ((1, 4));
 348
 349__extension__
 350extern long long int strtoll_l (const char *__restrict __nptr,
 351				char **__restrict __endptr, int __base,
 352				locale_t __loc)
 353     __THROW __nonnull ((1, 4));
 354
 355__extension__
 356extern unsigned long long int strtoull_l (const char *__restrict __nptr,
 357					  char **__restrict __endptr,
 358					  int __base, locale_t __loc)
 359     __THROW __nonnull ((1, 4));
 360
 361/* Versions of the above functions that handle '0b' and '0B' prefixes
 362   in base 0 or 2.  */
 363# if __GLIBC_USE (C23_STRTOL)
 364#  ifdef __REDIRECT
 365extern long int __REDIRECT_NTH (strtol_l, (const char *__restrict __nptr,
 366					   char **__restrict __endptr,
 367					   int __base, locale_t __loc),
 368				__isoc23_strtol_l)
 369     __nonnull ((1, 4));
 370extern unsigned long int __REDIRECT_NTH (strtoul_l,
 371					 (const char *__restrict __nptr,
 372					  char **__restrict __endptr,
 373					  int __base, locale_t __loc),
 374					 __isoc23_strtoul_l)
 375     __nonnull ((1, 4));
 376__extension__
 377extern long long int __REDIRECT_NTH (strtoll_l, (const char *__restrict __nptr,
 378						 char **__restrict __endptr,
 379						 int __base,
 380						 locale_t __loc),
 381				     __isoc23_strtoll_l)
 382     __nonnull ((1, 4));
 383__extension__
 384extern unsigned long long int __REDIRECT_NTH (strtoull_l,
 385					      (const char *__restrict __nptr,
 386					       char **__restrict __endptr,
 387					       int __base, locale_t __loc),
 388					      __isoc23_strtoull_l)
 389     __nonnull ((1, 4));
 390#  else
 391extern long int __isoc23_strtol_l (const char *__restrict __nptr,
 392				   char **__restrict __endptr, int __base,
 393				   locale_t __loc) __THROW __nonnull ((1, 4));
 394extern unsigned long int __isoc23_strtoul_l (const char *__restrict __nptr,
 395					     char **__restrict __endptr,
 396					     int __base, locale_t __loc)
 397     __THROW __nonnull ((1, 4));
 398__extension__
 399extern long long int __isoc23_strtoll_l (const char *__restrict __nptr,
 400					 char **__restrict __endptr,
 401					 int __base, locale_t __loc)
 402     __THROW __nonnull ((1, 4));
 403__extension__
 404extern unsigned long long int __isoc23_strtoull_l (const char *__restrict __nptr,
 405						   char **__restrict __endptr,
 406						   int __base, locale_t __loc)
 407     __THROW __nonnull ((1, 4));
 408#   define strtol_l __isoc23_strtol_l
 409#   define strtoul_l __isoc23_strtoul_l
 410#   define strtoll_l __isoc23_strtoll_l
 411#   define strtoull_l __isoc23_strtoull_l
 412#  endif
 413# endif
 414
 415extern double strtod_l (const char *__restrict __nptr,
 416			char **__restrict __endptr, locale_t __loc)
 417     __THROW __nonnull ((1, 3));
 418
 419extern float strtof_l (const char *__restrict __nptr,
 420		       char **__restrict __endptr, locale_t __loc)
 421     __THROW __nonnull ((1, 3));
 422
 423extern long double strtold_l (const char *__restrict __nptr,
 424			      char **__restrict __endptr,
 425			      locale_t __loc)
 426     __THROW __nonnull ((1, 3));
 427
 428# if __HAVE_FLOAT16
 429extern _Float16 strtof16_l (const char *__restrict __nptr,
 430			    char **__restrict __endptr,
 431			    locale_t __loc)
 432     __THROW __nonnull ((1, 3));
 433# endif
 434
 435# if __HAVE_FLOAT32
 436extern _Float32 strtof32_l (const char *__restrict __nptr,
 437			    char **__restrict __endptr,
 438			    locale_t __loc)
 439     __THROW __nonnull ((1, 3));
 440# endif
 441
 442# if __HAVE_FLOAT64
 443extern _Float64 strtof64_l (const char *__restrict __nptr,
 444			    char **__restrict __endptr,
 445			    locale_t __loc)
 446     __THROW __nonnull ((1, 3));
 447# endif
 448
 449# if __HAVE_FLOAT128
 450extern _Float128 strtof128_l (const char *__restrict __nptr,
 451			      char **__restrict __endptr,
 452			      locale_t __loc)
 453     __THROW __nonnull ((1, 3));
 454# endif
 455
 456# if __HAVE_FLOAT32X
 457extern _Float32x strtof32x_l (const char *__restrict __nptr,
 458			      char **__restrict __endptr,
 459			      locale_t __loc)
 460     __THROW __nonnull ((1, 3));
 461# endif
 462
 463# if __HAVE_FLOAT64X
 464extern _Float64x strtof64x_l (const char *__restrict __nptr,
 465			      char **__restrict __endptr,
 466			      locale_t __loc)
 467     __THROW __nonnull ((1, 3));
 468# endif
 469
 470# if __HAVE_FLOAT128X
 471extern _Float128x strtof128x_l (const char *__restrict __nptr,
 472				char **__restrict __endptr,
 473				locale_t __loc)
 474     __THROW __nonnull ((1, 3));
 475# endif
 476#endif /* GNU */
 477
 478
 479#ifdef __USE_EXTERN_INLINES
 480__extern_inline int
 481__NTH (atoi (const char *__nptr))
 482{
 483  return (int) strtol (__nptr, (char **) NULL, 10);
 484}
 485__extern_inline long int
 486__NTH (atol (const char *__nptr))
 487{
 488  return strtol (__nptr, (char **) NULL, 10);
 489}
 490
 491# ifdef __USE_ISOC99
 492__extension__ __extern_inline long long int
 493__NTH (atoll (const char *__nptr))
 494{
 495  return strtoll (__nptr, (char **) NULL, 10);
 496}
 497# endif
 498#endif /* Optimizing and Inlining.  */
 499
 500
 501#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
 502/* Convert N to base 64 using the digits "./0-9A-Za-z", least-significant
 503   digit first.  Returns a pointer to static storage overwritten by the
 504   next call.  */
 505extern char *l64a (long int __n) __THROW __wur;
 506
 507/* Read a number from a string S in base 64 as above.  */
 508extern long int a64l (const char *__s)
 509     __THROW __attribute_pure__ __nonnull ((1)) __wur;
 510
 511#endif	/* Use misc || extended X/Open.  */
 512
 513#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
 514# include <sys/types.h>	/* we need int32_t... */
 515
 516/* These are the functions that actually do things.  The `random', `srandom',
 517   `initstate' and `setstate' functions are those from BSD Unices.
 518   The `rand' and `srand' functions are required by the ANSI standard.
 519   We provide both interfaces to the same random number generator.  */
 520/* Return a random long integer between 0 and 2^31-1 inclusive.  */
 521extern long int random (void) __THROW;
 522
 523/* Seed the random number generator with the given number.  */
 524extern void srandom (unsigned int __seed) __THROW;
 525
 526/* Initialize the random number generator to use state buffer STATEBUF,
 527   of length STATELEN, and seed it with SEED.  Optimal lengths are 8, 16,
 528   32, 64, 128 and 256, the bigger the better; values less than 8 will
 529   cause an error and values greater than 256 will be rounded down.  */
 530extern char *initstate (unsigned int __seed, char *__statebuf,
 531			size_t __statelen) __THROW __nonnull ((2));
 532
 533/* Switch the random number generator to state buffer STATEBUF,
 534   which should have been previously initialized by `initstate'.  */
 535extern char *setstate (char *__statebuf) __THROW __nonnull ((1));
 536
 537
 538# ifdef __USE_MISC
 539/* Reentrant versions of the `random' family of functions.
 540   These functions all use the following data structure to contain
 541   state, rather than global state variables.  */
 542
 543struct random_data
 544  {
 545    int32_t *fptr;		/* Front pointer.  */
 546    int32_t *rptr;		/* Rear pointer.  */
 547    int32_t *state;		/* Array of state values.  */
 548    int rand_type;		/* Type of random number generator.  */
 549    int rand_deg;		/* Degree of random number generator.  */
 550    int rand_sep;		/* Distance between front and rear.  */
 551    int32_t *end_ptr;		/* Pointer behind state table.  */
 552  };
 553
 554extern int random_r (struct random_data *__restrict __buf,
 555		     int32_t *__restrict __result) __THROW __nonnull ((1, 2));
 556
 557extern int srandom_r (unsigned int __seed, struct random_data *__buf)
 558     __THROW __nonnull ((2));
 559
 560extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
 561			size_t __statelen,
 562			struct random_data *__restrict __buf)
 563     __THROW __nonnull ((2, 4));
 564
 565extern int setstate_r (char *__restrict __statebuf,
 566		       struct random_data *__restrict __buf)
 567     __THROW __nonnull ((1, 2));
 568# endif	/* Use misc.  */
 569#endif	/* Use extended X/Open || misc. */
 570
 571
 572/* Return a random integer between 0 and RAND_MAX inclusive.  */
 573extern int rand (void) __THROW;
 574/* Seed the random number generator with the given number.  */
 575extern void srand (unsigned int __seed) __THROW;
 576
 577#ifdef __USE_POSIX199506
 578/* Reentrant interface according to POSIX.1.  */
 579extern int rand_r (unsigned int *__seed) __THROW;
 580#endif
 581
 582
 583#if defined __USE_MISC || defined __USE_XOPEN
 584/* System V style 48-bit random number generator functions.  */
 585
 586/* Return non-negative, double-precision floating-point value in [0.0,1.0).  */
 587extern double drand48 (void) __THROW;
 588extern double erand48 (unsigned short int __xsubi[3]) __THROW __nonnull ((1));
 589
 590/* Return non-negative, long integer in [0,2^31).  */
 591extern long int lrand48 (void) __THROW;
 592extern long int nrand48 (unsigned short int __xsubi[3])
 593     __THROW __nonnull ((1));
 594
 595/* Return signed, long integers in [-2^31,2^31).  */
 596extern long int mrand48 (void) __THROW;
 597extern long int jrand48 (unsigned short int __xsubi[3])
 598     __THROW __nonnull ((1));
 599
 600/* Seed random number generator.  */
 601extern void srand48 (long int __seedval) __THROW;
 602extern unsigned short int *seed48 (unsigned short int __seed16v[3])
 603     __THROW __nonnull ((1));
 604extern void lcong48 (unsigned short int __param[7]) __THROW __nonnull ((1));
 605
 606# ifdef __USE_MISC
 607/* Data structure for communication with thread safe versions.  This
 608   type is to be regarded as opaque.  It's only exported because users
 609   have to allocate objects of this type.  */
 610struct drand48_data
 611  {
 612    unsigned short int __x[3];	/* Current state.  */
 613    unsigned short int __old_x[3]; /* Old state.  */
 614    unsigned short int __c;	/* Additive const. in congruential formula.  */
 615    unsigned short int __init;	/* Flag for initializing.  */
 616    __extension__ unsigned long long int __a;	/* Factor in congruential
 617						   formula.  */
 618  };
 619
 620/* Return non-negative, double-precision floating-point value in [0.0,1.0).  */
 621extern int drand48_r (struct drand48_data *__restrict __buffer,
 622		      double *__restrict __result) __THROW __nonnull ((1, 2));
 623extern int erand48_r (unsigned short int __xsubi[3],
 624		      struct drand48_data *__restrict __buffer,
 625		      double *__restrict __result) __THROW __nonnull ((1, 2));
 626
 627/* Return non-negative, long integer in [0,2^31).  */
 628extern int lrand48_r (struct drand48_data *__restrict __buffer,
 629		      long int *__restrict __result)
 630     __THROW __nonnull ((1, 2));
 631extern int nrand48_r (unsigned short int __xsubi[3],
 632		      struct drand48_data *__restrict __buffer,
 633		      long int *__restrict __result)
 634     __THROW __nonnull ((1, 2));
 635
 636/* Return signed, long integers in [-2^31,2^31).  */
 637extern int mrand48_r (struct drand48_data *__restrict __buffer,
 638		      long int *__restrict __result)
 639     __THROW __nonnull ((1, 2));
 640extern int jrand48_r (unsigned short int __xsubi[3],
 641		      struct drand48_data *__restrict __buffer,
 642		      long int *__restrict __result)
 643     __THROW __nonnull ((1, 2));
 644
 645/* Seed random number generator.  */
 646extern int srand48_r (long int __seedval, struct drand48_data *__buffer)
 647     __THROW __nonnull ((2));
 648
 649extern int seed48_r (unsigned short int __seed16v[3],
 650		     struct drand48_data *__buffer) __THROW __nonnull ((1, 2));
 651
 652extern int lcong48_r (unsigned short int __param[7],
 653		      struct drand48_data *__buffer)
 654     __THROW __nonnull ((1, 2));
 655
 656/* Return a random integer between zero and 2**32-1 (inclusive).  */
 657extern __uint32_t arc4random (void)
 658     __THROW __wur;
 659
 660/* Fill the buffer with random data.  */
 661extern void arc4random_buf (void *__buf, size_t __size)
 662     __THROW __nonnull ((1));
 663
 664/* Return a random number between zero (inclusive) and the specified
 665   limit (exclusive).  */
 666extern __uint32_t arc4random_uniform (__uint32_t __upper_bound)
 667     __THROW __wur;
 668# endif	/* Use misc.  */
 669#endif	/* Use misc or X/Open.  */
 670
 671/* Allocate SIZE bytes of memory.  */
 672extern void *malloc (size_t __size) __THROW __attribute_malloc__
 673     __attribute_alloc_size__ ((1)) __wur;
 674/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0.  */
 675extern void *calloc (size_t __nmemb, size_t __size)
 676     __THROW __attribute_malloc__ __attribute_alloc_size__ ((1, 2)) __wur;
 677
 678/* Re-allocate the previously allocated block
 679   in PTR, making the new block SIZE bytes long.  */
 680/* __attribute_malloc__ is not used, because if realloc returns
 681   the same pointer that was passed to it, aliasing needs to be allowed
 682   between objects pointed by the old and new pointers.  */
 683extern void *realloc (void *__ptr, size_t __size)
 684     __THROW __attribute_warn_unused_result__ __attribute_alloc_size__ ((2));
 685
 686/* Free a block allocated by `malloc', `realloc' or `calloc'.  */
 687extern void free (void *__ptr) __THROW;
 688
 689#ifdef __USE_MISC
 690/* Re-allocate the previously allocated block in PTR, making the new
 691   block large enough for NMEMB elements of SIZE bytes each.  */
 692/* __attribute_malloc__ is not used, because if reallocarray returns
 693   the same pointer that was passed to it, aliasing needs to be allowed
 694   between objects pointed by the old and new pointers.  */
 695extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
 696     __THROW __attribute_warn_unused_result__
 697     __attribute_alloc_size__ ((2, 3))
 698    __attr_dealloc_free;
 699
 700/* Add reallocarray as its own deallocator.  */
 701extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
 702     __THROW __attr_dealloc (reallocarray, 1);
 703#endif
 704
 705#ifdef __USE_MISC
 706# include <alloca.h>
 707#endif /* Use misc.  */
 708
 709#if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K) \
 710    || defined __USE_MISC
 711/* Allocate SIZE bytes on a page boundary.  The storage cannot be freed.  */
 712extern void *valloc (size_t __size) __THROW __attribute_malloc__
 713     __attribute_alloc_size__ ((1)) __wur;
 714#endif
 715
 716#ifdef __USE_XOPEN2K
 717/* Allocate memory of SIZE bytes with an alignment of ALIGNMENT.  */
 718extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
 719     __THROW __nonnull ((1)) __wur;
 720#endif
 721
 722#ifdef __USE_ISOC11
 723/* ISO C variant of aligned allocation.  */
 724extern void *aligned_alloc (size_t __alignment, size_t __size)
 725     __THROW __attribute_malloc__ __attribute_alloc_align__ ((1))
 726     __attribute_alloc_size__ ((2)) __wur;
 727#endif
 728
 729/* Abort execution and generate a core-dump.  */
 730extern void abort (void) __THROW __attribute__ ((__noreturn__)) __COLD;
 731
 732
 733/* Register a function to be called when `exit' is called.  */
 734extern int atexit (void (*__func) (void)) __THROW __nonnull ((1));
 735
 736#if defined __USE_ISOC11 || defined __USE_ISOCXX11
 737/* Register a function to be called when `quick_exit' is called.  */
 738# ifdef __cplusplus
 739extern "C++" int at_quick_exit (void (*__func) (void))
 740     __THROW __asm ("at_quick_exit") __nonnull ((1));
 741# else
 742extern int at_quick_exit (void (*__func) (void)) __THROW __nonnull ((1));
 743# endif
 744#endif
 745
 746#ifdef	__USE_MISC
 747/* Register a function to be called with the status
 748   given to `exit' and the given argument.  */
 749extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
 750     __THROW __nonnull ((1));
 751#endif
 752
 753/* Call all functions registered with `atexit' and `on_exit',
 754   in the reverse of the order in which they were registered,
 755   perform stdio cleanup, and terminate program execution with STATUS.  */
 756extern void exit (int __status) __THROW __attribute__ ((__noreturn__));
 757
 758#if defined __USE_ISOC11 || defined __USE_ISOCXX11
 759/* Call all functions registered with `at_quick_exit' in the reverse
 760   of the order in which they were registered and terminate program
 761   execution with STATUS.  */
 762extern void quick_exit (int __status) __THROW __attribute__ ((__noreturn__));
 763#endif
 764
 765#ifdef __USE_ISOC99
 766/* Terminate the program with STATUS without calling any of the
 767   functions registered with `atexit' or `on_exit'.  */
 768extern void _Exit (int __status) __THROW __attribute__ ((__noreturn__));
 769#endif
 770
 771
 772/* Return the value of envariable NAME, or NULL if it doesn't exist.  */
 773extern char *getenv (const char *__name) __THROW __nonnull ((1)) __wur;
 774
 775#ifdef __USE_GNU
 776/* This function is similar to the above but returns NULL if the
 777   programs is running with SUID or SGID enabled.  */
 778extern char *secure_getenv (const char *__name)
 779     __THROW __nonnull ((1)) __wur;
 780#endif
 781
 782#if defined __USE_MISC || defined __USE_XOPEN
 783/* The SVID says this is in <stdio.h>, but this seems a better place.	*/
 784/* Put STRING, which is of the form "NAME=VALUE", in the environment.
 785   If there is no `=', remove NAME from the environment.  */
 786extern int putenv (char *__string) __THROW __nonnull ((1));
 787#endif
 788
 789#ifdef __USE_XOPEN2K
 790/* Set NAME to VALUE in the environment.
 791   If REPLACE is nonzero, overwrite an existing value.  */
 792extern int setenv (const char *__name, const char *__value, int __replace)
 793     __THROW __nonnull ((2));
 794
 795/* Remove the variable NAME from the environment.  */
 796extern int unsetenv (const char *__name) __THROW __nonnull ((1));
 797#endif
 798
 799#ifdef	__USE_MISC
 800/* The `clearenv' was planned to be added to POSIX.1 but probably
 801   never made it.  Nevertheless the POSIX.9 standard (POSIX bindings
 802   for Fortran 77) requires this function.  */
 803extern int clearenv (void) __THROW;
 804#endif
 805
 806
 807#if defined __USE_MISC \
 808    || (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8)
 809/* Generate a unique temporary file name from TEMPLATE.
 810   The last six characters of TEMPLATE must be "XXXXXX";
 811   they are replaced with a string that makes the file name unique.
 812   Always returns TEMPLATE, it's either a temporary file name or a null
 813   string if it cannot get a unique file name.  */
 814extern char *mktemp (char *__template) __THROW __nonnull ((1));
 815#endif
 816
 817#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
 818/* Generate a unique temporary file name from TEMPLATE.
 819   The last six characters of TEMPLATE must be "XXXXXX";
 820   they are replaced with a string that makes the filename unique.
 821   Returns a file descriptor open on the file for reading and writing,
 822   or -1 if it cannot create a uniquely-named file.
 823
 824   This function is a possible cancellation point and therefore not
 825   marked with __THROW.  */
 826# ifndef __USE_FILE_OFFSET64
 827extern int mkstemp (char *__template) __nonnull ((1)) __wur;
 828# else
 829#  ifdef __REDIRECT
 830extern int __REDIRECT (mkstemp, (char *__template), mkstemp64)
 831     __nonnull ((1)) __wur;
 832#  else
 833#   define mkstemp mkstemp64
 834#  endif
 835# endif
 836# ifdef __USE_LARGEFILE64
 837extern int mkstemp64 (char *__template) __nonnull ((1)) __wur;
 838# endif
 839#endif
 840
 841#ifdef __USE_MISC
 842/* Similar to mkstemp, but the template can have a suffix after the
 843   XXXXXX.  The length of the suffix is specified in the second
 844   parameter.
 845
 846   This function is a possible cancellation point and therefore not
 847   marked with __THROW.  */
 848# ifndef __USE_FILE_OFFSET64
 849extern int mkstemps (char *__template, int __suffixlen) __nonnull ((1)) __wur;
 850# else
 851#  ifdef __REDIRECT
 852extern int __REDIRECT (mkstemps, (char *__template, int __suffixlen),
 853		       mkstemps64) __nonnull ((1)) __wur;
 854#  else
 855#   define mkstemps mkstemps64
 856#  endif
 857# endif
 858# ifdef __USE_LARGEFILE64
 859extern int mkstemps64 (char *__template, int __suffixlen)
 860     __nonnull ((1)) __wur;
 861# endif
 862#endif
 863
 864#ifdef __USE_XOPEN2K8
 865/* Create a unique temporary directory from TEMPLATE.
 866   The last six characters of TEMPLATE must be "XXXXXX";
 867   they are replaced with a string that makes the directory name unique.
 868   Returns TEMPLATE, or a null pointer if it cannot get a unique name.
 869   The directory is created mode 700.  */
 870extern char *mkdtemp (char *__template) __THROW __nonnull ((1)) __wur;
 871#endif
 872
 873#ifdef __USE_GNU
 874/* Generate a unique temporary file name from TEMPLATE similar to
 875   mkstemp.  But allow the caller to pass additional flags which are
 876   used in the open call to create the file..
 877
 878   This function is a possible cancellation point and therefore not
 879   marked with __THROW.  */
 880# ifndef __USE_FILE_OFFSET64
 881extern int mkostemp (char *__template, int __flags) __nonnull ((1)) __wur;
 882# else
 883#  ifdef __REDIRECT
 884extern int __REDIRECT (mkostemp, (char *__template, int __flags), mkostemp64)
 885     __nonnull ((1)) __wur;
 886#  else
 887#   define mkostemp mkostemp64
 888#  endif
 889# endif
 890# ifdef __USE_LARGEFILE64
 891extern int mkostemp64 (char *__template, int __flags) __nonnull ((1)) __wur;
 892# endif
 893
 894/* Similar to mkostemp, but the template can have a suffix after the
 895   XXXXXX.  The length of the suffix is specified in the second
 896   parameter.
 897
 898   This function is a possible cancellation point and therefore not
 899   marked with __THROW.  */
 900# ifndef __USE_FILE_OFFSET64
 901extern int mkostemps (char *__template, int __suffixlen, int __flags)
 902     __nonnull ((1)) __wur;
 903# else
 904#  ifdef __REDIRECT
 905extern int __REDIRECT (mkostemps, (char *__template, int __suffixlen,
 906				   int __flags), mkostemps64)
 907     __nonnull ((1)) __wur;
 908#  else
 909#   define mkostemps mkostemps64
 910#  endif
 911# endif
 912# ifdef __USE_LARGEFILE64
 913extern int mkostemps64 (char *__template, int __suffixlen, int __flags)
 914     __nonnull ((1)) __wur;
 915# endif
 916#endif
 917
 918
 919/* Execute the given line as a shell command.
 920
 921   This function is a cancellation point and therefore not marked with
 922   __THROW.  */
 923extern int system (const char *__command) __wur;
 924
 925
 926#ifdef	__USE_GNU
 927/* Return a malloc'd string containing the canonical absolute name of the
 928   existing named file.  */
 929extern char *canonicalize_file_name (const char *__name)
 930     __THROW __nonnull ((1)) __attribute_malloc__
 931     __attr_dealloc_free __wur;
 932#endif
 933
 934#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
 935/* Return the canonical absolute name of file NAME.  If RESOLVED is
 936   null, the result is malloc'd; otherwise, if the canonical name is
 937   PATH_MAX chars or more, returns null with `errno' set to
 938   ENAMETOOLONG; if the name fits in fewer than PATH_MAX chars,
 939   returns the name in RESOLVED.  */
 940extern char *realpath (const char *__restrict __name,
 941		       char *__restrict __resolved) __THROW __wur;
 942#endif
 943
 944
 945/* Shorthand for type of comparison functions.  */
 946#ifndef __COMPAR_FN_T
 947# define __COMPAR_FN_T
 948typedef int (*__compar_fn_t) (const void *, const void *);
 949
 950# ifdef	__USE_GNU
 951typedef __compar_fn_t comparison_fn_t;
 952# endif
 953#endif
 954#ifdef __USE_GNU
 955typedef int (*__compar_d_fn_t) (const void *, const void *, void *);
 956#endif
 957
 958/* Do a binary search for KEY in BASE, which consists of NMEMB elements
 959   of SIZE bytes each, using COMPAR to perform the comparisons.  */
 960extern void *bsearch (const void *__key, const void *__base,
 961		      size_t __nmemb, size_t __size, __compar_fn_t __compar)
 962     __nonnull ((1, 2, 5)) __wur;
 963
 964#ifdef __USE_EXTERN_INLINES
 965# include <bits/stdlib-bsearch.h>
 966#endif
 967
 968/* Sort NMEMB elements of BASE, of SIZE bytes each,
 969   using COMPAR to perform the comparisons.  */
 970extern void qsort (void *__base, size_t __nmemb, size_t __size,
 971		   __compar_fn_t __compar) __nonnull ((1, 4));
 972#ifdef __USE_GNU
 973extern void qsort_r (void *__base, size_t __nmemb, size_t __size,
 974		     __compar_d_fn_t __compar, void *__arg)
 975  __nonnull ((1, 4));
 976#endif
 977
 978
 979/* Return the absolute value of X.  */
 980extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
 981extern long int labs (long int __x) __THROW __attribute__ ((__const__)) __wur;
 982
 983#ifdef __USE_ISOC99
 984__extension__ extern long long int llabs (long long int __x)
 985     __THROW __attribute__ ((__const__)) __wur;
 986#endif
 987
 988#if __GLIBC_USE (ISOC2Y)
 989extern unsigned int uabs (int __x) __THROW __attribute__ ((__const__)) __wur;
 990extern unsigned long int ulabs (long int __x) __THROW __attribute__ ((__const__)) __wur;
 991__extension__ extern unsigned long long int ullabs (long long int __x)
 992     __THROW __attribute__ ((__const__)) __wur;
 993#endif
 994
 995/* Return the `div_t', `ldiv_t' or `lldiv_t' representation
 996   of the value of NUMER over DENOM. */
 997/* GCC may have built-ins for these someday.  */
 998extern div_t div (int __numer, int __denom)
 999     __THROW __attribute__ ((__const__)) __wur;
1000extern ldiv_t ldiv (long int __numer, long int __denom)
1001     __THROW __attribute__ ((__const__)) __wur;
1002
1003#ifdef __USE_ISOC99
1004__extension__ extern lldiv_t lldiv (long long int __numer,
1005				    long long int __denom)
1006     __THROW __attribute__ ((__const__)) __wur;
1007#endif
1008
1009
1010#if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) \
1011    || defined __USE_MISC
1012/* Convert floating point numbers to strings.  The returned values are
1013   valid only until another call to the same function.  */
1014
1015/* Convert VALUE to a string with NDIGIT digits and return a pointer to
1016   this.  Set *DECPT with the position of the decimal character and *SIGN
1017   with the sign of the number.  */
1018extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt,
1019		   int *__restrict __sign) __THROW __nonnull ((3, 4)) __wur;
1020
1021/* Convert VALUE to a string rounded to NDIGIT decimal digits.  Set *DECPT
1022   with the position of the decimal character and *SIGN with the sign of
1023   the number.  */
1024extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt,
1025		   int *__restrict __sign) __THROW __nonnull ((3, 4)) __wur;
1026
1027/* If possible convert VALUE to a string with NDIGIT significant digits.
1028   Otherwise use exponential representation.  The resulting string will
1029   be written to BUF.  */
1030extern char *gcvt (double __value, int __ndigit, char *__buf)
1031     __THROW __nonnull ((3)) __wur;
1032#endif
1033
1034#ifdef __USE_MISC
1035/* Long double versions of above functions.  */
1036extern char *qecvt (long double __value, int __ndigit,
1037		    int *__restrict __decpt, int *__restrict __sign)
1038     __THROW __nonnull ((3, 4)) __wur;
1039extern char *qfcvt (long double __value, int __ndigit,
1040		    int *__restrict __decpt, int *__restrict __sign)
1041     __THROW __nonnull ((3, 4)) __wur;
1042extern char *qgcvt (long double __value, int __ndigit, char *__buf)
1043     __THROW __nonnull ((3)) __wur;
1044
1045
1046/* Reentrant version of the functions above which provide their own
1047   buffers.  */
1048extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
1049		   int *__restrict __sign, char *__restrict __buf,
1050		   size_t __len) __THROW __nonnull ((3, 4, 5));
1051extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
1052		   int *__restrict __sign, char *__restrict __buf,
1053		   size_t __len) __THROW __nonnull ((3, 4, 5));
1054
1055extern int qecvt_r (long double __value, int __ndigit,
1056		    int *__restrict __decpt, int *__restrict __sign,
1057		    char *__restrict __buf, size_t __len)
1058     __THROW __nonnull ((3, 4, 5));
1059extern int qfcvt_r (long double __value, int __ndigit,
1060		    int *__restrict __decpt, int *__restrict __sign,
1061		    char *__restrict __buf, size_t __len)
1062     __THROW __nonnull ((3, 4, 5));
1063#endif	/* misc */
1064
1065
1066/* Return the length of the multibyte character
1067   in S, which is no longer than N.  */
1068extern int mblen (const char *__s, size_t __n) __THROW;
1069/* Return the length of the given multibyte character,
1070   putting its `wchar_t' representation in *PWC.  */
1071extern int mbtowc (wchar_t *__restrict __pwc,
1072		   const char *__restrict __s, size_t __n) __THROW;
1073/* Put the multibyte character represented
1074   by WCHAR in S, returning its length.  */
1075extern int wctomb (char *__s, wchar_t __wchar) __THROW;
1076
1077
1078/* Convert a multibyte string to a wide char string.  */
1079extern size_t mbstowcs (wchar_t *__restrict  __pwcs,
1080			const char *__restrict __s, size_t __n) __THROW
1081    __attr_access ((__read_only__, 2));
1082/* Convert a wide char string to multibyte string.  */
1083extern size_t wcstombs (char *__restrict __s,
1084			const wchar_t *__restrict __pwcs, size_t __n)
1085     __THROW
1086  __fortified_attr_access (__write_only__, 1, 3)
1087  __attr_access ((__read_only__, 2));
1088
1089#ifdef __USE_MISC
1090/* Determine whether the string value of RESPONSE matches the affirmation
1091   or negative response expression as specified by the LC_MESSAGES category
1092   in the program's current locale.  Returns 1 if affirmative, 0 if
1093   negative, and -1 if not matching.  */
1094extern int rpmatch (const char *__response) __THROW __nonnull ((1)) __wur;
1095#endif
1096
1097
1098#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
1099/* Parse comma separated suboption from *OPTIONP and match against
1100   strings in TOKENS.  If found return index and set *VALUEP to
1101   optional value introduced by an equal sign.  If the suboption is
1102   not part of TOKENS return in *VALUEP beginning of unknown
1103   suboption.  On exit *OPTIONP is set to the beginning of the next
1104   token or at the terminating NUL character.  */
1105extern int getsubopt (char **__restrict __optionp,
1106		      char *const *__restrict __tokens,
1107		      char **__restrict __valuep)
1108     __THROW __nonnull ((1, 2, 3)) __wur;
1109#endif
1110
1111
1112/* X/Open pseudo terminal handling.  */
1113
1114#ifdef __USE_XOPEN2KXSI
1115/* Return a master pseudo-terminal handle.  */
1116extern int posix_openpt (int __oflag) __wur;
1117#endif
1118
1119#ifdef __USE_XOPEN_EXTENDED
1120/* The next four functions all take a master pseudo-tty fd and
1121   perform an operation on the associated slave:  */
1122
1123/* Chown the slave to the calling user.  */
1124extern int grantpt (int __fd) __THROW;
1125
1126/* Release an internal lock so the slave can be opened.
1127   Call after grantpt().  */
1128extern int unlockpt (int __fd) __THROW;
1129
1130/* Return the pathname of the pseudo terminal slave associated with
1131   the master FD is open on, or NULL on errors.
1132   The returned storage is good until the next call to this function.  */
1133extern char *ptsname (int __fd) __THROW __wur;
1134#endif
1135
1136#ifdef __USE_GNU
1137/* Store at most BUFLEN characters of the pathname of the slave pseudo
1138   terminal associated with the master FD is open on in BUF.
1139   Return 0 on success, otherwise an error number.  */
1140extern int ptsname_r (int __fd, char *__buf, size_t __buflen)
1141     __THROW __nonnull ((2)) __fortified_attr_access (__write_only__, 2, 3);
1142
1143/* Open a master pseudo terminal and return its file descriptor.  */
1144extern int getpt (void);
1145#endif
1146
1147#ifdef __USE_MISC
1148/* Put the 1 minute, 5 minute and 15 minute load averages into the first
1149   NELEM elements of LOADAVG.  Return the number written (never more than
1150   three, but may be less than NELEM), or -1 if an error occurred.  */
1151extern int getloadavg (double __loadavg[], int __nelem)
1152     __THROW __nonnull ((1));
1153#endif
1154
1155#if defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K
1156/* Return the index into the active-logins file (utmp) for
1157   the controlling terminal.  */
1158extern int ttyslot (void) __THROW;
1159#endif
1160
1161#include <bits/stdlib-float.h>
1162
1163/* Define some macros helping to catch buffer overflows.  */
1164#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
1165# include <bits/stdlib.h>
1166#endif
1167
1168#include <bits/floatn.h>
1169#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
1170# include <bits/stdlib-ldbl.h>
1171#endif
1172
1173__END_DECLS
1174
1175#endif /* stdlib.h  */