source: CIVL/examples/svcomp17/bounded_buffer_false-unreach-call.i@ beab7f2

main test-branch
Last change on this file since beab7f2 was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

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

  • Property mode set to 100644
File size: 70.4 KB
Line 
1extern void __VERIFIER_error() __attribute__ ((__noreturn__));
2extern int __VERIFIER_nondet_int(void);
3
4typedef unsigned int size_t;
5typedef unsigned char __u_char;
6typedef unsigned short int __u_short;
7typedef unsigned int __u_int;
8typedef unsigned long int __u_long;
9typedef signed char __int8_t;
10typedef unsigned char __uint8_t;
11typedef signed short int __int16_t;
12typedef unsigned short int __uint16_t;
13typedef signed int __int32_t;
14typedef unsigned int __uint32_t;
15__extension__ typedef signed long long int __int64_t;
16__extension__ typedef unsigned long long int __uint64_t;
17__extension__ typedef long long int __quad_t;
18__extension__ typedef unsigned long long int __u_quad_t;
19__extension__ typedef __u_quad_t __dev_t;
20__extension__ typedef unsigned int __uid_t;
21__extension__ typedef unsigned int __gid_t;
22__extension__ typedef unsigned long int __ino_t;
23__extension__ typedef __u_quad_t __ino64_t;
24__extension__ typedef unsigned int __mode_t;
25__extension__ typedef unsigned int __nlink_t;
26__extension__ typedef long int __off_t;
27__extension__ typedef __quad_t __off64_t;
28__extension__ typedef int __pid_t;
29__extension__ typedef struct { int __val[2]; } __fsid_t;
30__extension__ typedef long int __clock_t;
31__extension__ typedef unsigned long int __rlim_t;
32__extension__ typedef __u_quad_t __rlim64_t;
33__extension__ typedef unsigned int __id_t;
34__extension__ typedef long int __time_t;
35__extension__ typedef unsigned int __useconds_t;
36__extension__ typedef long int __suseconds_t;
37__extension__ typedef int __daddr_t;
38__extension__ typedef int __key_t;
39__extension__ typedef int __clockid_t;
40__extension__ typedef void * __timer_t;
41__extension__ typedef long int __blksize_t;
42__extension__ typedef long int __blkcnt_t;
43__extension__ typedef __quad_t __blkcnt64_t;
44__extension__ typedef unsigned long int __fsblkcnt_t;
45__extension__ typedef __u_quad_t __fsblkcnt64_t;
46__extension__ typedef unsigned long int __fsfilcnt_t;
47__extension__ typedef __u_quad_t __fsfilcnt64_t;
48__extension__ typedef int __fsword_t;
49__extension__ typedef int __ssize_t;
50__extension__ typedef long int __syscall_slong_t;
51__extension__ typedef unsigned long int __syscall_ulong_t;
52typedef __off64_t __loff_t;
53typedef __quad_t *__qaddr_t;
54typedef char *__caddr_t;
55__extension__ typedef int __intptr_t;
56__extension__ typedef unsigned int __socklen_t;
57struct _IO_FILE;
58
59typedef struct _IO_FILE FILE;
60
61
62typedef struct _IO_FILE __FILE;
63typedef struct
64{
65 int __count;
66 union
67 {
68 unsigned int __wch;
69 char __wchb[4];
70 } __value;
71} __mbstate_t;
72typedef struct
73{
74 __off_t __pos;
75 __mbstate_t __state;
76} _G_fpos_t;
77typedef struct
78{
79 __off64_t __pos;
80 __mbstate_t __state;
81} _G_fpos64_t;
82typedef __builtin_va_list __gnuc_va_list;
83struct _IO_jump_t; struct _IO_FILE;
84typedef void _IO_lock_t;
85struct _IO_marker {
86 struct _IO_marker *_next;
87 struct _IO_FILE *_sbuf;
88 int _pos;
89};
90enum __codecvt_result
91{
92 __codecvt_ok,
93 __codecvt_partial,
94 __codecvt_error,
95 __codecvt_noconv
96};
97struct _IO_FILE {
98 int _flags;
99 char* _IO_read_ptr;
100 char* _IO_read_end;
101 char* _IO_read_base;
102 char* _IO_write_base;
103 char* _IO_write_ptr;
104 char* _IO_write_end;
105 char* _IO_buf_base;
106 char* _IO_buf_end;
107 char *_IO_save_base;
108 char *_IO_backup_base;
109 char *_IO_save_end;
110 struct _IO_marker *_markers;
111 struct _IO_FILE *_chain;
112 int _fileno;
113 int _flags2;
114 __off_t _old_offset;
115 unsigned short _cur_column;
116 signed char _vtable_offset;
117 char _shortbuf[1];
118 _IO_lock_t *_lock;
119 __off64_t _offset;
120 void *__pad1;
121 void *__pad2;
122 void *__pad3;
123 void *__pad4;
124 size_t __pad5;
125 int _mode;
126 char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)];
127};
128typedef struct _IO_FILE _IO_FILE;
129struct _IO_FILE_plus;
130extern struct _IO_FILE_plus _IO_2_1_stdin_;
131extern struct _IO_FILE_plus _IO_2_1_stdout_;
132extern struct _IO_FILE_plus _IO_2_1_stderr_;
133typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);
134typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf,
135 size_t __n);
136typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w);
137typedef int __io_close_fn (void *__cookie);
138extern int __underflow (_IO_FILE *);
139extern int __uflow (_IO_FILE *);
140extern int __overflow (_IO_FILE *, int);
141extern int _IO_getc (_IO_FILE *__fp);
142extern int _IO_putc (int __c, _IO_FILE *__fp);
143extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__));
144extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__));
145extern int _IO_peekc_locked (_IO_FILE *__fp);
146extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
147extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
148extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
149extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
150 __gnuc_va_list, int *__restrict);
151extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
152 __gnuc_va_list);
153extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t);
154extern size_t _IO_sgetn (_IO_FILE *, void *, size_t);
155extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int);
156extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int);
157extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
158typedef __gnuc_va_list va_list;
159typedef __off_t off_t;
160typedef __ssize_t ssize_t;
161
162typedef _G_fpos_t fpos_t;
163
164extern struct _IO_FILE *stdin;
165extern struct _IO_FILE *stdout;
166extern struct _IO_FILE *stderr;
167
168extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__));
169extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__));
170
171extern int renameat (int __oldfd, const char *__old, int __newfd,
172 const char *__new) __attribute__ ((__nothrow__ , __leaf__));
173
174extern FILE *tmpfile (void) ;
175extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ;
176
177extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ;
178extern char *tempnam (const char *__dir, const char *__pfx)
179 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ;
180
181extern int fclose (FILE *__stream);
182extern int fflush (FILE *__stream);
183
184extern int fflush_unlocked (FILE *__stream);
185
186extern FILE *fopen (const char *__restrict __filename,
187 const char *__restrict __modes) ;
188extern FILE *freopen (const char *__restrict __filename,
189 const char *__restrict __modes,
190 FILE *__restrict __stream) ;
191
192extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ;
193extern FILE *fmemopen (void *__s, size_t __len, const char *__modes)
194 __attribute__ ((__nothrow__ , __leaf__)) ;
195extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ;
196
197extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__));
198extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
199 int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__));
200
201extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
202 size_t __size) __attribute__ ((__nothrow__ , __leaf__));
203extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
204
205extern int fprintf (FILE *__restrict __stream,
206 const char *__restrict __format, ...);
207extern int printf (const char *__restrict __format, ...);
208extern int sprintf (char *__restrict __s,
209 const char *__restrict __format, ...) __attribute__ ((__nothrow__));
210extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
211 __gnuc_va_list __arg);
212extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
213extern int vsprintf (char *__restrict __s, const char *__restrict __format,
214 __gnuc_va_list __arg) __attribute__ ((__nothrow__));
215
216
217extern int snprintf (char *__restrict __s, size_t __maxlen,
218 const char *__restrict __format, ...)
219 __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4)));
220extern int vsnprintf (char *__restrict __s, size_t __maxlen,
221 const char *__restrict __format, __gnuc_va_list __arg)
222 __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0)));
223
224extern int vdprintf (int __fd, const char *__restrict __fmt,
225 __gnuc_va_list __arg)
226 __attribute__ ((__format__ (__printf__, 2, 0)));
227extern int dprintf (int __fd, const char *__restrict __fmt, ...)
228 __attribute__ ((__format__ (__printf__, 2, 3)));
229
230extern int fscanf (FILE *__restrict __stream,
231 const char *__restrict __format, ...) ;
232extern int scanf (const char *__restrict __format, ...) ;
233extern int sscanf (const char *__restrict __s,
234 const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__));
235extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") ;
236extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") ;
237extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__));
238
239
240extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
241 __gnuc_va_list __arg)
242 __attribute__ ((__format__ (__scanf__, 2, 0))) ;
243extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)
244 __attribute__ ((__format__ (__scanf__, 1, 0))) ;
245extern int vsscanf (const char *__restrict __s,
246 const char *__restrict __format, __gnuc_va_list __arg)
247 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0)));
248extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf")
249 __attribute__ ((__format__ (__scanf__, 2, 0))) ;
250extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf")
251 __attribute__ ((__format__ (__scanf__, 1, 0))) ;
252extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__))
253 __attribute__ ((__format__ (__scanf__, 2, 0)));
254
255
256extern int fgetc (FILE *__stream);
257extern int getc (FILE *__stream);
258extern int getchar (void);
259
260extern int getc_unlocked (FILE *__stream);
261extern int getchar_unlocked (void);
262extern int fgetc_unlocked (FILE *__stream);
263
264extern int fputc (int __c, FILE *__stream);
265extern int putc (int __c, FILE *__stream);
266extern int putchar (int __c);
267
268extern int fputc_unlocked (int __c, FILE *__stream);
269extern int putc_unlocked (int __c, FILE *__stream);
270extern int putchar_unlocked (int __c);
271extern int getw (FILE *__stream);
272extern int putw (int __w, FILE *__stream);
273
274extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
275 ;
276
277extern __ssize_t __getdelim (char **__restrict __lineptr,
278 size_t *__restrict __n, int __delimiter,
279 FILE *__restrict __stream) ;
280extern __ssize_t getdelim (char **__restrict __lineptr,
281 size_t *__restrict __n, int __delimiter,
282 FILE *__restrict __stream) ;
283extern __ssize_t getline (char **__restrict __lineptr,
284 size_t *__restrict __n,
285 FILE *__restrict __stream) ;
286
287extern int fputs (const char *__restrict __s, FILE *__restrict __stream);
288extern int puts (const char *__s);
289extern int ungetc (int __c, FILE *__stream);
290extern size_t fread (void *__restrict __ptr, size_t __size,
291 size_t __n, FILE *__restrict __stream) ;
292extern size_t fwrite (const void *__restrict __ptr, size_t __size,
293 size_t __n, FILE *__restrict __s);
294
295extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
296 size_t __n, FILE *__restrict __stream) ;
297extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size,
298 size_t __n, FILE *__restrict __stream);
299
300extern int fseek (FILE *__stream, long int __off, int __whence);
301extern long int ftell (FILE *__stream) ;
302extern void rewind (FILE *__stream);
303
304extern int fseeko (FILE *__stream, __off_t __off, int __whence);
305extern __off_t ftello (FILE *__stream) ;
306
307extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);
308extern int fsetpos (FILE *__stream, const fpos_t *__pos);
309
310
311extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
312extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
313extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
314
315extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
316extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
317extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
318
319extern void perror (const char *__s);
320
321extern int sys_nerr;
322extern const char *const sys_errlist[];
323extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
324extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
325extern FILE *popen (const char *__command, const char *__modes) ;
326extern int pclose (FILE *__stream);
327extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__));
328extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
329extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
330extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
331
332typedef long int wchar_t;
333
334typedef enum
335{
336 P_ALL,
337 P_PID,
338 P_PGID
339} idtype_t;
340static __inline unsigned int
341__bswap_32 (unsigned int __bsx)
342{
343 return __builtin_bswap32 (__bsx);
344}
345static __inline __uint64_t
346__bswap_64 (__uint64_t __bsx)
347{
348 return __builtin_bswap64 (__bsx);
349}
350union wait
351 {
352 int w_status;
353 struct
354 {
355 unsigned int __w_termsig:7;
356 unsigned int __w_coredump:1;
357 unsigned int __w_retcode:8;
358 unsigned int:16;
359 } __wait_terminated;
360 struct
361 {
362 unsigned int __w_stopval:8;
363 unsigned int __w_stopsig:8;
364 unsigned int:16;
365 } __wait_stopped;
366 };
367typedef union
368 {
369 union wait *__uptr;
370 int *__iptr;
371 } __WAIT_STATUS __attribute__ ((__transparent_union__));
372
373typedef struct
374 {
375 int quot;
376 int rem;
377 } div_t;
378typedef struct
379 {
380 long int quot;
381 long int rem;
382 } ldiv_t;
383
384
385__extension__ typedef struct
386 {
387 long long int quot;
388 long long int rem;
389 } lldiv_t;
390
391extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ;
392
393extern double atof (const char *__nptr)
394 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
395extern int atoi (const char *__nptr)
396 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
397extern long int atol (const char *__nptr)
398 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
399
400
401__extension__ extern long long int atoll (const char *__nptr)
402 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
403
404
405extern double strtod (const char *__restrict __nptr,
406 char **__restrict __endptr)
407 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
408
409
410extern float strtof (const char *__restrict __nptr,
411 char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
412extern long double strtold (const char *__restrict __nptr,
413 char **__restrict __endptr)
414 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
415
416
417extern long int strtol (const char *__restrict __nptr,
418 char **__restrict __endptr, int __base)
419 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
420extern unsigned long int strtoul (const char *__restrict __nptr,
421 char **__restrict __endptr, int __base)
422 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
423
424__extension__
425extern long long int strtoq (const char *__restrict __nptr,
426 char **__restrict __endptr, int __base)
427 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
428__extension__
429extern unsigned long long int strtouq (const char *__restrict __nptr,
430 char **__restrict __endptr, int __base)
431 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
432
433__extension__
434extern long long int strtoll (const char *__restrict __nptr,
435 char **__restrict __endptr, int __base)
436 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
437__extension__
438extern unsigned long long int strtoull (const char *__restrict __nptr,
439 char **__restrict __endptr, int __base)
440 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
441
442extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ;
443extern long int a64l (const char *__s)
444 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
445
446typedef __u_char u_char;
447typedef __u_short u_short;
448typedef __u_int u_int;
449typedef __u_long u_long;
450typedef __quad_t quad_t;
451typedef __u_quad_t u_quad_t;
452typedef __fsid_t fsid_t;
453typedef __loff_t loff_t;
454typedef __ino_t ino_t;
455typedef __dev_t dev_t;
456typedef __gid_t gid_t;
457typedef __mode_t mode_t;
458typedef __nlink_t nlink_t;
459typedef __uid_t uid_t;
460typedef __pid_t pid_t;
461typedef __id_t id_t;
462typedef __daddr_t daddr_t;
463typedef __caddr_t caddr_t;
464typedef __key_t key_t;
465
466typedef __clock_t clock_t;
467
468
469
470typedef __time_t time_t;
471
472
473typedef __clockid_t clockid_t;
474typedef __timer_t timer_t;
475typedef unsigned long int ulong;
476typedef unsigned short int ushort;
477typedef unsigned int uint;
478typedef int int8_t __attribute__ ((__mode__ (__QI__)));
479typedef int int16_t __attribute__ ((__mode__ (__HI__)));
480typedef int int32_t __attribute__ ((__mode__ (__SI__)));
481typedef int int64_t __attribute__ ((__mode__ (__DI__)));
482typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__)));
483typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__)));
484typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__)));
485typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__)));
486typedef int register_t __attribute__ ((__mode__ (__word__)));
487typedef int __sig_atomic_t;
488typedef struct
489 {
490 unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))];
491 } __sigset_t;
492typedef __sigset_t sigset_t;
493struct timespec
494 {
495 __time_t tv_sec;
496 __syscall_slong_t tv_nsec;
497 };
498struct timeval
499 {
500 __time_t tv_sec;
501 __suseconds_t tv_usec;
502 };
503typedef __suseconds_t suseconds_t;
504typedef long int __fd_mask;
505typedef struct
506 {
507 __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))];
508 } fd_set;
509typedef __fd_mask fd_mask;
510
511extern int select (int __nfds, fd_set *__restrict __readfds,
512 fd_set *__restrict __writefds,
513 fd_set *__restrict __exceptfds,
514 struct timeval *__restrict __timeout);
515extern int pselect (int __nfds, fd_set *__restrict __readfds,
516 fd_set *__restrict __writefds,
517 fd_set *__restrict __exceptfds,
518 const struct timespec *__restrict __timeout,
519 const __sigset_t *__restrict __sigmask);
520
521
522__extension__
523extern unsigned int gnu_dev_major (unsigned long long int __dev)
524 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
525__extension__
526extern unsigned int gnu_dev_minor (unsigned long long int __dev)
527 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
528__extension__
529extern unsigned long long int gnu_dev_makedev (unsigned int __major,
530 unsigned int __minor)
531 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
532
533typedef __blksize_t blksize_t;
534typedef __blkcnt_t blkcnt_t;
535typedef __fsblkcnt_t fsblkcnt_t;
536typedef __fsfilcnt_t fsfilcnt_t;
537typedef unsigned long int pthread_t;
538union pthread_attr_t
539{
540 char __size[36];
541 long int __align;
542};
543typedef union pthread_attr_t pthread_attr_t;
544typedef struct __pthread_internal_slist
545{
546 struct __pthread_internal_slist *__next;
547} __pthread_slist_t;
548typedef union
549{
550 struct __pthread_mutex_s
551 {
552 int __lock;
553 unsigned int __count;
554 int __owner;
555 int __kind;
556 unsigned int __nusers;
557 __extension__ union
558 {
559 struct
560 {
561 short __espins;
562 short __elision;
563 } __elision_data;
564 __pthread_slist_t __list;
565 };
566 } __data;
567 char __size[24];
568 long int __align;
569} pthread_mutex_t;
570typedef union
571{
572 char __size[4];
573 int __align;
574} pthread_mutexattr_t;
575typedef union
576{
577 struct
578 {
579 int __lock;
580 unsigned int __futex;
581 __extension__ unsigned long long int __total_seq;
582 __extension__ unsigned long long int __wakeup_seq;
583 __extension__ unsigned long long int __woken_seq;
584 void *__mutex;
585 unsigned int __nwaiters;
586 unsigned int __broadcast_seq;
587 } __data;
588 char __size[48];
589 __extension__ long long int __align;
590} pthread_cond_t;
591typedef union
592{
593 char __size[4];
594 int __align;
595} pthread_condattr_t;
596typedef unsigned int pthread_key_t;
597typedef int pthread_once_t;
598typedef union
599{
600 struct
601 {
602 int __lock;
603 unsigned int __nr_readers;
604 unsigned int __readers_wakeup;
605 unsigned int __writer_wakeup;
606 unsigned int __nr_readers_queued;
607 unsigned int __nr_writers_queued;
608 unsigned char __flags;
609 unsigned char __shared;
610 signed char __rwelision;
611 unsigned char __pad2;
612 int __writer;
613 } __data;
614 char __size[32];
615 long int __align;
616} pthread_rwlock_t;
617typedef union
618{
619 char __size[8];
620 long int __align;
621} pthread_rwlockattr_t;
622typedef volatile int pthread_spinlock_t;
623typedef union
624{
625 char __size[20];
626 long int __align;
627} pthread_barrier_t;
628typedef union
629{
630 char __size[4];
631 int __align;
632} pthread_barrierattr_t;
633
634extern long int random (void) __attribute__ ((__nothrow__ , __leaf__));
635extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__));
636extern char *initstate (unsigned int __seed, char *__statebuf,
637 size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
638extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
639struct random_data
640 {
641 int32_t *fptr;
642 int32_t *rptr;
643 int32_t *state;
644 int rand_type;
645 int rand_deg;
646 int rand_sep;
647 int32_t *end_ptr;
648 };
649extern int random_r (struct random_data *__restrict __buf,
650 int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
651extern int srandom_r (unsigned int __seed, struct random_data *__buf)
652 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
653extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
654 size_t __statelen,
655 struct random_data *__restrict __buf)
656 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4)));
657extern int setstate_r (char *__restrict __statebuf,
658 struct random_data *__restrict __buf)
659 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
660
661extern int rand (void) __attribute__ ((__nothrow__ , __leaf__));
662extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__));
663
664extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__));
665extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__));
666extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
667extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__));
668extern long int nrand48 (unsigned short int __xsubi[3])
669 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
670extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__));
671extern long int jrand48 (unsigned short int __xsubi[3])
672 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
673extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__));
674extern unsigned short int *seed48 (unsigned short int __seed16v[3])
675 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
676extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
677struct drand48_data
678 {
679 unsigned short int __x[3];
680 unsigned short int __old_x[3];
681 unsigned short int __c;
682 unsigned short int __init;
683 __extension__ unsigned long long int __a;
684 };
685extern int drand48_r (struct drand48_data *__restrict __buffer,
686 double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
687extern int erand48_r (unsigned short int __xsubi[3],
688 struct drand48_data *__restrict __buffer,
689 double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
690extern int lrand48_r (struct drand48_data *__restrict __buffer,
691 long int *__restrict __result)
692 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
693extern int nrand48_r (unsigned short int __xsubi[3],
694 struct drand48_data *__restrict __buffer,
695 long int *__restrict __result)
696 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
697extern int mrand48_r (struct drand48_data *__restrict __buffer,
698 long int *__restrict __result)
699 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
700extern int jrand48_r (unsigned short int __xsubi[3],
701 struct drand48_data *__restrict __buffer,
702 long int *__restrict __result)
703 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
704extern int srand48_r (long int __seedval, struct drand48_data *__buffer)
705 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
706extern int seed48_r (unsigned short int __seed16v[3],
707 struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
708extern int lcong48_r (unsigned short int __param[7],
709 struct drand48_data *__buffer)
710 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
711
712extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ;
713extern void *calloc (size_t __nmemb, size_t __size)
714 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ;
715
716
717extern void *realloc (void *__ptr, size_t __size)
718 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
719extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__));
720
721extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__));
722
723extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__));
724
725extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ;
726extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
727 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ;
728extern void *aligned_alloc (size_t __alignment, size_t __size)
729 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ;
730
731extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
732extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
733extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
734
735extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
736 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
737
738extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
739extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
740
741
742extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
743
744
745extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ;
746
747extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
748extern int setenv (const char *__name, const char *__value, int __replace)
749 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
750extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
751extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__));
752extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
753extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ;
754extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ;
755extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ;
756
757extern int system (const char *__command) ;
758
759extern char *realpath (const char *__restrict __name,
760 char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ;
761typedef int (*__compar_fn_t) (const void *, const void *);
762
763extern void *bsearch (const void *__key, const void *__base,
764 size_t __nmemb, size_t __size, __compar_fn_t __compar)
765 __attribute__ ((__nonnull__ (1, 2, 5))) ;
766extern void qsort (void *__base, size_t __nmemb, size_t __size,
767 __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4)));
768extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ;
769extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ;
770
771__extension__ extern long long int llabs (long long int __x)
772 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ;
773
774extern div_t div (int __numer, int __denom)
775 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ;
776extern ldiv_t ldiv (long int __numer, long int __denom)
777 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ;
778
779
780__extension__ extern lldiv_t lldiv (long long int __numer,
781 long long int __denom)
782 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ;
783
784extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt,
785 int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ;
786extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt,
787 int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ;
788extern char *gcvt (double __value, int __ndigit, char *__buf)
789 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ;
790extern char *qecvt (long double __value, int __ndigit,
791 int *__restrict __decpt, int *__restrict __sign)
792 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ;
793extern char *qfcvt (long double __value, int __ndigit,
794 int *__restrict __decpt, int *__restrict __sign)
795 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ;
796extern char *qgcvt (long double __value, int __ndigit, char *__buf)
797 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ;
798extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
799 int *__restrict __sign, char *__restrict __buf,
800 size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5)));
801extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
802 int *__restrict __sign, char *__restrict __buf,
803 size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5)));
804extern int qecvt_r (long double __value, int __ndigit,
805 int *__restrict __decpt, int *__restrict __sign,
806 char *__restrict __buf, size_t __len)
807 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5)));
808extern int qfcvt_r (long double __value, int __ndigit,
809 int *__restrict __decpt, int *__restrict __sign,
810 char *__restrict __buf, size_t __len)
811 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5)));
812
813extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__));
814extern int mbtowc (wchar_t *__restrict __pwc,
815 const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__));
816extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__));
817extern size_t mbstowcs (wchar_t *__restrict __pwcs,
818 const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__));
819extern size_t wcstombs (char *__restrict __s,
820 const wchar_t *__restrict __pwcs, size_t __n)
821 __attribute__ ((__nothrow__ , __leaf__));
822
823extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ;
824extern int getsubopt (char **__restrict __optionp,
825 char *const *__restrict __tokens,
826 char **__restrict __valuep)
827 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ;
828extern int getloadavg (double __loadavg[], int __nelem)
829 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
830
831
832
833extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
834 size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
835extern void *memmove (void *__dest, const void *__src, size_t __n)
836 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
837
838extern void *memccpy (void *__restrict __dest, const void *__restrict __src,
839 int __c, size_t __n)
840 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
841
842extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
843extern int memcmp (const void *__s1, const void *__s2, size_t __n)
844 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
845extern void *memchr (const void *__s, int __c, size_t __n)
846 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
847
848
849extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
850 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
851extern char *strncpy (char *__restrict __dest,
852 const char *__restrict __src, size_t __n)
853 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
854extern char *strcat (char *__restrict __dest, const char *__restrict __src)
855 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
856extern char *strncat (char *__restrict __dest, const char *__restrict __src,
857 size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
858extern int strcmp (const char *__s1, const char *__s2)
859 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
860extern int strncmp (const char *__s1, const char *__s2, size_t __n)
861 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
862extern int strcoll (const char *__s1, const char *__s2)
863 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
864extern size_t strxfrm (char *__restrict __dest,
865 const char *__restrict __src, size_t __n)
866 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
867
868typedef struct __locale_struct
869{
870 struct __locale_data *__locales[13];
871 const unsigned short int *__ctype_b;
872 const int *__ctype_tolower;
873 const int *__ctype_toupper;
874 const char *__names[13];
875} *__locale_t;
876typedef __locale_t locale_t;
877extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l)
878 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3)));
879extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n,
880 __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4)));
881extern char *strdup (const char *__s)
882 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1)));
883extern char *strndup (const char *__string, size_t __n)
884 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1)));
885
886extern char *strchr (const char *__s, int __c)
887 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
888extern char *strrchr (const char *__s, int __c)
889 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
890
891
892extern size_t strcspn (const char *__s, const char *__reject)
893 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
894extern size_t strspn (const char *__s, const char *__accept)
895 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
896extern char *strpbrk (const char *__s, const char *__accept)
897 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
898extern char *strstr (const char *__haystack, const char *__needle)
899 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
900extern char *strtok (char *__restrict __s, const char *__restrict __delim)
901 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
902
903extern char *__strtok_r (char *__restrict __s,
904 const char *__restrict __delim,
905 char **__restrict __save_ptr)
906 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3)));
907extern char *strtok_r (char *__restrict __s, const char *__restrict __delim,
908 char **__restrict __save_ptr)
909 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3)));
910
911extern size_t strlen (const char *__s)
912 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
913
914extern size_t strnlen (const char *__string, size_t __maxlen)
915 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
916
917extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__));
918
919extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
920extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__));
921extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
922extern void bcopy (const void *__src, void *__dest, size_t __n)
923 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
924extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
925extern int bcmp (const void *__s1, const void *__s2, size_t __n)
926 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
927extern char *index (const char *__s, int __c)
928 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
929extern char *rindex (const char *__s, int __c)
930 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
931extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
932extern int strcasecmp (const char *__s1, const char *__s2)
933 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
934extern int strncasecmp (const char *__s1, const char *__s2, size_t __n)
935 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
936extern char *strsep (char **__restrict __stringp,
937 const char *__restrict __delim)
938 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
939extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__));
940extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src)
941 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
942extern char *stpcpy (char *__restrict __dest, const char *__restrict __src)
943 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
944extern char *__stpncpy (char *__restrict __dest,
945 const char *__restrict __src, size_t __n)
946 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
947extern char *stpncpy (char *__restrict __dest,
948 const char *__restrict __src, size_t __n)
949 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
950
951
952extern int *__errno_location (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
953
954struct sched_param
955 {
956 int __sched_priority;
957 };
958
959
960struct __sched_param
961 {
962 int __sched_priority;
963 };
964typedef unsigned long int __cpu_mask;
965typedef struct
966{
967 __cpu_mask __bits[1024 / (8 * sizeof (__cpu_mask))];
968} cpu_set_t;
969
970extern int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp)
971 __attribute__ ((__nothrow__ , __leaf__));
972extern cpu_set_t *__sched_cpualloc (size_t __count) __attribute__ ((__nothrow__ , __leaf__)) ;
973extern void __sched_cpufree (cpu_set_t *__set) __attribute__ ((__nothrow__ , __leaf__));
974
975
976extern int sched_setparam (__pid_t __pid, const struct sched_param *__param)
977 __attribute__ ((__nothrow__ , __leaf__));
978extern int sched_getparam (__pid_t __pid, struct sched_param *__param) __attribute__ ((__nothrow__ , __leaf__));
979extern int sched_setscheduler (__pid_t __pid, int __policy,
980 const struct sched_param *__param) __attribute__ ((__nothrow__ , __leaf__));
981extern int sched_getscheduler (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__));
982extern int sched_yield (void) __attribute__ ((__nothrow__ , __leaf__));
983extern int sched_get_priority_max (int __algorithm) __attribute__ ((__nothrow__ , __leaf__));
984extern int sched_get_priority_min (int __algorithm) __attribute__ ((__nothrow__ , __leaf__));
985extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __attribute__ ((__nothrow__ , __leaf__));
986
987
988
989struct tm
990{
991 int tm_sec;
992 int tm_min;
993 int tm_hour;
994 int tm_mday;
995 int tm_mon;
996 int tm_year;
997 int tm_wday;
998 int tm_yday;
999 int tm_isdst;
1000 long int tm_gmtoff;
1001 const char *tm_zone;
1002};
1003
1004
1005struct itimerspec
1006 {
1007 struct timespec it_interval;
1008 struct timespec it_value;
1009 };
1010struct sigevent;
1011
1012extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__));
1013extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__));
1014extern double difftime (time_t __time1, time_t __time0)
1015 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
1016extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__));
1017extern size_t strftime (char *__restrict __s, size_t __maxsize,
1018 const char *__restrict __format,
1019 const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__));
1020
1021extern size_t strftime_l (char *__restrict __s, size_t __maxsize,
1022 const char *__restrict __format,
1023 const struct tm *__restrict __tp,
1024 __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__));
1025
1026extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__));
1027extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__));
1028
1029extern struct tm *gmtime_r (const time_t *__restrict __timer,
1030 struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__));
1031extern struct tm *localtime_r (const time_t *__restrict __timer,
1032 struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__));
1033
1034extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__));
1035extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__));
1036
1037extern char *asctime_r (const struct tm *__restrict __tp,
1038 char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__));
1039extern char *ctime_r (const time_t *__restrict __timer,
1040 char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__));
1041extern char *__tzname[2];
1042extern int __daylight;
1043extern long int __timezone;
1044extern char *tzname[2];
1045extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__));
1046extern int daylight;
1047extern long int timezone;
1048extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__));
1049extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__));
1050extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__));
1051extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
1052extern int nanosleep (const struct timespec *__requested_time,
1053 struct timespec *__remaining);
1054extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__));
1055extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__));
1056extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp)
1057 __attribute__ ((__nothrow__ , __leaf__));
1058extern int clock_nanosleep (clockid_t __clock_id, int __flags,
1059 const struct timespec *__req,
1060 struct timespec *__rem);
1061extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__));
1062extern int timer_create (clockid_t __clock_id,
1063 struct sigevent *__restrict __evp,
1064 timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__));
1065extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__));
1066extern int timer_settime (timer_t __timerid, int __flags,
1067 const struct itimerspec *__restrict __value,
1068 struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__));
1069extern int timer_gettime (timer_t __timerid, struct itimerspec *__value)
1070 __attribute__ ((__nothrow__ , __leaf__));
1071extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__));
1072extern int timespec_get (struct timespec *__ts, int __base)
1073 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1074
1075typedef int __jmp_buf[6];
1076enum
1077{
1078 PTHREAD_CREATE_JOINABLE,
1079 PTHREAD_CREATE_DETACHED
1080};
1081enum
1082{
1083 PTHREAD_MUTEX_TIMED_NP,
1084 PTHREAD_MUTEX_RECURSIVE_NP,
1085 PTHREAD_MUTEX_ERRORCHECK_NP,
1086 PTHREAD_MUTEX_ADAPTIVE_NP
1087 ,
1088 PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_TIMED_NP,
1089 PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP,
1090 PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP,
1091 PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
1092};
1093enum
1094{
1095 PTHREAD_MUTEX_STALLED,
1096 PTHREAD_MUTEX_STALLED_NP = PTHREAD_MUTEX_STALLED,
1097 PTHREAD_MUTEX_ROBUST,
1098 PTHREAD_MUTEX_ROBUST_NP = PTHREAD_MUTEX_ROBUST
1099};
1100enum
1101{
1102 PTHREAD_PRIO_NONE,
1103 PTHREAD_PRIO_INHERIT,
1104 PTHREAD_PRIO_PROTECT
1105};
1106enum
1107{
1108 PTHREAD_RWLOCK_PREFER_READER_NP,
1109 PTHREAD_RWLOCK_PREFER_WRITER_NP,
1110 PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP,
1111 PTHREAD_RWLOCK_DEFAULT_NP = PTHREAD_RWLOCK_PREFER_READER_NP
1112};
1113enum
1114{
1115 PTHREAD_INHERIT_SCHED,
1116 PTHREAD_EXPLICIT_SCHED
1117};
1118enum
1119{
1120 PTHREAD_SCOPE_SYSTEM,
1121 PTHREAD_SCOPE_PROCESS
1122};
1123enum
1124{
1125 PTHREAD_PROCESS_PRIVATE,
1126 PTHREAD_PROCESS_SHARED
1127};
1128struct _pthread_cleanup_buffer
1129{
1130 void (*__routine) (void *);
1131 void *__arg;
1132 int __canceltype;
1133 struct _pthread_cleanup_buffer *__prev;
1134};
1135enum
1136{
1137 PTHREAD_CANCEL_ENABLE,
1138 PTHREAD_CANCEL_DISABLE
1139};
1140enum
1141{
1142 PTHREAD_CANCEL_DEFERRED,
1143 PTHREAD_CANCEL_ASYNCHRONOUS
1144};
1145
1146extern int pthread_create (pthread_t *__restrict __newthread,
1147 const pthread_attr_t *__restrict __attr,
1148 void *(*__start_routine) (void *),
1149 void *__restrict __arg) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 3)));
1150extern void pthread_exit (void *__retval) __attribute__ ((__noreturn__));
1151extern int pthread_join (pthread_t __th, void **__thread_return);
1152extern int pthread_detach (pthread_t __th) __attribute__ ((__nothrow__ , __leaf__));
1153extern pthread_t pthread_self (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
1154extern int pthread_equal (pthread_t __thread1, pthread_t __thread2)
1155 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
1156extern int pthread_attr_init (pthread_attr_t *__attr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1157extern int pthread_attr_destroy (pthread_attr_t *__attr)
1158 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1159extern int pthread_attr_getdetachstate (const pthread_attr_t *__attr,
1160 int *__detachstate)
1161 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1162extern int pthread_attr_setdetachstate (pthread_attr_t *__attr,
1163 int __detachstate)
1164 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1165extern int pthread_attr_getguardsize (const pthread_attr_t *__attr,
1166 size_t *__guardsize)
1167 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1168extern int pthread_attr_setguardsize (pthread_attr_t *__attr,
1169 size_t __guardsize)
1170 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1171extern int pthread_attr_getschedparam (const pthread_attr_t *__restrict __attr,
1172 struct sched_param *__restrict __param)
1173 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1174extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr,
1175 const struct sched_param *__restrict
1176 __param) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1177extern int pthread_attr_getschedpolicy (const pthread_attr_t *__restrict
1178 __attr, int *__restrict __policy)
1179 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1180extern int pthread_attr_setschedpolicy (pthread_attr_t *__attr, int __policy)
1181 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1182extern int pthread_attr_getinheritsched (const pthread_attr_t *__restrict
1183 __attr, int *__restrict __inherit)
1184 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1185extern int pthread_attr_setinheritsched (pthread_attr_t *__attr,
1186 int __inherit)
1187 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1188extern int pthread_attr_getscope (const pthread_attr_t *__restrict __attr,
1189 int *__restrict __scope)
1190 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1191extern int pthread_attr_setscope (pthread_attr_t *__attr, int __scope)
1192 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1193extern int pthread_attr_getstackaddr (const pthread_attr_t *__restrict
1194 __attr, void **__restrict __stackaddr)
1195 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) __attribute__ ((__deprecated__));
1196extern int pthread_attr_setstackaddr (pthread_attr_t *__attr,
1197 void *__stackaddr)
1198 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__));
1199extern int pthread_attr_getstacksize (const pthread_attr_t *__restrict
1200 __attr, size_t *__restrict __stacksize)
1201 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1202extern int pthread_attr_setstacksize (pthread_attr_t *__attr,
1203 size_t __stacksize)
1204 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1205extern int pthread_attr_getstack (const pthread_attr_t *__restrict __attr,
1206 void **__restrict __stackaddr,
1207 size_t *__restrict __stacksize)
1208 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3)));
1209extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr,
1210 size_t __stacksize) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1211extern int pthread_setschedparam (pthread_t __target_thread, int __policy,
1212 const struct sched_param *__param)
1213 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3)));
1214extern int pthread_getschedparam (pthread_t __target_thread,
1215 int *__restrict __policy,
1216 struct sched_param *__restrict __param)
1217 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3)));
1218extern int pthread_setschedprio (pthread_t __target_thread, int __prio)
1219 __attribute__ ((__nothrow__ , __leaf__));
1220extern int pthread_once (pthread_once_t *__once_control,
1221 void (*__init_routine) (void)) __attribute__ ((__nonnull__ (1, 2)));
1222extern int pthread_setcancelstate (int __state, int *__oldstate);
1223extern int pthread_setcanceltype (int __type, int *__oldtype);
1224extern int pthread_cancel (pthread_t __th);
1225extern void pthread_testcancel (void);
1226typedef struct
1227{
1228 struct
1229 {
1230 __jmp_buf __cancel_jmp_buf;
1231 int __mask_was_saved;
1232 } __cancel_jmp_buf[1];
1233 void *__pad[4];
1234} __pthread_unwind_buf_t __attribute__ ((__aligned__));
1235struct __pthread_cleanup_frame
1236{
1237 void (*__cancel_routine) (void *);
1238 void *__cancel_arg;
1239 int __do_it;
1240 int __cancel_type;
1241};
1242extern void __pthread_register_cancel (__pthread_unwind_buf_t *__buf)
1243 __attribute__ ((__regparm__ (1)));
1244extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf)
1245 __attribute__ ((__regparm__ (1)));
1246extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf)
1247 __attribute__ ((__regparm__ (1))) __attribute__ ((__noreturn__))
1248 __attribute__ ((__weak__))
1249 ;
1250struct __jmp_buf_tag;
1251extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __attribute__ ((__nothrow__));
1252extern int pthread_mutex_init (pthread_mutex_t *__mutex,
1253 const pthread_mutexattr_t *__mutexattr)
1254 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1255extern int pthread_mutex_destroy (pthread_mutex_t *__mutex)
1256 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1257extern int pthread_mutex_trylock (pthread_mutex_t *__mutex)
1258 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1259extern int pthread_mutex_lock (pthread_mutex_t *__mutex)
1260 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1261extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
1262 const struct timespec *__restrict
1263 __abstime) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1264extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
1265 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1266extern int pthread_mutex_getprioceiling (const pthread_mutex_t *
1267 __restrict __mutex,
1268 int *__restrict __prioceiling)
1269 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1270extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict __mutex,
1271 int __prioceiling,
1272 int *__restrict __old_ceiling)
1273 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3)));
1274extern int pthread_mutex_consistent (pthread_mutex_t *__mutex)
1275 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1276extern int pthread_mutexattr_init (pthread_mutexattr_t *__attr)
1277 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1278extern int pthread_mutexattr_destroy (pthread_mutexattr_t *__attr)
1279 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1280extern int pthread_mutexattr_getpshared (const pthread_mutexattr_t *
1281 __restrict __attr,
1282 int *__restrict __pshared)
1283 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1284extern int pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr,
1285 int __pshared)
1286 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1287extern int pthread_mutexattr_gettype (const pthread_mutexattr_t *__restrict
1288 __attr, int *__restrict __kind)
1289 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1290extern int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind)
1291 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1292extern int pthread_mutexattr_getprotocol (const pthread_mutexattr_t *
1293 __restrict __attr,
1294 int *__restrict __protocol)
1295 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1296extern int pthread_mutexattr_setprotocol (pthread_mutexattr_t *__attr,
1297 int __protocol)
1298 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1299extern int pthread_mutexattr_getprioceiling (const pthread_mutexattr_t *
1300 __restrict __attr,
1301 int *__restrict __prioceiling)
1302 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1303extern int pthread_mutexattr_setprioceiling (pthread_mutexattr_t *__attr,
1304 int __prioceiling)
1305 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1306extern int pthread_mutexattr_getrobust (const pthread_mutexattr_t *__attr,
1307 int *__robustness)
1308 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1309extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,
1310 int __robustness)
1311 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1312extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock,
1313 const pthread_rwlockattr_t *__restrict
1314 __attr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1315extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock)
1316 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1317extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock)
1318 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1319extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock)
1320 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1321extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
1322 const struct timespec *__restrict
1323 __abstime) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1324extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock)
1325 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1326extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock)
1327 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1328extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
1329 const struct timespec *__restrict
1330 __abstime) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
1331extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock)
1332 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1333extern int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr)
1334 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1335extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr)
1336 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1337extern int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t *
1338 __restrict __attr,
1339 int *__restrict __pshared)
1340 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1341extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr,
1342 int __pshared)
1343 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1344extern int pthread_rwlockattr_getkind_np (const pthread_rwlockattr_t *
1345 __restrict __attr,
1346 int *__restrict __pref)
1347 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1348extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr,
1349 int __pref) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1350extern int pthread_cond_init (pthread_cond_t *__restrict __cond,
1351 const pthread_condattr_t *__restrict __cond_attr)
1352 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1353extern int pthread_cond_destroy (pthread_cond_t *__cond)
1354 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1355extern int pthread_cond_signal (pthread_cond_t *__cond)
1356 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1357extern int pthread_cond_broadcast (pthread_cond_t *__cond)
1358 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1359extern int pthread_cond_wait (pthread_cond_t *__restrict __cond,
1360 pthread_mutex_t *__restrict __mutex)
1361 __attribute__ ((__nonnull__ (1, 2)));
1362extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
1363 pthread_mutex_t *__restrict __mutex,
1364 const struct timespec *__restrict __abstime)
1365 __attribute__ ((__nonnull__ (1, 2, 3)));
1366extern int pthread_condattr_init (pthread_condattr_t *__attr)
1367 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1368extern int pthread_condattr_destroy (pthread_condattr_t *__attr)
1369 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1370extern int pthread_condattr_getpshared (const pthread_condattr_t *
1371 __restrict __attr,
1372 int *__restrict __pshared)
1373 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1374extern int pthread_condattr_setpshared (pthread_condattr_t *__attr,
1375 int __pshared) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1376extern int pthread_condattr_getclock (const pthread_condattr_t *
1377 __restrict __attr,
1378 __clockid_t *__restrict __clock_id)
1379 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1380extern int pthread_condattr_setclock (pthread_condattr_t *__attr,
1381 __clockid_t __clock_id)
1382 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1383extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared)
1384 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1385extern int pthread_spin_destroy (pthread_spinlock_t *__lock)
1386 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1387extern int pthread_spin_lock (pthread_spinlock_t *__lock)
1388 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1389extern int pthread_spin_trylock (pthread_spinlock_t *__lock)
1390 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1391extern int pthread_spin_unlock (pthread_spinlock_t *__lock)
1392 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1393extern int pthread_barrier_init (pthread_barrier_t *__restrict __barrier,
1394 const pthread_barrierattr_t *__restrict
1395 __attr, unsigned int __count)
1396 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1397extern int pthread_barrier_destroy (pthread_barrier_t *__barrier)
1398 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1399extern int pthread_barrier_wait (pthread_barrier_t *__barrier)
1400 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
1401extern int pthread_barrierattr_init (pthread_barrierattr_t *__attr)
1402 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1403extern int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr)
1404 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1405extern int pthread_barrierattr_getpshared (const pthread_barrierattr_t *
1406 __restrict __attr,
1407 int *__restrict __pshared)
1408 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
1409extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr,
1410 int __pshared)
1411 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1412extern int pthread_key_create (pthread_key_t *__key,
1413 void (*__destr_function) (void *))
1414 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
1415extern int pthread_key_delete (pthread_key_t __key) __attribute__ ((__nothrow__ , __leaf__));
1416extern void *pthread_getspecific (pthread_key_t __key) __attribute__ ((__nothrow__ , __leaf__));
1417extern int pthread_setspecific (pthread_key_t __key,
1418 const void *__pointer) __attribute__ ((__nothrow__ , __leaf__)) ;
1419extern int pthread_getcpuclockid (pthread_t __thread_id,
1420 __clockid_t *__clock_id)
1421 __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
1422extern int pthread_atfork (void (*__prepare) (void),
1423 void (*__parent) (void),
1424 void (*__child) (void)) __attribute__ ((__nothrow__ , __leaf__));
1425
1426typedef struct bounded_buf_tag
1427{
1428 int valid;
1429 pthread_mutex_t mutex;
1430 pthread_cond_t not_full;
1431 pthread_cond_t not_empty;
1432 size_t item_num;
1433 size_t max_size;
1434 size_t head, rear;
1435 size_t p_wait;
1436 size_t c_wait;
1437 void ** buf;
1438}bounded_buf_t;
1439int bounded_buf_init(bounded_buf_t * bbuf, size_t sz)
1440{
1441 int status = 0;
1442 if (bbuf == ((void *)0)) return 22;
1443 bbuf->valid = 0xACDEFA;
1444 status = pthread_mutex_init(&bbuf->mutex, ((void *)0));
1445 if (status != 0) return status;
1446 status = pthread_cond_init(&bbuf->not_full, ((void *)0));
1447 if (status != 0)
1448 {
1449 pthread_mutex_destroy(&bbuf->mutex);
1450 return status;
1451 }
1452 status = pthread_cond_init(&bbuf->not_empty, ((void *)0));
1453 if (status != 0)
1454 {
1455 pthread_cond_destroy(&bbuf->not_full);
1456 pthread_mutex_destroy(&bbuf->mutex);
1457 return status;
1458 }
1459 bbuf->item_num = 0;
1460 bbuf->max_size = sz;
1461 bbuf->head = 0;
1462 bbuf->rear = 0;
1463 bbuf->buf = calloc( sz, sizeof(void*) );
1464 if (bbuf->buf == ((void *)0))
1465 {
1466 pthread_mutex_destroy(&bbuf->mutex);
1467 pthread_cond_destroy(&bbuf->not_full);
1468 pthread_cond_destroy(&bbuf->not_empty);
1469 return 12;
1470 }
1471 bbuf->head = 0;
1472 bbuf->rear = 0;
1473 bbuf->p_wait = 0;
1474 bbuf->c_wait = 0;
1475 return 0;
1476}
1477int bounded_buf_destroy(bounded_buf_t * bbuf)
1478{
1479 int status = 0, status1 = 0, status2 = 0;
1480 if (bbuf == ((void *)0) || bbuf->valid != 0xACDEFA)
1481 return 22;
1482 status = pthread_mutex_lock(&bbuf->mutex);
1483 if (status != 0) return status;
1484 bbuf->valid = 0;
1485 status = pthread_mutex_unlock(&bbuf->mutex);
1486 if (status != 0) return status;
1487 status = pthread_mutex_destroy(&bbuf->mutex);
1488 status1= pthread_cond_destroy(&bbuf->not_full);
1489 status2= pthread_cond_destroy(&bbuf->not_empty);
1490 int i;
1491 if (bbuf->rear >= bbuf->head ) {
1492 for (i = bbuf->head; i < bbuf->rear; i++) free(bbuf->buf[i]);
1493 }
1494 else{
1495 for (i = bbuf->head; i < bbuf->max_size; i++) free(bbuf->buf[i]);
1496 for (i = 0; i < bbuf->rear; i++) free(bbuf->buf[i]);
1497 }
1498 free(bbuf->buf);
1499 return (status != 0)? status:((status1 != 0)? status1 : status2);
1500}
1501void bounded_buf_putcleanup(void * arg)
1502{
1503 bounded_buf_t * bbuf = (bounded_buf_t*) arg;
1504 bbuf->p_wait--;
1505 pthread_mutex_unlock(&bbuf->mutex);
1506}
1507void bounded_buf_getcleanup(void *arg)
1508{
1509 bounded_buf_t * bbuf = (bounded_buf_t*) arg;
1510 bbuf->c_wait--;
1511 pthread_mutex_unlock(&bbuf->mutex);
1512}
1513int bounded_buf_put(bounded_buf_t * bbuf, void *item)
1514{
1515 int status = 0, status1 = 0, status2 = 0;
1516 if (bbuf == ((void *)0) || bbuf->valid != 0xACDEFA)
1517 return 22;
1518 status = pthread_mutex_lock(&bbuf->mutex);
1519 ;
1520 if (status != 0) return status;
1521 if ( (bbuf->rear + 1)% bbuf->max_size == bbuf->head )
1522 {
1523 bbuf->p_wait++;
1524 while ( (bbuf->rear + 1)% bbuf->max_size == bbuf->head ){
1525 ;
1526 status = pthread_cond_wait(&bbuf->not_full, &bbuf->mutex);
1527 if (status != 0) break;
1528 }
1529 bbuf->p_wait--;
1530 }
1531 if (status == 0){
1532 bbuf->buf[bbuf->rear]= item;
1533 bbuf->rear = (bbuf->rear+1)% (bbuf->max_size);
1534 if (bbuf->c_wait > 0){
1535 ;
1536 status1 = pthread_cond_signal(&bbuf->not_empty);
1537 }
1538 }
1539 ;
1540 status2 = pthread_mutex_unlock(&bbuf->mutex);
1541 return (status == 0)? status2 : status;
1542}
1543int bounded_buf_get(bounded_buf_t *bbuf, void **item)
1544{
1545 int status = 0,status1 = 0, status2 = 0;
1546 if (bbuf == ((void *)0) || item == ((void *)0) || bbuf->valid != 0xACDEFA)
1547 return 22;
1548 status = pthread_mutex_lock(&bbuf->mutex);
1549 ;
1550 if (status != 0) return status;
1551 if (bbuf->head == bbuf->rear)
1552 {
1553 bbuf->c_wait++;
1554 while (bbuf->head == bbuf->rear)
1555 {
1556 ;
1557 status = pthread_cond_wait(&bbuf->not_empty, &bbuf->mutex);
1558 if (status != 0) break;
1559 }
1560 bbuf->c_wait--;
1561 }
1562 ;
1563 status = pthread_mutex_unlock(&bbuf->mutex);
1564 status = pthread_mutex_lock(&bbuf->mutex);
1565 ;
1566 if (status == 0)
1567 {
1568 if(bbuf->head == bbuf->rear)
1569 {
1570 ERROR: __VERIFIER_error();
1571 }
1572 *item = bbuf->buf[bbuf->head];
1573 bbuf->head = (bbuf->head+1) % bbuf->max_size;
1574 if (bbuf->p_wait > 0){
1575 ;
1576 status1 = pthread_cond_signal(&bbuf->not_full);
1577 }
1578 }
1579 ;
1580 status2 = pthread_mutex_unlock(&bbuf->mutex);
1581 return (status != 0)? status : (status1 != 0)? status1 : status2;
1582}
1583int bounded_buf_is_empty(bounded_buf_t* bbuf)
1584{
1585 int status = 0, retval;
1586 if (bbuf == ((void *)0) || bbuf->valid != 0xACDEFA)
1587 return -1;
1588 status = pthread_mutex_lock(&bbuf->mutex);
1589 if (status != 0) return status;
1590 retval = (bbuf->rear == bbuf->head )? 1 : 0;
1591 status = pthread_mutex_unlock(&bbuf->mutex);
1592 return (status == 0)? retval : -1;
1593}
1594int bounded_buf_is_full(bounded_buf_t* bbuf)
1595{
1596 int status = 0, retval;
1597 if (bbuf == ((void *)0) || bbuf->valid != 0xACDEFA) return -1;
1598 status = pthread_mutex_lock(&bbuf->mutex);
1599 if (status != 0) return status;
1600 retval = ( (bbuf->rear + 1) % bbuf->max_size == bbuf->head )? 1 : 0;
1601 status = pthread_mutex_unlock(&bbuf->mutex);
1602 return (status == 0)? retval : -1;
1603}
1604typedef struct thread_tag
1605{
1606 pthread_t pid;
1607 int id;
1608 bounded_buf_t * bbuf;
1609}thread_t;
1610void * producer_routine(void *arg)
1611{
1612 thread_t * thread = (thread_t*) arg;
1613 int i, temp;
1614 int ch;
1615 int status = 0;
1616 for (i = 0; i < 4; i++)
1617 {
1618 ch = __VERIFIER_nondet_int();
1619 temp = ch;
1620 status = bounded_buf_put(thread->bbuf, (void*)((int)temp));
1621 if (status != 0)
1622 ;
1623 else
1624 ;
1625 fflush(stdout);
1626 }
1627 return ((void *)0);
1628}
1629void * consumer_routine(void * arg)
1630{
1631 thread_t * thread = (thread_t*) arg;
1632 int i;
1633 int ch;
1634 int status = 0;
1635 void* temp;
1636 for (i = 0; i < 4; i++)
1637 {
1638 status = bounded_buf_get(thread->bbuf, &temp);
1639 if (status != 0)
1640 ;
1641 else
1642 {
1643 ch = (char)( (int)temp );
1644 ;
1645 }
1646 fflush(stdout);
1647 }
1648 return ((void *)0);
1649}
1650int main(void)
1651{
1652 thread_t producers[2];
1653 thread_t consumers[2];
1654 int i;
1655 bounded_buf_t buffer;
1656 bounded_buf_init(&buffer, 3);
1657 for (i = 0; i < 2; i++)
1658 {
1659 producers[i].id = i;
1660 producers[i].bbuf = &buffer;
1661 pthread_create(&producers[i].pid, ((void *)0), producer_routine, (void*)&producers[i]);
1662 }
1663 for (i = 0; i < 2; i++)
1664 {
1665 consumers[i].id = i;
1666 consumers[i].bbuf = &buffer;
1667 pthread_create(&consumers[i].pid, ((void *)0), consumer_routine, (void*)&consumers[i]);
1668 }
1669 for (i = 0; i < 2; i++)
1670 pthread_join(producers[i].pid, ((void *)0));
1671 for (i = 0; i < 2; i++)
1672 pthread_join(consumers[i].pid, ((void *)0));
1673 bounded_buf_destroy(&buffer);
1674 return 0;
1675}
Note: See TracBrowser for help on using the repository browser.