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