source: CIVL/mods/dev.civl.com/examples/pthread/svcomp/safestack_relacy_false-unreach-call.i@ cb4d4f4

1.23 2.0 main test-branch
Last change on this file since cb4d4f4 was aad342c, checked in by Stephen Siegel <siegel@…>, 3 years ago

Performing huge refactor to incorporate ABC, GMC, and SARL into CIVL repo and use Java modules.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5664 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 76.6 KB
Line 
1extern void __VERIFIER_error() __attribute__ ((__noreturn__));
2extern void __VERIFIER_atomic_begin(void);
3extern void __VERIFIER_atomic_end(void);
4
5typedef unsigned int size_t;
6typedef unsigned char __u_char;
7typedef unsigned short int __u_short;
8typedef unsigned int __u_int;
9typedef unsigned long int __u_long;
10typedef signed char __int8_t;
11typedef unsigned char __uint8_t;
12typedef signed short int __int16_t;
13typedef unsigned short int __uint16_t;
14typedef signed int __int32_t;
15typedef unsigned int __uint32_t;
16__extension__ typedef signed long long int __int64_t;
17__extension__ typedef unsigned long long int __uint64_t;
18__extension__ typedef long long int __quad_t;
19__extension__ typedef unsigned long long int __u_quad_t;
20__extension__ typedef __u_quad_t __dev_t;
21__extension__ typedef unsigned int __uid_t;
22__extension__ typedef unsigned int __gid_t;
23__extension__ typedef unsigned long int __ino_t;
24__extension__ typedef __u_quad_t __ino64_t;
25__extension__ typedef unsigned int __mode_t;
26__extension__ typedef unsigned int __nlink_t;
27__extension__ typedef long int __off_t;
28__extension__ typedef __quad_t __off64_t;
29__extension__ typedef int __pid_t;
30__extension__ typedef struct { int __val[2]; } __fsid_t;
31__extension__ typedef long int __clock_t;
32__extension__ typedef unsigned long int __rlim_t;
33__extension__ typedef __u_quad_t __rlim64_t;
34__extension__ typedef unsigned int __id_t;
35__extension__ typedef long int __time_t;
36__extension__ typedef unsigned int __useconds_t;
37__extension__ typedef long int __suseconds_t;
38__extension__ typedef int __daddr_t;
39__extension__ typedef int __key_t;
40__extension__ typedef int __clockid_t;
41__extension__ typedef void * __timer_t;
42__extension__ typedef long int __blksize_t;
43__extension__ typedef long int __blkcnt_t;
44__extension__ typedef __quad_t __blkcnt64_t;
45__extension__ typedef unsigned long int __fsblkcnt_t;
46__extension__ typedef __u_quad_t __fsblkcnt64_t;
47__extension__ typedef unsigned long int __fsfilcnt_t;
48__extension__ typedef __u_quad_t __fsfilcnt64_t;
49__extension__ typedef int __fsword_t;
50__extension__ typedef int __ssize_t;
51__extension__ typedef long int __syscall_slong_t;
52__extension__ typedef unsigned long int __syscall_ulong_t;
53typedef __off64_t __loff_t;
54typedef __quad_t *__qaddr_t;
55typedef char *__caddr_t;
56__extension__ typedef int __intptr_t;
57__extension__ typedef unsigned int __socklen_t;
58struct _IO_FILE;
59
60typedef struct _IO_FILE FILE;
61
62
63typedef struct _IO_FILE __FILE;
64typedef struct
65{
66 int __count;
67 union
68 {
69 unsigned int __wch;
70 char __wchb[4];
71 } __value;
72} __mbstate_t;
73typedef struct
74{
75 __off_t __pos;
76 __mbstate_t __state;
77} _G_fpos_t;
78typedef struct
79{
80 __off64_t __pos;
81 __mbstate_t __state;
82} _G_fpos64_t;
83typedef __builtin_va_list __gnuc_va_list;
84struct _IO_jump_t; struct _IO_FILE;
85typedef void _IO_lock_t;
86struct _IO_marker {
87 struct _IO_marker *_next;
88 struct _IO_FILE *_sbuf;
89 int _pos;
90};
91enum __codecvt_result
92{
93 __codecvt_ok,
94 __codecvt_partial,
95 __codecvt_error,
96 __codecvt_noconv
97};
98struct _IO_FILE {
99 int _flags;
100 char* _IO_read_ptr;
101 char* _IO_read_end;
102 char* _IO_read_base;
103 char* _IO_write_base;
104 char* _IO_write_ptr;
105 char* _IO_write_end;
106 char* _IO_buf_base;
107 char* _IO_buf_end;
108 char *_IO_save_base;
109 char *_IO_backup_base;
110 char *_IO_save_end;
111 struct _IO_marker *_markers;
112 struct _IO_FILE *_chain;
113 int _fileno;
114 int _flags2;
115 __off_t _old_offset;
116 unsigned short _cur_column;
117 signed char _vtable_offset;
118 char _shortbuf[1];
119 _IO_lock_t *_lock;
120 __off64_t _offset;
121 void *__pad1;
122 void *__pad2;
123 void *__pad3;
124 void *__pad4;
125 size_t __pad5;
126 int _mode;
127 char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)];
128};
129typedef struct _IO_FILE _IO_FILE;
130struct _IO_FILE_plus;
131extern struct _IO_FILE_plus _IO_2_1_stdin_;
132extern struct _IO_FILE_plus _IO_2_1_stdout_;
133extern struct _IO_FILE_plus _IO_2_1_stderr_;
134typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);
135typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf,
136 size_t __n);
137typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w);
138typedef int __io_close_fn (void *__cookie);
139extern int __underflow (_IO_FILE *);
140extern int __uflow (_IO_FILE *);
141extern int __overflow (_IO_FILE *, int);
142extern int _IO_getc (_IO_FILE *__fp);
143extern int _IO_putc (int __c, _IO_FILE *__fp);
144extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__));
145extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__));
146extern int _IO_peekc_locked (_IO_FILE *__fp);
147extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
148extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
149extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
150extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
151 __gnuc_va_list, int *__restrict);
152extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
153 __gnuc_va_list);
154extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t);
155extern size_t _IO_sgetn (_IO_FILE *, void *, size_t);
156extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int);
157extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int);
158extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
159typedef __gnuc_va_list va_list;
160typedef __off_t off_t;
161typedef __ssize_t ssize_t;
162
163typedef _G_fpos_t fpos_t;
164
165extern struct _IO_FILE *stdin;
166extern struct _IO_FILE *stdout;
167extern struct _IO_FILE *stderr;
168
169extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__));
170extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__));
171
172extern int renameat (int __oldfd, const char *__old, int __newfd,
173 const char *__new) __attribute__ ((__nothrow__ , __leaf__));
174
175extern FILE *tmpfile (void) ;
176extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ;
177
178extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ;
179extern char *tempnam (const char *__dir, const char *__pfx)
180 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ;
181
182extern int fclose (FILE *__stream);
183extern int fflush (FILE *__stream);
184
185extern int fflush_unlocked (FILE *__stream);
186
187extern FILE *fopen (const char *__restrict __filename,
188 const char *__restrict __modes) ;
189extern FILE *freopen (const char *__restrict __filename,
190 const char *__restrict __modes,
191 FILE *__restrict __stream) ;
192
193extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ;
194extern FILE *fmemopen (void *__s, size_t __len, const char *__modes)
195 __attribute__ ((__nothrow__ , __leaf__)) ;
196extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ;
197
198extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__));
199extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
200 int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__));
201
202extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
203 size_t __size) __attribute__ ((__nothrow__ , __leaf__));
204extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
205
206extern int fprintf (FILE *__restrict __stream,
207 const char *__restrict __format, ...);
208extern int printf (const char *__restrict __format, ...);
209extern int sprintf (char *__restrict __s,
210 const char *__restrict __format, ...) __attribute__ ((__nothrow__));
211extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
212 __gnuc_va_list __arg);
213extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
214extern int vsprintf (char *__restrict __s, const char *__restrict __format,
215 __gnuc_va_list __arg) __attribute__ ((__nothrow__));
216
217
218extern int snprintf (char *__restrict __s, size_t __maxlen,
219 const char *__restrict __format, ...)
220 __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4)));
221extern int vsnprintf (char *__restrict __s, size_t __maxlen,
222 const char *__restrict __format, __gnuc_va_list __arg)
223 __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0)));
224
225extern int vdprintf (int __fd, const char *__restrict __fmt,
226 __gnuc_va_list __arg)
227 __attribute__ ((__format__ (__printf__, 2, 0)));
228extern int dprintf (int __fd, const char *__restrict __fmt, ...)
229 __attribute__ ((__format__ (__printf__, 2, 3)));
230
231extern int fscanf (FILE *__restrict __stream,
232 const char *__restrict __format, ...) ;
233extern int scanf (const char *__restrict __format, ...) ;
234extern int sscanf (const char *__restrict __s,
235 const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__));
236extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") ;
237extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") ;
238extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__));
239
240
241extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
242 __gnuc_va_list __arg)
243 __attribute__ ((__format__ (__scanf__, 2, 0))) ;
244extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)
245 __attribute__ ((__format__ (__scanf__, 1, 0))) ;
246extern int vsscanf (const char *__restrict __s,
247 const char *__restrict __format, __gnuc_va_list __arg)
248 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0)));
249extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf")
250 __attribute__ ((__format__ (__scanf__, 2, 0))) ;
251extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf")
252 __attribute__ ((__format__ (__scanf__, 1, 0))) ;
253extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__))
254 __attribute__ ((__format__ (__scanf__, 2, 0)));
255
256
257extern int fgetc (FILE *__stream);
258extern int getc (FILE *__stream);
259extern int getchar (void);
260
261extern int getc_unlocked (FILE *__stream);
262extern int getchar_unlocked (void);
263extern int fgetc_unlocked (FILE *__stream);
264
265extern int fputc (int __c, FILE *__stream);
266extern int putc (int __c, FILE *__stream);
267extern int putchar (int __c);
268
269extern int fputc_unlocked (int __c, FILE *__stream);
270extern int putc_unlocked (int __c, FILE *__stream);
271extern int putchar_unlocked (int __c);
272extern int getw (FILE *__stream);
273extern int putw (int __w, FILE *__stream);
274
275extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
276 ;
277
278extern __ssize_t __getdelim (char **__restrict __lineptr,
279 size_t *__restrict __n, int __delimiter,
280 FILE *__restrict __stream) ;
281extern __ssize_t getdelim (char **__restrict __lineptr,
282 size_t *__restrict __n, int __delimiter,
283 FILE *__restrict __stream) ;
284extern __ssize_t getline (char **__restrict __lineptr,
285 size_t *__restrict __n,
286 FILE *__restrict __stream) ;
287
288extern int fputs (const char *__restrict __s, FILE *__restrict __stream);
289extern int puts (const char *__s);
290extern int ungetc (int __c, FILE *__stream);
291extern size_t fread (void *__restrict __ptr, size_t __size,
292 size_t __n, FILE *__restrict __stream) ;
293extern size_t fwrite (const void *__restrict __ptr, size_t __size,
294 size_t __n, FILE *__restrict __s);
295
296extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
297 size_t __n, FILE *__restrict __stream) ;
298extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size,
299 size_t __n, FILE *__restrict __stream);
300
301extern int fseek (FILE *__stream, long int __off, int __whence);
302extern long int ftell (FILE *__stream) ;
303extern void rewind (FILE *__stream);
304
305extern int fseeko (FILE *__stream, __off_t __off, int __whence);
306extern __off_t ftello (FILE *__stream) ;
307
308extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);
309extern int fsetpos (FILE *__stream, const fpos_t *__pos);
310
311
312extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
313extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
314extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
315
316extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
317extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
318extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
319
320extern void perror (const char *__s);
321
322extern int sys_nerr;
323extern const char *const sys_errlist[];
324extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
325extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
326extern FILE *popen (const char *__command, const char *__modes) ;
327extern int pclose (FILE *__stream);
328extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__));
329extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
330extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
331extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
332
333typedef long int wchar_t;
334
335typedef enum
336{
337 P_ALL,
338 P_PID,
339 P_PGID
340} idtype_t;
341static __inline unsigned int
342__bswap_32 (unsigned int __bsx)
343{
344 return __builtin_bswap32 (__bsx);
345}
346static __inline __uint64_t
347__bswap_64 (__uint64_t __bsx)
348{
349 return __builtin_bswap64 (__bsx);
350}
351union wait
352 {
353 int w_status;
354 struct
355 {
356 unsigned int __w_termsig:7;
357 unsigned int __w_coredump:1;
358 unsigned int __w_retcode:8;
359 unsigned int:16;
360 } __wait_terminated;
361 struct
362 {
363 unsigned int __w_stopval:8;
364 unsigned int __w_stopsig:8;
365 unsigned int:16;
366 } __wait_stopped;
367 };
368typedef union
369 {
370 union wait *__uptr;
371 int *__iptr;
372 } __WAIT_STATUS __attribute__ ((__transparent_union__));
373
374typedef struct
375 {
376 int quot;
377 int rem;
378 } div_t;
379typedef struct
380 {
381 long int quot;
382 long int rem;
383 } ldiv_t;
384
385
386__extension__ typedef struct
387 {
388 long long int quot;
389 long long int rem;
390 } lldiv_t;
391
392extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ;
393
394extern double atof (const char *__nptr)
395 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
396extern int atoi (const char *__nptr)
397 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
398extern long int atol (const char *__nptr)
399 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
400
401
402__extension__ extern long long int atoll (const char *__nptr)
403 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
404
405
406extern double strtod (const char *__restrict __nptr,
407 char **__restrict __endptr)
408 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
409
410
411extern float strtof (const char *__restrict __nptr,
412 char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
413extern long double strtold (const char *__restrict __nptr,
414 char **__restrict __endptr)
415 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
416
417
418extern long int strtol (const char *__restrict __nptr,
419 char **__restrict __endptr, int __base)
420 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
421extern unsigned long int strtoul (const char *__restrict __nptr,
422 char **__restrict __endptr, int __base)
423 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
424
425__extension__
426extern long long int strtoq (const char *__restrict __nptr,
427 char **__restrict __endptr, int __base)
428 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
429__extension__
430extern unsigned long long int strtouq (const char *__restrict __nptr,
431 char **__restrict __endptr, int __base)
432 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
433
434__extension__
435extern long long int strtoll (const char *__restrict __nptr,
436 char **__restrict __endptr, int __base)
437 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
438__extension__
439extern unsigned long long int strtoull (const char *__restrict __nptr,
440 char **__restrict __endptr, int __base)
441 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
442
443extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ;
444extern long int a64l (const char *__s)
445 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
446
447typedef __u_char u_char;
448typedef __u_short u_short;
449typedef __u_int u_int;
450typedef __u_long u_long;
451typedef __quad_t quad_t;
452typedef __u_quad_t u_quad_t;
453typedef __fsid_t fsid_t;
454typedef __loff_t loff_t;
455typedef __ino_t ino_t;
456typedef __dev_t dev_t;
457typedef __gid_t gid_t;
458typedef __mode_t mode_t;
459typedef __nlink_t nlink_t;
460typedef __uid_t uid_t;
461typedef __pid_t pid_t;
462typedef __id_t id_t;
463typedef __daddr_t daddr_t;
464typedef __caddr_t caddr_t;
465typedef __key_t key_t;
466
467typedef __clock_t clock_t;
468
469
470
471typedef __time_t time_t;
472
473
474typedef __clockid_t clockid_t;
475typedef __timer_t timer_t;
476typedef unsigned long int ulong;
477typedef unsigned short int ushort;
478typedef unsigned int uint;
479typedef int int8_t __attribute__ ((__mode__ (__QI__)));
480typedef int int16_t __attribute__ ((__mode__ (__HI__)));
481typedef int int32_t __attribute__ ((__mode__ (__SI__)));
482typedef int int64_t __attribute__ ((__mode__ (__DI__)));
483typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__)));
484typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__)));
485typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__)));
486typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__)));
487typedef int register_t __attribute__ ((__mode__ (__word__)));
488typedef int __sig_atomic_t;
489typedef struct
490 {
491 unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))];
492 } __sigset_t;
493typedef __sigset_t sigset_t;
494struct timespec
495 {
496 __time_t tv_sec;
497 __syscall_slong_t tv_nsec;
498 };
499struct timeval
500 {
501 __time_t tv_sec;
502 __suseconds_t tv_usec;
503 };
504typedef __suseconds_t suseconds_t;
505typedef long int __fd_mask;
506typedef struct
507 {
508 __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))];
509 } fd_set;
510typedef __fd_mask fd_mask;
511
512extern int select (int __nfds, fd_set *__restrict __readfds,
513 fd_set *__restrict __writefds,
514 fd_set *__restrict __exceptfds,
515 struct timeval *__restrict __timeout);
516extern int pselect (int __nfds, fd_set *__restrict __readfds,
517 fd_set *__restrict __writefds,
518 fd_set *__restrict __exceptfds,
519 const struct timespec *__restrict __timeout,
520 const __sigset_t *__restrict __sigmask);
521
522
523__extension__
524extern unsigned int gnu_dev_major (unsigned long long int __dev)
525 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
526__extension__
527extern unsigned int gnu_dev_minor (unsigned long long int __dev)
528 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
529__extension__
530extern unsigned long long int gnu_dev_makedev (unsigned int __major,
531 unsigned int __minor)
532 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
533
534typedef __blksize_t blksize_t;
535typedef __blkcnt_t blkcnt_t;
536typedef __fsblkcnt_t fsblkcnt_t;
537typedef __fsfilcnt_t fsfilcnt_t;
538typedef unsigned long int pthread_t;
539union pthread_attr_t
540{
541 char __size[36];
542 long int __align;
543};
544typedef union pthread_attr_t pthread_attr_t;
545typedef struct __pthread_internal_slist
546{
547 struct __pthread_internal_slist *__next;
548} __pthread_slist_t;
549typedef union
550{
551 struct __pthread_mutex_s
552 {
553 int __lock;
554 unsigned int __count;
555 int __owner;
556 int __kind;
557 unsigned int __nusers;
558 __extension__ union
559 {
560 struct
561 {
562 short __espins;
563 short __elision;
564 } __elision_data;
565 __pthread_slist_t __list;
566 };
567 } __data;
568 char __size[24];
569 long int __align;
570} pthread_mutex_t;
571typedef union
572{
573 char __size[4];
574 int __align;
575} pthread_mutexattr_t;
576typedef union
577{
578 struct
579 {
580 int __lock;
581 unsigned int __futex;
582 __extension__ unsigned long long int __total_seq;
583 __extension__ unsigned long long int __wakeup_seq;
584 __extension__ unsigned long long int __woken_seq;
585 void *__mutex;
586 unsigned int __nwaiters;
587 unsigned int __broadcast_seq;
588 } __data;
589 char __size[48];
590 __extension__ long long int __align;
591} pthread_cond_t;
592typedef union
593{
594 char __size[4];
595 int __align;
596} pthread_condattr_t;
597typedef unsigned int pthread_key_t;
598typedef int pthread_once_t;
599typedef union
600{
601 struct
602 {
603 int __lock;
604 unsigned int __nr_readers;
605 unsigned int __readers_wakeup;
606 unsigned int __writer_wakeup;
607 unsigned int __nr_readers_queued;
608 unsigned int __nr_writers_queued;
609 unsigned char __flags;
610 unsigned char __shared;
611 signed char __rwelision;
612 unsigned char __pad2;
613 int __writer;
614 } __data;
615 char __size[32];
616 long int __align;
617} pthread_rwlock_t;
618typedef union
619{
620 char __size[8];
621 long int __align;
622} pthread_rwlockattr_t;
623typedef volatile int pthread_spinlock_t;
624typedef union
625{
626 char __size[20];
627 long int __align;
628} pthread_barrier_t;
629typedef union
630{
631 char __size[4];
632 int __align;
633} pthread_barrierattr_t;
634
635extern long int random (void) __attribute__ ((__nothrow__ , __leaf__));
636extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__));
637extern char *initstate (unsigned int __seed, char *__statebuf,
638 size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
639extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
640struct random_data
641 {
642 int32_t *fptr;
643 int32_t *rptr;
644 int32_t *state;
645 int rand_type;
646 int rand_deg;
647 int rand_sep;
648 int32_t *end_ptr;
649 };
650extern int random_r (struct random_data *__restrict __buf,
651 int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
652extern int srandom_r (unsigned int __seed, struct random_data *__buf)
653 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
654extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
655 size_t __statelen,
656 struct random_data *__restrict __buf)
657 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4)));
658extern int setstate_r (char *__restrict __statebuf,
659 struct random_data *__restrict __buf)
660 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
661
662extern int rand (void) __attribute__ ((__nothrow__ , __leaf__));
663extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__));
664
665extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__));
666extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__));
667extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
668extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__));
669extern long int nrand48 (unsigned short int __xsubi[3])
670 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
671extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__));
672extern long int jrand48 (unsigned short int __xsubi[3])
673 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
674extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__));
675extern unsigned short int *seed48 (unsigned short int __seed16v[3])
676 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
677extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
678struct drand48_data
679 {
680 unsigned short int __x[3];
681 unsigned short int __old_x[3];
682 unsigned short int __c;
683 unsigned short int __init;
684 __extension__ unsigned long long int __a;
685 };
686extern int drand48_r (struct drand48_data *__restrict __buffer,
687 double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
688extern int erand48_r (unsigned short int __xsubi[3],
689 struct drand48_data *__restrict __buffer,
690 double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
691extern int lrand48_r (struct drand48_data *__restrict __buffer,
692 long int *__restrict __result)
693 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
694extern int nrand48_r (unsigned short int __xsubi[3],
695 struct drand48_data *__restrict __buffer,
696 long int *__restrict __result)
697 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
698extern int mrand48_r (struct drand48_data *__restrict __buffer,
699 long int *__restrict __result)
700 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
701extern int jrand48_r (unsigned short int __xsubi[3],
702 struct drand48_data *__restrict __buffer,
703 long int *__restrict __result)
704 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
705extern int srand48_r (long int __seedval, struct drand48_data *__buffer)
706 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
707extern int seed48_r (unsigned short int __seed16v[3],
708 struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
709extern int lcong48_r (unsigned short int __param[7],
710 struct drand48_data *__buffer)
711 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
712
713extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ;
714extern void *calloc (size_t __nmemb, size_t __size)
715 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ;
716
717
718extern void *realloc (void *__ptr, size_t __size)
719 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
720extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__));
721
722extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__));
723
724extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__));
725
726extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ;
727extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
728 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ;
729extern void *aligned_alloc (size_t __alignment, size_t __size)
730 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ;
731
732extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
733extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
734extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
735
736extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
737 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
738
739extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
740extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
741
742
743extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
744
745
746extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ;
747
748extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
749extern int setenv (const char *__name, const char *__value, int __replace)
750 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
751extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
752extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__));
753extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
754extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ;
755extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ;
756extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ;
757
758extern int system (const char *__command) ;
759
760extern char *realpath (const char *__restrict __name,
761 char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ;
762typedef int (*__compar_fn_t) (const void *, const void *);
763
764extern void *bsearch (const void *__key, const void *__base,
765 size_t __nmemb, size_t __size, __compar_fn_t __compar)
766 __attribute__ ((__nonnull__ (1, 2, 5))) ;
767extern void qsort (void *__base, size_t __nmemb, size_t __size,
768 __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4)));
769extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ;
770extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ;
771
772__extension__ extern long long int llabs (long long int __x)
773 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ;
774
775extern div_t div (int __numer, int __denom)
776 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ;
777extern ldiv_t ldiv (long int __numer, long int __denom)
778 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ;
779
780
781__extension__ extern lldiv_t lldiv (long long int __numer,
782 long long int __denom)
783 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ;
784
785extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt,
786 int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ;
787extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt,
788 int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ;
789extern char *gcvt (double __value, int __ndigit, char *__buf)
790 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ;
791extern char *qecvt (long double __value, int __ndigit,
792 int *__restrict __decpt, int *__restrict __sign)
793 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ;
794extern char *qfcvt (long double __value, int __ndigit,
795 int *__restrict __decpt, int *__restrict __sign)
796 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ;
797extern char *qgcvt (long double __value, int __ndigit, char *__buf)
798 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ;
799extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
800 int *__restrict __sign, char *__restrict __buf,
801 size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5)));
802extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
803 int *__restrict __sign, char *__restrict __buf,
804 size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5)));
805extern int qecvt_r (long double __value, int __ndigit,
806 int *__restrict __decpt, int *__restrict __sign,
807 char *__restrict __buf, size_t __len)
808 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5)));
809extern int qfcvt_r (long double __value, int __ndigit,
810 int *__restrict __decpt, int *__restrict __sign,
811 char *__restrict __buf, size_t __len)
812 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5)));
813
814extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__));
815extern int mbtowc (wchar_t *__restrict __pwc,
816 const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__));
817extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__));
818extern size_t mbstowcs (wchar_t *__restrict __pwcs,
819 const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__));
820extern size_t wcstombs (char *__restrict __s,
821 const wchar_t *__restrict __pwcs, size_t __n)
822 __attribute__ ((__nothrow__ , __leaf__));
823
824extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ;
825extern int getsubopt (char **__restrict __optionp,
826 char *const *__restrict __tokens,
827 char **__restrict __valuep)
828 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ;
829extern int getloadavg (double __loadavg[], int __nelem)
830 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
831
832
833typedef __useconds_t useconds_t;
834typedef __intptr_t intptr_t;
835typedef __socklen_t socklen_t;
836extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
837extern int faccessat (int __fd, const char *__file, int __type, int __flag)
838 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ;
839extern __off_t lseek (int __fd, __off_t __offset, int __whence) __attribute__ ((__nothrow__ , __leaf__));
840extern int close (int __fd);
841extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ;
842extern ssize_t write (int __fd, const void *__buf, size_t __n) ;
843extern ssize_t pread (int __fd, void *__buf, size_t __nbytes,
844 __off_t __offset) ;
845extern ssize_t pwrite (int __fd, const void *__buf, size_t __n,
846 __off_t __offset) ;
847extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) ;
848extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__));
849extern unsigned int sleep (unsigned int __seconds);
850extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval)
851 __attribute__ ((__nothrow__ , __leaf__));
852extern int usleep (__useconds_t __useconds);
853extern int pause (void);
854extern int chown (const char *__file, __uid_t __owner, __gid_t __group)
855 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ;
856extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) ;
857extern int lchown (const char *__file, __uid_t __owner, __gid_t __group)
858 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ;
859extern int fchownat (int __fd, const char *__file, __uid_t __owner,
860 __gid_t __group, int __flag)
861 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ;
862extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ;
863extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ;
864extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) ;
865extern char *getwd (char *__buf)
866 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) ;
867extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) ;
868extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__));
869extern char **__environ;
870extern int execve (const char *__path, char *const __argv[],
871 char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
872extern int fexecve (int __fd, char *const __argv[], char *const __envp[])
873 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
874extern int execv (const char *__path, char *const __argv[])
875 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
876extern int execle (const char *__path, const char *__arg, ...)
877 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
878extern int execl (const char *__path, const char *__arg, ...)
879 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
880extern int execvp (const char *__file, char *const __argv[])
881 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
882extern int execlp (const char *__file, const char *__arg, ...)
883 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
884extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) ;
885extern void _exit (int __status) __attribute__ ((__noreturn__));
886enum
887 {
888 _PC_LINK_MAX,
889 _PC_MAX_CANON,
890 _PC_MAX_INPUT,
891 _PC_NAME_MAX,
892 _PC_PATH_MAX,
893 _PC_PIPE_BUF,
894 _PC_CHOWN_RESTRICTED,
895 _PC_NO_TRUNC,
896 _PC_VDISABLE,
897 _PC_SYNC_IO,
898 _PC_ASYNC_IO,
899 _PC_PRIO_IO,
900 _PC_SOCK_MAXBUF,
901 _PC_FILESIZEBITS,
902 _PC_REC_INCR_XFER_SIZE,
903 _PC_REC_MAX_XFER_SIZE,
904 _PC_REC_MIN_XFER_SIZE,
905 _PC_REC_XFER_ALIGN,
906 _PC_ALLOC_SIZE_MIN,
907 _PC_SYMLINK_MAX,
908 _PC_2_SYMLINKS
909 };
910enum
911 {
912 _SC_ARG_MAX,
913 _SC_CHILD_MAX,
914 _SC_CLK_TCK,
915 _SC_NGROUPS_MAX,
916 _SC_OPEN_MAX,
917 _SC_STREAM_MAX,
918 _SC_TZNAME_MAX,
919 _SC_JOB_CONTROL,
920 _SC_SAVED_IDS,
921 _SC_REALTIME_SIGNALS,
922 _SC_PRIORITY_SCHEDULING,
923 _SC_TIMERS,
924 _SC_ASYNCHRONOUS_IO,
925 _SC_PRIORITIZED_IO,
926 _SC_SYNCHRONIZED_IO,
927 _SC_FSYNC,
928 _SC_MAPPED_FILES,
929 _SC_MEMLOCK,
930 _SC_MEMLOCK_RANGE,
931 _SC_MEMORY_PROTECTION,
932 _SC_MESSAGE_PASSING,
933 _SC_SEMAPHORES,
934 _SC_SHARED_MEMORY_OBJECTS,
935 _SC_AIO_LISTIO_MAX,
936 _SC_AIO_MAX,
937 _SC_AIO_PRIO_DELTA_MAX,
938 _SC_DELAYTIMER_MAX,
939 _SC_MQ_OPEN_MAX,
940 _SC_MQ_PRIO_MAX,
941 _SC_VERSION,
942 _SC_PAGESIZE,
943 _SC_RTSIG_MAX,
944 _SC_SEM_NSEMS_MAX,
945 _SC_SEM_VALUE_MAX,
946 _SC_SIGQUEUE_MAX,
947 _SC_TIMER_MAX,
948 _SC_BC_BASE_MAX,
949 _SC_BC_DIM_MAX,
950 _SC_BC_SCALE_MAX,
951 _SC_BC_STRING_MAX,
952 _SC_COLL_WEIGHTS_MAX,
953 _SC_EQUIV_CLASS_MAX,
954 _SC_EXPR_NEST_MAX,
955 _SC_LINE_MAX,
956 _SC_RE_DUP_MAX,
957 _SC_CHARCLASS_NAME_MAX,
958 _SC_2_VERSION,
959 _SC_2_C_BIND,
960 _SC_2_C_DEV,
961 _SC_2_FORT_DEV,
962 _SC_2_FORT_RUN,
963 _SC_2_SW_DEV,
964 _SC_2_LOCALEDEF,
965 _SC_PII,
966 _SC_PII_XTI,
967 _SC_PII_SOCKET,
968 _SC_PII_INTERNET,
969 _SC_PII_OSI,
970 _SC_POLL,
971 _SC_SELECT,
972 _SC_UIO_MAXIOV,
973 _SC_IOV_MAX = _SC_UIO_MAXIOV,
974 _SC_PII_INTERNET_STREAM,
975 _SC_PII_INTERNET_DGRAM,
976 _SC_PII_OSI_COTS,
977 _SC_PII_OSI_CLTS,
978 _SC_PII_OSI_M,
979 _SC_T_IOV_MAX,
980 _SC_THREADS,
981 _SC_THREAD_SAFE_FUNCTIONS,
982 _SC_GETGR_R_SIZE_MAX,
983 _SC_GETPW_R_SIZE_MAX,
984 _SC_LOGIN_NAME_MAX,
985 _SC_TTY_NAME_MAX,
986 _SC_THREAD_DESTRUCTOR_ITERATIONS,
987 _SC_THREAD_KEYS_MAX,
988 _SC_THREAD_STACK_MIN,
989 _SC_THREAD_THREADS_MAX,
990 _SC_THREAD_ATTR_STACKADDR,
991 _SC_THREAD_ATTR_STACKSIZE,
992 _SC_THREAD_PRIORITY_SCHEDULING,
993 _SC_THREAD_PRIO_INHERIT,
994 _SC_THREAD_PRIO_PROTECT,
995 _SC_THREAD_PROCESS_SHARED,
996 _SC_NPROCESSORS_CONF,
997 _SC_NPROCESSORS_ONLN,
998 _SC_PHYS_PAGES,
999 _SC_AVPHYS_PAGES,
1000 _SC_ATEXIT_MAX,
1001 _SC_PASS_MAX,
1002 _SC_XOPEN_VERSION,
1003 _SC_XOPEN_XCU_VERSION,
1004 _SC_XOPEN_UNIX,
1005 _SC_XOPEN_CRYPT,
1006 _SC_XOPEN_ENH_I18N,
1007 _SC_XOPEN_SHM,
1008 _SC_2_CHAR_TERM,
1009 _SC_2_C_VERSION,
1010 _SC_2_UPE,
1011 _SC_XOPEN_XPG2,
1012 _SC_XOPEN_XPG3,
1013 _SC_XOPEN_XPG4,
1014 _SC_CHAR_BIT,
1015 _SC_CHAR_MAX,
1016 _SC_CHAR_MIN,
1017 _SC_INT_MAX,
1018 _SC_INT_MIN,
1019 _SC_LONG_BIT,
1020 _SC_WORD_BIT,
1021 _SC_MB_LEN_MAX,
1022 _SC_NZERO,
1023 _SC_SSIZE_MAX,
1024 _SC_SCHAR_MAX,
1025 _SC_SCHAR_MIN,
1026 _SC_SHRT_MAX,
1027 _SC_SHRT_MIN,
1028 _SC_UCHAR_MAX,
1029 _SC_UINT_MAX,
1030 _SC_ULONG_MAX,
1031 _SC_USHRT_MAX,
1032 _SC_NL_ARGMAX,
1033 _SC_NL_LANGMAX,
1034 _SC_NL_MSGMAX,
1035 _SC_NL_NMAX,
1036 _SC_NL_SETMAX,
1037 _SC_NL_TEXTMAX,
1038 _SC_XBS5_ILP32_OFF32,
1039 _SC_XBS5_ILP32_OFFBIG,
1040 _SC_XBS5_LP64_OFF64,
1041 _SC_XBS5_LPBIG_OFFBIG,
1042 _SC_XOPEN_LEGACY,
1043 _SC_XOPEN_REALTIME,
1044 _SC_XOPEN_REALTIME_THREADS,
1045 _SC_ADVISORY_INFO,
1046 _SC_BARRIERS,
1047 _SC_BASE,
1048 _SC_C_LANG_SUPPORT,
1049 _SC_C_LANG_SUPPORT_R,
1050 _SC_CLOCK_SELECTION,
1051 _SC_CPUTIME,
1052 _SC_THREAD_CPUTIME,
1053 _SC_DEVICE_IO,
1054 _SC_DEVICE_SPECIFIC,
1055 _SC_DEVICE_SPECIFIC_R,
1056 _SC_FD_MGMT,
1057 _SC_FIFO,
1058 _SC_PIPE,
1059 _SC_FILE_ATTRIBUTES,
1060 _SC_FILE_LOCKING,
1061 _SC_FILE_SYSTEM,
1062 _SC_MONOTONIC_CLOCK,
1063 _SC_MULTI_PROCESS,
1064 _SC_SINGLE_PROCESS,
1065 _SC_NETWORKING,
1066 _SC_READER_WRITER_LOCKS,
1067 _SC_SPIN_LOCKS,
1068 _SC_REGEXP,
1069 _SC_REGEX_VERSION,
1070 _SC_SHELL,
1071 _SC_SIGNALS,
1072 _SC_SPAWN,
1073 _SC_SPORADIC_SERVER,
1074 _SC_THREAD_SPORADIC_SERVER,
1075 _SC_SYSTEM_DATABASE,
1076 _SC_SYSTEM_DATABASE_R,
1077 _SC_TIMEOUTS,
1078 _SC_TYPED_MEMORY_OBJECTS,
1079 _SC_USER_GROUPS,
1080 _SC_USER_GROUPS_R,
1081 _SC_2_PBS,
1082 _SC_2_PBS_ACCOUNTING,
1083 _SC_2_PBS_LOCATE,
1084 _SC_2_PBS_MESSAGE,
1085 _SC_2_PBS_TRACK,
1086 _SC_SYMLOOP_MAX,
1087 _SC_STREAMS,
1088 _SC_2_PBS_CHECKPOINT,
1089 _SC_V6_ILP32_OFF32,
1090 _SC_V6_ILP32_OFFBIG,
1091 _SC_V6_LP64_OFF64,
1092 _SC_V6_LPBIG_OFFBIG,
1093 _SC_HOST_NAME_MAX,
1094 _SC_TRACE,
1095 _SC_TRACE_EVENT_FILTER,
1096 _SC_TRACE_INHERIT,
1097 _SC_TRACE_LOG,
1098 _SC_LEVEL1_ICACHE_SIZE,
1099 _SC_LEVEL1_ICACHE_ASSOC,
1100 _SC_LEVEL1_ICACHE_LINESIZE,
1101 _SC_LEVEL1_DCACHE_SIZE,
1102 _SC_LEVEL1_DCACHE_ASSOC,
1103 _SC_LEVEL1_DCACHE_LINESIZE,
1104 _SC_LEVEL2_CACHE_SIZE,
1105 _SC_LEVEL2_CACHE_ASSOC,
1106 _SC_LEVEL2_CACHE_LINESIZE,
1107 _SC_LEVEL3_CACHE_SIZE,
1108 _SC_LEVEL3_CACHE_ASSOC,
1109 _SC_LEVEL3_CACHE_LINESIZE,
1110 _SC_LEVEL4_CACHE_SIZE,
1111 _SC_LEVEL4_CACHE_ASSOC,
1112 _SC_LEVEL4_CACHE_LINESIZE,
1113 _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50,
1114 _SC_RAW_SOCKETS,
1115 _SC_V7_ILP32_OFF32,
1116 _SC_V7_ILP32_OFFBIG,
1117 _SC_V7_LP64_OFF64,
1118 _SC_V7_LPBIG_OFFBIG,
1119 _SC_SS_REPL_MAX,
1120 _SC_TRACE_EVENT_NAME_MAX,
1121 _SC_TRACE_NAME_MAX,
1122 _SC_TRACE_SYS_MAX,
1123 _SC_TRACE_USER_EVENT_MAX,
1124 _SC_XOPEN_STREAMS,
1125 _SC_THREAD_ROBUST_PRIO_INHERIT,
1126 _SC_THREAD_ROBUST_PRIO_PROTECT
1127 };
1128enum
1129 {
1130 _CS_PATH,
1131 _CS_V6_WIDTH_RESTRICTED_ENVS,
1132 _CS_GNU_LIBC_VERSION,
1133 _CS_GNU_LIBPTHREAD_VERSION,
1134 _CS_V5_WIDTH_RESTRICTED_ENVS,
1135 _CS_V7_WIDTH_RESTRICTED_ENVS,
1136 _CS_LFS_CFLAGS = 1000,
1137 _CS_LFS_LDFLAGS,
1138 _CS_LFS_LIBS,
1139 _CS_LFS_LINTFLAGS,
1140 _CS_LFS64_CFLAGS,
1141 _CS_LFS64_LDFLAGS,
1142 _CS_LFS64_LIBS,
1143 _CS_LFS64_LINTFLAGS,
1144 _CS_XBS5_ILP32_OFF32_CFLAGS = 1100,
1145 _CS_XBS5_ILP32_OFF32_LDFLAGS,
1146 _CS_XBS5_ILP32_OFF32_LIBS,
1147 _CS_XBS5_ILP32_OFF32_LINTFLAGS,
1148 _CS_XBS5_ILP32_OFFBIG_CFLAGS,
1149 _CS_XBS5_ILP32_OFFBIG_LDFLAGS,
1150 _CS_XBS5_ILP32_OFFBIG_LIBS,
1151 _CS_XBS5_ILP32_OFFBIG_LINTFLAGS,
1152 _CS_XBS5_LP64_OFF64_CFLAGS,
1153 _CS_XBS5_LP64_OFF64_LDFLAGS,
1154 _CS_XBS5_LP64_OFF64_LIBS,
1155 _CS_XBS5_LP64_OFF64_LINTFLAGS,
1156 _CS_XBS5_LPBIG_OFFBIG_CFLAGS,
1157 _CS_XBS5_LPBIG_OFFBIG_LDFLAGS,
1158 _CS_XBS5_LPBIG_OFFBIG_LIBS,
1159 _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS,
1160 _CS_POSIX_V6_ILP32_OFF32_CFLAGS,
1161 _CS_POSIX_V6_ILP32_OFF32_LDFLAGS,
1162 _CS_POSIX_V6_ILP32_OFF32_LIBS,
1163 _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS,
1164 _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS,
1165 _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS,
1166 _CS_POSIX_V6_ILP32_OFFBIG_LIBS,
1167 _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS,
1168 _CS_POSIX_V6_LP64_OFF64_CFLAGS,
1169 _CS_POSIX_V6_LP64_OFF64_LDFLAGS,
1170 _CS_POSIX_V6_LP64_OFF64_LIBS,
1171 _CS_POSIX_V6_LP64_OFF64_LINTFLAGS,
1172 _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS,
1173 _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS,
1174 _CS_POSIX_V6_LPBIG_OFFBIG_LIBS,
1175 _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS,
1176 _CS_POSIX_V7_ILP32_OFF32_CFLAGS,
1177 _CS_POSIX_V7_ILP32_OFF32_LDFLAGS,
1178 _CS_POSIX_V7_ILP32_OFF32_LIBS,
1179 _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS,
1180 _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS,
1181 _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS,
1182 _CS_POSIX_V7_ILP32_OFFBIG_LIBS,
1183 _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS,
1184 _CS_POSIX_V7_LP64_OFF64_CFLAGS,
1185 _CS_POSIX_V7_LP64_OFF64_LDFLAGS,
1186 _CS_POSIX_V7_LP64_OFF64_LIBS,
1187 _CS_POSIX_V7_LP64_OFF64_LINTFLAGS,
1188 _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS,
1189 _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS,
1190 _CS_POSIX_V7_LPBIG_OFFBIG_LIBS,
1191 _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS,
1192 _CS_V6_ENV,
1193 _CS_V7_ENV
1194 };
1195extern long int pathconf (const char *__path, int __name)
1196 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1197extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__));
1198extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__));
1199extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__));
1200extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__));
1201extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__));
1202extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__));
1203extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__));
1204extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__));
1205extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__));
1206extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__));
1207extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__));
1208extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__));
1209extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__));
1210extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__));
1211extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__));
1212extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__));
1213extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) ;
1214extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ;
1215extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) ;
1216extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) ;
1217extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ;
1218extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) ;
1219extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) ;
1220extern __pid_t fork (void) __attribute__ ((__nothrow__));
1221extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__));
1222extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__));
1223extern int ttyname_r (int __fd, char *__buf, size_t __buflen)
1224 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) ;
1225extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__));
1226extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__));
1227extern int link (const char *__from, const char *__to)
1228 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ;
1229extern int linkat (int __fromfd, const char *__from, int __tofd,
1230 const char *__to, int __flags)
1231 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) ;
1232extern int symlink (const char *__from, const char *__to)
1233 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ;
1234extern ssize_t readlink (const char *__restrict __path,
1235 char *__restrict __buf, size_t __len)
1236 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) ;
1237extern int symlinkat (const char *__from, int __tofd,
1238 const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) ;
1239extern ssize_t readlinkat (int __fd, const char *__restrict __path,
1240 char *__restrict __buf, size_t __len)
1241 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) ;
1242extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1243extern int unlinkat (int __fd, const char *__name, int __flag)
1244 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
1245extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1246extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__));
1247extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__));
1248extern char *getlogin (void);
1249extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1)));
1250extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1251extern char *optarg;
1252extern int optind;
1253extern int opterr;
1254extern int optopt;
1255extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
1256 __attribute__ ((__nothrow__ , __leaf__));
1257extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1258extern int sethostname (const char *__name, size_t __len)
1259 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ;
1260extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) ;
1261extern int getdomainname (char *__name, size_t __len)
1262 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ;
1263extern int setdomainname (const char *__name, size_t __len)
1264 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ;
1265extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__));
1266extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ;
1267extern int profil (unsigned short int *__sample_buffer, size_t __size,
1268 size_t __offset, unsigned int __scale)
1269 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1270extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__));
1271extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__));
1272extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__));
1273extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__));
1274extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) ;
1275extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ;
1276extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1)));
1277extern int fsync (int __fd);
1278extern long int gethostid (void);
1279extern void sync (void) __attribute__ ((__nothrow__ , __leaf__));
1280extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
1281extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__));
1282extern int truncate (const char *__file, __off_t __length)
1283 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ;
1284extern int ftruncate (int __fd, __off_t __length) __attribute__ ((__nothrow__ , __leaf__)) ;
1285extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) ;
1286extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__));
1287extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__));
1288extern int lockf (int __fd, int __cmd, __off_t __len) ;
1289extern int fdatasync (int __fildes);
1290
1291struct sched_param
1292 {
1293 int __sched_priority;
1294 };
1295
1296
1297struct __sched_param
1298 {
1299 int __sched_priority;
1300 };
1301typedef unsigned long int __cpu_mask;
1302typedef struct
1303{
1304 __cpu_mask __bits[1024 / (8 * sizeof (__cpu_mask))];
1305} cpu_set_t;
1306
1307extern int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp)
1308 __attribute__ ((__nothrow__ , __leaf__));
1309extern cpu_set_t *__sched_cpualloc (size_t __count) __attribute__ ((__nothrow__ , __leaf__)) ;
1310extern void __sched_cpufree (cpu_set_t *__set) __attribute__ ((__nothrow__ , __leaf__));
1311
1312
1313extern int sched_setparam (__pid_t __pid, const struct sched_param *__param)
1314 __attribute__ ((__nothrow__ , __leaf__));
1315extern int sched_getparam (__pid_t __pid, struct sched_param *__param) __attribute__ ((__nothrow__ , __leaf__));
1316extern int sched_setscheduler (__pid_t __pid, int __policy,
1317 const struct sched_param *__param) __attribute__ ((__nothrow__ , __leaf__));
1318extern int sched_getscheduler (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__));
1319extern int sched_yield (void) __attribute__ ((__nothrow__ , __leaf__));
1320extern int sched_get_priority_max (int __algorithm) __attribute__ ((__nothrow__ , __leaf__));
1321extern int sched_get_priority_min (int __algorithm) __attribute__ ((__nothrow__ , __leaf__));
1322extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __attribute__ ((__nothrow__ , __leaf__));
1323
1324
1325
1326struct tm
1327{
1328 int tm_sec;
1329 int tm_min;
1330 int tm_hour;
1331 int tm_mday;
1332 int tm_mon;
1333 int tm_year;
1334 int tm_wday;
1335 int tm_yday;
1336 int tm_isdst;
1337 long int tm_gmtoff;
1338 const char *tm_zone;
1339};
1340
1341
1342struct itimerspec
1343 {
1344 struct timespec it_interval;
1345 struct timespec it_value;
1346 };
1347struct sigevent;
1348
1349extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__));
1350extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__));
1351extern double difftime (time_t __time1, time_t __time0)
1352 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
1353extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__));
1354extern size_t strftime (char *__restrict __s, size_t __maxsize,
1355 const char *__restrict __format,
1356 const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__));
1357
1358typedef struct __locale_struct
1359{
1360 struct __locale_data *__locales[13];
1361 const unsigned short int *__ctype_b;
1362 const int *__ctype_tolower;
1363 const int *__ctype_toupper;
1364 const char *__names[13];
1365} *__locale_t;
1366typedef __locale_t locale_t;
1367extern size_t strftime_l (char *__restrict __s, size_t __maxsize,
1368 const char *__restrict __format,
1369 const struct tm *__restrict __tp,
1370 __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__));
1371
1372extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__));
1373extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__));
1374
1375extern struct tm *gmtime_r (const time_t *__restrict __timer,
1376 struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__));
1377extern struct tm *localtime_r (const time_t *__restrict __timer,
1378 struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__));
1379
1380extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__));
1381extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__));
1382
1383extern char *asctime_r (const struct tm *__restrict __tp,
1384 char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__));
1385extern char *ctime_r (const time_t *__restrict __timer,
1386 char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__));
1387extern char *__tzname[2];
1388extern int __daylight;
1389extern long int __timezone;
1390extern char *tzname[2];
1391extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__));
1392extern int daylight;
1393extern long int timezone;
1394extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__));
1395extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__));
1396extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__));
1397extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
1398extern int nanosleep (const struct timespec *__requested_time,
1399 struct timespec *__remaining);
1400extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__));
1401extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__));
1402extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp)
1403 __attribute__ ((__nothrow__ , __leaf__));
1404extern int clock_nanosleep (clockid_t __clock_id, int __flags,
1405 const struct timespec *__req,
1406 struct timespec *__rem);
1407extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__));
1408extern int timer_create (clockid_t __clock_id,
1409 struct sigevent *__restrict __evp,
1410 timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__));
1411extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__));
1412extern int timer_settime (timer_t __timerid, int __flags,
1413 const struct itimerspec *__restrict __value,
1414 struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__));
1415extern int timer_gettime (timer_t __timerid, struct itimerspec *__value)
1416 __attribute__ ((__nothrow__ , __leaf__));
1417extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__));
1418extern int timespec_get (struct timespec *__ts, int __base)
1419 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1420
1421typedef int __jmp_buf[6];
1422enum
1423{
1424 PTHREAD_CREATE_JOINABLE,
1425 PTHREAD_CREATE_DETACHED
1426};
1427enum
1428{
1429 PTHREAD_MUTEX_TIMED_NP,
1430 PTHREAD_MUTEX_RECURSIVE_NP,
1431 PTHREAD_MUTEX_ERRORCHECK_NP,
1432 PTHREAD_MUTEX_ADAPTIVE_NP
1433 ,
1434 PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_TIMED_NP,
1435 PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP,
1436 PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP,
1437 PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
1438};
1439enum
1440{
1441 PTHREAD_MUTEX_STALLED,
1442 PTHREAD_MUTEX_STALLED_NP = PTHREAD_MUTEX_STALLED,
1443 PTHREAD_MUTEX_ROBUST,
1444 PTHREAD_MUTEX_ROBUST_NP = PTHREAD_MUTEX_ROBUST
1445};
1446enum
1447{
1448 PTHREAD_PRIO_NONE,
1449 PTHREAD_PRIO_INHERIT,
1450 PTHREAD_PRIO_PROTECT
1451};
1452enum
1453{
1454 PTHREAD_RWLOCK_PREFER_READER_NP,
1455 PTHREAD_RWLOCK_PREFER_WRITER_NP,
1456 PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP,
1457 PTHREAD_RWLOCK_DEFAULT_NP = PTHREAD_RWLOCK_PREFER_READER_NP
1458};
1459enum
1460{
1461 PTHREAD_INHERIT_SCHED,
1462 PTHREAD_EXPLICIT_SCHED
1463};
1464enum
1465{
1466 PTHREAD_SCOPE_SYSTEM,
1467 PTHREAD_SCOPE_PROCESS
1468};
1469enum
1470{
1471 PTHREAD_PROCESS_PRIVATE,
1472 PTHREAD_PROCESS_SHARED
1473};
1474struct _pthread_cleanup_buffer
1475{
1476 void (*__routine) (void *);
1477 void *__arg;
1478 int __canceltype;
1479 struct _pthread_cleanup_buffer *__prev;
1480};
1481enum
1482{
1483 PTHREAD_CANCEL_ENABLE,
1484 PTHREAD_CANCEL_DISABLE
1485};
1486enum
1487{
1488 PTHREAD_CANCEL_DEFERRED,
1489 PTHREAD_CANCEL_ASYNCHRONOUS
1490};
1491
1492extern int pthread_create (pthread_t *__restrict __newthread,
1493 const pthread_attr_t *__restrict __attr,
1494 void *(*__start_routine) (void *),
1495 void *__restrict __arg) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 3)));
1496extern void pthread_exit (void *__retval) __attribute__ ((__noreturn__));
1497extern int pthread_join (pthread_t __th, void **__thread_return);
1498extern int pthread_detach (pthread_t __th) __attribute__ ((__nothrow__ , __leaf__));
1499extern pthread_t pthread_self (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
1500extern int pthread_equal (pthread_t __thread1, pthread_t __thread2)
1501 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
1502extern int pthread_attr_init (pthread_attr_t *__attr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1503extern int pthread_attr_destroy (pthread_attr_t *__attr)
1504 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1505extern int pthread_attr_getdetachstate (const pthread_attr_t *__attr,
1506 int *__detachstate)
1507 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1508extern int pthread_attr_setdetachstate (pthread_attr_t *__attr,
1509 int __detachstate)
1510 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1511extern int pthread_attr_getguardsize (const pthread_attr_t *__attr,
1512 size_t *__guardsize)
1513 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1514extern int pthread_attr_setguardsize (pthread_attr_t *__attr,
1515 size_t __guardsize)
1516 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1517extern int pthread_attr_getschedparam (const pthread_attr_t *__restrict __attr,
1518 struct sched_param *__restrict __param)
1519 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1520extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr,
1521 const struct sched_param *__restrict
1522 __param) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1523extern int pthread_attr_getschedpolicy (const pthread_attr_t *__restrict
1524 __attr, int *__restrict __policy)
1525 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1526extern int pthread_attr_setschedpolicy (pthread_attr_t *__attr, int __policy)
1527 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1528extern int pthread_attr_getinheritsched (const pthread_attr_t *__restrict
1529 __attr, int *__restrict __inherit)
1530 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1531extern int pthread_attr_setinheritsched (pthread_attr_t *__attr,
1532 int __inherit)
1533 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1534extern int pthread_attr_getscope (const pthread_attr_t *__restrict __attr,
1535 int *__restrict __scope)
1536 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1537extern int pthread_attr_setscope (pthread_attr_t *__attr, int __scope)
1538 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1539extern int pthread_attr_getstackaddr (const pthread_attr_t *__restrict
1540 __attr, void **__restrict __stackaddr)
1541 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) __attribute__ ((__deprecated__));
1542extern int pthread_attr_setstackaddr (pthread_attr_t *__attr,
1543 void *__stackaddr)
1544 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__));
1545extern int pthread_attr_getstacksize (const pthread_attr_t *__restrict
1546 __attr, size_t *__restrict __stacksize)
1547 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1548extern int pthread_attr_setstacksize (pthread_attr_t *__attr,
1549 size_t __stacksize)
1550 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1551extern int pthread_attr_getstack (const pthread_attr_t *__restrict __attr,
1552 void **__restrict __stackaddr,
1553 size_t *__restrict __stacksize)
1554 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3)));
1555extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr,
1556 size_t __stacksize) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1557extern int pthread_setschedparam (pthread_t __target_thread, int __policy,
1558 const struct sched_param *__param)
1559 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3)));
1560extern int pthread_getschedparam (pthread_t __target_thread,
1561 int *__restrict __policy,
1562 struct sched_param *__restrict __param)
1563 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3)));
1564extern int pthread_setschedprio (pthread_t __target_thread, int __prio)
1565 __attribute__ ((__nothrow__ , __leaf__));
1566extern int pthread_once (pthread_once_t *__once_control,
1567 void (*__init_routine) (void)) __attribute__ ((__nonnull__ (1, 2)));
1568extern int pthread_setcancelstate (int __state, int *__oldstate);
1569extern int pthread_setcanceltype (int __type, int *__oldtype);
1570extern int pthread_cancel (pthread_t __th);
1571extern void pthread_testcancel (void);
1572typedef struct
1573{
1574 struct
1575 {
1576 __jmp_buf __cancel_jmp_buf;
1577 int __mask_was_saved;
1578 } __cancel_jmp_buf[1];
1579 void *__pad[4];
1580} __pthread_unwind_buf_t __attribute__ ((__aligned__));
1581struct __pthread_cleanup_frame
1582{
1583 void (*__cancel_routine) (void *);
1584 void *__cancel_arg;
1585 int __do_it;
1586 int __cancel_type;
1587};
1588extern void __pthread_register_cancel (__pthread_unwind_buf_t *__buf)
1589 __attribute__ ((__regparm__ (1)));
1590extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf)
1591 __attribute__ ((__regparm__ (1)));
1592extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf)
1593 __attribute__ ((__regparm__ (1))) __attribute__ ((__noreturn__))
1594 __attribute__ ((__weak__))
1595 ;
1596struct __jmp_buf_tag;
1597extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __attribute__ ((__nothrow__));
1598extern int pthread_mutex_init (pthread_mutex_t *__mutex,
1599 const pthread_mutexattr_t *__mutexattr)
1600 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1601extern int pthread_mutex_destroy (pthread_mutex_t *__mutex)
1602 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1603extern int pthread_mutex_trylock (pthread_mutex_t *__mutex)
1604 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1605extern int pthread_mutex_lock (pthread_mutex_t *__mutex)
1606 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1607extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
1608 const struct timespec *__restrict
1609 __abstime) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1610extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
1611 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1612extern int pthread_mutex_getprioceiling (const pthread_mutex_t *
1613 __restrict __mutex,
1614 int *__restrict __prioceiling)
1615 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1616extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict __mutex,
1617 int __prioceiling,
1618 int *__restrict __old_ceiling)
1619 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3)));
1620extern int pthread_mutex_consistent (pthread_mutex_t *__mutex)
1621 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1622extern int pthread_mutexattr_init (pthread_mutexattr_t *__attr)
1623 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1624extern int pthread_mutexattr_destroy (pthread_mutexattr_t *__attr)
1625 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1626extern int pthread_mutexattr_getpshared (const pthread_mutexattr_t *
1627 __restrict __attr,
1628 int *__restrict __pshared)
1629 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1630extern int pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr,
1631 int __pshared)
1632 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1633extern int pthread_mutexattr_gettype (const pthread_mutexattr_t *__restrict
1634 __attr, int *__restrict __kind)
1635 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1636extern int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind)
1637 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1638extern int pthread_mutexattr_getprotocol (const pthread_mutexattr_t *
1639 __restrict __attr,
1640 int *__restrict __protocol)
1641 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1642extern int pthread_mutexattr_setprotocol (pthread_mutexattr_t *__attr,
1643 int __protocol)
1644 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1645extern int pthread_mutexattr_getprioceiling (const pthread_mutexattr_t *
1646 __restrict __attr,
1647 int *__restrict __prioceiling)
1648 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1649extern int pthread_mutexattr_setprioceiling (pthread_mutexattr_t *__attr,
1650 int __prioceiling)
1651 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1652extern int pthread_mutexattr_getrobust (const pthread_mutexattr_t *__attr,
1653 int *__robustness)
1654 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1655extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,
1656 int __robustness)
1657 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1658extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock,
1659 const pthread_rwlockattr_t *__restrict
1660 __attr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1661extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock)
1662 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1663extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock)
1664 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1665extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock)
1666 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1667extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
1668 const struct timespec *__restrict
1669 __abstime) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1670extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock)
1671 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1672extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock)
1673 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1674extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
1675 const struct timespec *__restrict
1676 __abstime) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1677extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock)
1678 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1679extern int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr)
1680 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1681extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr)
1682 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1683extern int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t *
1684 __restrict __attr,
1685 int *__restrict __pshared)
1686 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1687extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr,
1688 int __pshared)
1689 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1690extern int pthread_rwlockattr_getkind_np (const pthread_rwlockattr_t *
1691 __restrict __attr,
1692 int *__restrict __pref)
1693 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1694extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr,
1695 int __pref) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1696extern int pthread_cond_init (pthread_cond_t *__restrict __cond,
1697 const pthread_condattr_t *__restrict __cond_attr)
1698 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1699extern int pthread_cond_destroy (pthread_cond_t *__cond)
1700 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1701extern int pthread_cond_signal (pthread_cond_t *__cond)
1702 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1703extern int pthread_cond_broadcast (pthread_cond_t *__cond)
1704 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1705extern int pthread_cond_wait (pthread_cond_t *__restrict __cond,
1706 pthread_mutex_t *__restrict __mutex)
1707 __attribute__ ((__nonnull__ (1, 2)));
1708extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
1709 pthread_mutex_t *__restrict __mutex,
1710 const struct timespec *__restrict __abstime)
1711 __attribute__ ((__nonnull__ (1, 2, 3)));
1712extern int pthread_condattr_init (pthread_condattr_t *__attr)
1713 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1714extern int pthread_condattr_destroy (pthread_condattr_t *__attr)
1715 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1716extern int pthread_condattr_getpshared (const pthread_condattr_t *
1717 __restrict __attr,
1718 int *__restrict __pshared)
1719 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1720extern int pthread_condattr_setpshared (pthread_condattr_t *__attr,
1721 int __pshared) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1722extern int pthread_condattr_getclock (const pthread_condattr_t *
1723 __restrict __attr,
1724 __clockid_t *__restrict __clock_id)
1725 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1726extern int pthread_condattr_setclock (pthread_condattr_t *__attr,
1727 __clockid_t __clock_id)
1728 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1729extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared)
1730 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1731extern int pthread_spin_destroy (pthread_spinlock_t *__lock)
1732 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1733extern int pthread_spin_lock (pthread_spinlock_t *__lock)
1734 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1735extern int pthread_spin_trylock (pthread_spinlock_t *__lock)
1736 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1737extern int pthread_spin_unlock (pthread_spinlock_t *__lock)
1738 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1739extern int pthread_barrier_init (pthread_barrier_t *__restrict __barrier,
1740 const pthread_barrierattr_t *__restrict
1741 __attr, unsigned int __count)
1742 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1743extern int pthread_barrier_destroy (pthread_barrier_t *__barrier)
1744 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1745extern int pthread_barrier_wait (pthread_barrier_t *__barrier)
1746 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1747extern int pthread_barrierattr_init (pthread_barrierattr_t *__attr)
1748 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1749extern int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr)
1750 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1751extern int pthread_barrierattr_getpshared (const pthread_barrierattr_t *
1752 __restrict __attr,
1753 int *__restrict __pshared)
1754 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1755extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr,
1756 int __pshared)
1757 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1758extern int pthread_key_create (pthread_key_t *__key,
1759 void (*__destr_function) (void *))
1760 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1761extern int pthread_key_delete (pthread_key_t __key) __attribute__ ((__nothrow__ , __leaf__));
1762extern void *pthread_getspecific (pthread_key_t __key) __attribute__ ((__nothrow__ , __leaf__));
1763extern int pthread_setspecific (pthread_key_t __key,
1764 const void *__pointer) __attribute__ ((__nothrow__ , __leaf__)) ;
1765extern int pthread_getcpuclockid (pthread_t __thread_id,
1766 __clockid_t *__clock_id)
1767 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
1768extern int pthread_atfork (void (*__prepare) (void),
1769 void (*__parent) (void),
1770 void (*__child) (void)) __attribute__ ((__nothrow__ , __leaf__));
1771
1772typedef struct SafeStackItem
1773{
1774 volatile int Value;
1775 int Next;
1776} SafeStackItem;
1777typedef struct SafeStack
1778{
1779 SafeStackItem array[3];
1780 int head;
1781 int count;
1782} SafeStack;
1783pthread_t threads[3];
1784SafeStack stack;
1785void atomic_store(int *obj, int v)
1786{
1787 __VERIFIER_atomic_begin();
1788 *obj = v;
1789 __VERIFIER_atomic_end();
1790}
1791int atomic_load(int *obj)
1792{
1793 return *obj;
1794}
1795int atomic_exchange(int *obj, int v)
1796{
1797 __VERIFIER_atomic_begin();
1798 int t = *obj;
1799 *obj = v;
1800 __VERIFIER_atomic_end();
1801 return t;
1802}
1803_Bool atomic_compare_and_exchange(int *obj, int *expected, int desired)
1804{
1805 _Bool ret = 0;
1806 __VERIFIER_atomic_begin();
1807 if(*obj == *expected)
1808 {
1809 *obj = desired;
1810 ret = 1;
1811 }
1812 else
1813 {
1814 *expected = *obj;
1815 ret = 0;
1816 }
1817 __VERIFIER_atomic_end();
1818 return ret;
1819}
1820int atomic_fetch_add(int * obj, int v)
1821{
1822 __VERIFIER_atomic_begin();
1823 int old = *obj;
1824 *obj = *obj + v;
1825 __VERIFIER_atomic_end();
1826 return old;
1827}
1828int atomic_fetch_sub(int * obj, int v)
1829{
1830 __VERIFIER_atomic_begin();
1831 int old = *obj;
1832 *obj = *obj - v;
1833 __VERIFIER_atomic_end();
1834 return old;
1835}
1836void Init(int pushCount)
1837{
1838 int i;
1839 atomic_store(&stack.count, pushCount);
1840 atomic_store(&stack.head, 0);
1841 for (i = 0; i < pushCount - 1; i++)
1842 {
1843 atomic_store(&stack.array[i].Next, i + 1);
1844 }
1845 atomic_store(&stack.array[pushCount - 1].Next, -1);
1846}
1847int Pop(void)
1848{
1849 while (atomic_load(&stack.count) > 1)
1850 {
1851 int head1 = atomic_load(&stack.head);
1852 int next1 = atomic_exchange(&stack.array[head1].Next, -1);
1853 if (next1 >= 0)
1854 {
1855 int head2 = head1;
1856 if (atomic_compare_and_exchange(&stack.head, &head2, next1))
1857 {
1858 atomic_fetch_sub(&stack.count, 1);
1859 return head1;
1860 }
1861 else
1862 {
1863 atomic_exchange(&stack.array[head1].Next, next1);
1864 }
1865 }
1866 }
1867 return -1;
1868}
1869void Push(int index)
1870{
1871 int head1 = atomic_load(&stack.head);
1872 do
1873 {
1874 atomic_store(&stack.array[index].Next, head1);
1875 } while (!(atomic_compare_and_exchange(&stack.head, &head1, index)));
1876 atomic_fetch_add(&stack.count, 1);
1877}
1878void* thread(void* arg)
1879{
1880 size_t i;
1881 int idx = (int)(size_t)arg;
1882 for (i = 0; i < 2; i++)
1883 {
1884 int elem;
1885 for (;;)
1886 {
1887 elem = Pop();
1888 if (elem >= 0)
1889 break;
1890 }
1891 stack.array[elem].Value = idx;
1892 if(!(stack.array[elem].Value == idx)) __VERIFIER_error();
1893 Push(elem);
1894 }
1895 return ((void *)0);
1896}
1897int main(void)
1898{
1899 int i;
1900 Init(3);
1901 for (i = 0; i < 3; ++i) {
1902 pthread_create(&threads[i], ((void *)0), thread, (void*) i);
1903 }
1904 for (i = 0; i < 3; ++i) {
1905 pthread_join(threads[i], ((void *)0));
1906 }
1907 return 0;
1908}
Note: See TracBrowser for help on using the repository browser.