| 1 | extern void __VERIFIER_error() __attribute__ ((__noreturn__));
|
|---|
| 2 | extern int __VERIFIER_nondet_int(void);
|
|---|
| 3 |
|
|---|
| 4 | typedef unsigned int size_t;
|
|---|
| 5 | typedef unsigned char __u_char;
|
|---|
| 6 | typedef unsigned short int __u_short;
|
|---|
| 7 | typedef unsigned int __u_int;
|
|---|
| 8 | typedef unsigned long int __u_long;
|
|---|
| 9 | typedef signed char __int8_t;
|
|---|
| 10 | typedef unsigned char __uint8_t;
|
|---|
| 11 | typedef signed short int __int16_t;
|
|---|
| 12 | typedef unsigned short int __uint16_t;
|
|---|
| 13 | typedef signed int __int32_t;
|
|---|
| 14 | typedef 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;
|
|---|
| 52 | typedef __off64_t __loff_t;
|
|---|
| 53 | typedef __quad_t *__qaddr_t;
|
|---|
| 54 | typedef char *__caddr_t;
|
|---|
| 55 | __extension__ typedef int __intptr_t;
|
|---|
| 56 | __extension__ typedef unsigned int __socklen_t;
|
|---|
| 57 | struct _IO_FILE;
|
|---|
| 58 |
|
|---|
| 59 | typedef struct _IO_FILE FILE;
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 | typedef struct _IO_FILE __FILE;
|
|---|
| 63 | typedef struct
|
|---|
| 64 | {
|
|---|
| 65 | int __count;
|
|---|
| 66 | union
|
|---|
| 67 | {
|
|---|
| 68 | unsigned int __wch;
|
|---|
| 69 | char __wchb[4];
|
|---|
| 70 | } __value;
|
|---|
| 71 | } __mbstate_t;
|
|---|
| 72 | typedef struct
|
|---|
| 73 | {
|
|---|
| 74 | __off_t __pos;
|
|---|
| 75 | __mbstate_t __state;
|
|---|
| 76 | } _G_fpos_t;
|
|---|
| 77 | typedef struct
|
|---|
| 78 | {
|
|---|
| 79 | __off64_t __pos;
|
|---|
| 80 | __mbstate_t __state;
|
|---|
| 81 | } _G_fpos64_t;
|
|---|
| 82 | typedef __builtin_va_list __gnuc_va_list;
|
|---|
| 83 | struct _IO_jump_t; struct _IO_FILE;
|
|---|
| 84 | typedef void _IO_lock_t;
|
|---|
| 85 | struct _IO_marker {
|
|---|
| 86 | struct _IO_marker *_next;
|
|---|
| 87 | struct _IO_FILE *_sbuf;
|
|---|
| 88 | int _pos;
|
|---|
| 89 | };
|
|---|
| 90 | enum __codecvt_result
|
|---|
| 91 | {
|
|---|
| 92 | __codecvt_ok,
|
|---|
| 93 | __codecvt_partial,
|
|---|
| 94 | __codecvt_error,
|
|---|
| 95 | __codecvt_noconv
|
|---|
| 96 | };
|
|---|
| 97 | struct _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 | };
|
|---|
| 128 | typedef struct _IO_FILE _IO_FILE;
|
|---|
| 129 | struct _IO_FILE_plus;
|
|---|
| 130 | extern struct _IO_FILE_plus _IO_2_1_stdin_;
|
|---|
| 131 | extern struct _IO_FILE_plus _IO_2_1_stdout_;
|
|---|
| 132 | extern struct _IO_FILE_plus _IO_2_1_stderr_;
|
|---|
| 133 | typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);
|
|---|
| 134 | typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf,
|
|---|
| 135 | size_t __n);
|
|---|
| 136 | typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w);
|
|---|
| 137 | typedef int __io_close_fn (void *__cookie);
|
|---|
| 138 | extern int __underflow (_IO_FILE *);
|
|---|
| 139 | extern int __uflow (_IO_FILE *);
|
|---|
| 140 | extern int __overflow (_IO_FILE *, int);
|
|---|
| 141 | extern int _IO_getc (_IO_FILE *__fp);
|
|---|
| 142 | extern int _IO_putc (int __c, _IO_FILE *__fp);
|
|---|
| 143 | extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 144 | extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 145 | extern int _IO_peekc_locked (_IO_FILE *__fp);
|
|---|
| 146 | extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 147 | extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 148 | extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 149 | extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
|
|---|
| 150 | __gnuc_va_list, int *__restrict);
|
|---|
| 151 | extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
|
|---|
| 152 | __gnuc_va_list);
|
|---|
| 153 | extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t);
|
|---|
| 154 | extern size_t _IO_sgetn (_IO_FILE *, void *, size_t);
|
|---|
| 155 | extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int);
|
|---|
| 156 | extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int);
|
|---|
| 157 | extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 158 | typedef __gnuc_va_list va_list;
|
|---|
| 159 | typedef __off_t off_t;
|
|---|
| 160 | typedef __ssize_t ssize_t;
|
|---|
| 161 |
|
|---|
| 162 | typedef _G_fpos_t fpos_t;
|
|---|
| 163 |
|
|---|
| 164 | extern struct _IO_FILE *stdin;
|
|---|
| 165 | extern struct _IO_FILE *stdout;
|
|---|
| 166 | extern struct _IO_FILE *stderr;
|
|---|
| 167 |
|
|---|
| 168 | extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 169 | extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 170 |
|
|---|
| 171 | extern int renameat (int __oldfd, const char *__old, int __newfd,
|
|---|
| 172 | const char *__new) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 173 |
|
|---|
| 174 | extern FILE *tmpfile (void) ;
|
|---|
| 175 | extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ;
|
|---|
| 176 |
|
|---|
| 177 | extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ;
|
|---|
| 178 | extern char *tempnam (const char *__dir, const char *__pfx)
|
|---|
| 179 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ;
|
|---|
| 180 |
|
|---|
| 181 | extern int fclose (FILE *__stream);
|
|---|
| 182 | extern int fflush (FILE *__stream);
|
|---|
| 183 |
|
|---|
| 184 | extern int fflush_unlocked (FILE *__stream);
|
|---|
| 185 |
|
|---|
| 186 | extern FILE *fopen (const char *__restrict __filename,
|
|---|
| 187 | const char *__restrict __modes) ;
|
|---|
| 188 | extern FILE *freopen (const char *__restrict __filename,
|
|---|
| 189 | const char *__restrict __modes,
|
|---|
| 190 | FILE *__restrict __stream) ;
|
|---|
| 191 |
|
|---|
| 192 | extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ;
|
|---|
| 193 | extern FILE *fmemopen (void *__s, size_t __len, const char *__modes)
|
|---|
| 194 | __attribute__ ((__nothrow__ , __leaf__)) ;
|
|---|
| 195 | extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ;
|
|---|
| 196 |
|
|---|
| 197 | extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 198 | extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
|
|---|
| 199 | int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 200 |
|
|---|
| 201 | extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
|
|---|
| 202 | size_t __size) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 203 | extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 204 |
|
|---|
| 205 | extern int fprintf (FILE *__restrict __stream,
|
|---|
| 206 | const char *__restrict __format, ...);
|
|---|
| 207 | extern int printf (const char *__restrict __format, ...);
|
|---|
| 208 | extern int sprintf (char *__restrict __s,
|
|---|
| 209 | const char *__restrict __format, ...) __attribute__ ((__nothrow__));
|
|---|
| 210 | extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
|
|---|
| 211 | __gnuc_va_list __arg);
|
|---|
| 212 | extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
|
|---|
| 213 | extern int vsprintf (char *__restrict __s, const char *__restrict __format,
|
|---|
| 214 | __gnuc_va_list __arg) __attribute__ ((__nothrow__));
|
|---|
| 215 |
|
|---|
| 216 |
|
|---|
| 217 | extern int snprintf (char *__restrict __s, size_t __maxlen,
|
|---|
| 218 | const char *__restrict __format, ...)
|
|---|
| 219 | __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4)));
|
|---|
| 220 | extern 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 |
|
|---|
| 224 | extern int vdprintf (int __fd, const char *__restrict __fmt,
|
|---|
| 225 | __gnuc_va_list __arg)
|
|---|
| 226 | __attribute__ ((__format__ (__printf__, 2, 0)));
|
|---|
| 227 | extern int dprintf (int __fd, const char *__restrict __fmt, ...)
|
|---|
| 228 | __attribute__ ((__format__ (__printf__, 2, 3)));
|
|---|
| 229 |
|
|---|
| 230 | extern int fscanf (FILE *__restrict __stream,
|
|---|
| 231 | const char *__restrict __format, ...) ;
|
|---|
| 232 | extern int scanf (const char *__restrict __format, ...) ;
|
|---|
| 233 | extern int sscanf (const char *__restrict __s,
|
|---|
| 234 | const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 235 | extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf") ;
|
|---|
| 236 | extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf") ;
|
|---|
| 237 | extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 238 |
|
|---|
| 239 |
|
|---|
| 240 | extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
|
|---|
| 241 | __gnuc_va_list __arg)
|
|---|
| 242 | __attribute__ ((__format__ (__scanf__, 2, 0))) ;
|
|---|
| 243 | extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)
|
|---|
| 244 | __attribute__ ((__format__ (__scanf__, 1, 0))) ;
|
|---|
| 245 | extern int vsscanf (const char *__restrict __s,
|
|---|
| 246 | const char *__restrict __format, __gnuc_va_list __arg)
|
|---|
| 247 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0)));
|
|---|
| 248 | extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf")
|
|---|
| 249 | __attribute__ ((__format__ (__scanf__, 2, 0))) ;
|
|---|
| 250 | extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf")
|
|---|
| 251 | __attribute__ ((__format__ (__scanf__, 1, 0))) ;
|
|---|
| 252 | extern 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 |
|
|---|
| 256 | extern int fgetc (FILE *__stream);
|
|---|
| 257 | extern int getc (FILE *__stream);
|
|---|
| 258 | extern int getchar (void);
|
|---|
| 259 |
|
|---|
| 260 | extern int getc_unlocked (FILE *__stream);
|
|---|
| 261 | extern int getchar_unlocked (void);
|
|---|
| 262 | extern int fgetc_unlocked (FILE *__stream);
|
|---|
| 263 |
|
|---|
| 264 | extern int fputc (int __c, FILE *__stream);
|
|---|
| 265 | extern int putc (int __c, FILE *__stream);
|
|---|
| 266 | extern int putchar (int __c);
|
|---|
| 267 |
|
|---|
| 268 | extern int fputc_unlocked (int __c, FILE *__stream);
|
|---|
| 269 | extern int putc_unlocked (int __c, FILE *__stream);
|
|---|
| 270 | extern int putchar_unlocked (int __c);
|
|---|
| 271 | extern int getw (FILE *__stream);
|
|---|
| 272 | extern int putw (int __w, FILE *__stream);
|
|---|
| 273 |
|
|---|
| 274 | extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
|
|---|
| 275 | ;
|
|---|
| 276 |
|
|---|
| 277 | extern __ssize_t __getdelim (char **__restrict __lineptr,
|
|---|
| 278 | size_t *__restrict __n, int __delimiter,
|
|---|
| 279 | FILE *__restrict __stream) ;
|
|---|
| 280 | extern __ssize_t getdelim (char **__restrict __lineptr,
|
|---|
| 281 | size_t *__restrict __n, int __delimiter,
|
|---|
| 282 | FILE *__restrict __stream) ;
|
|---|
| 283 | extern __ssize_t getline (char **__restrict __lineptr,
|
|---|
| 284 | size_t *__restrict __n,
|
|---|
| 285 | FILE *__restrict __stream) ;
|
|---|
| 286 |
|
|---|
| 287 | extern int fputs (const char *__restrict __s, FILE *__restrict __stream);
|
|---|
| 288 | extern int puts (const char *__s);
|
|---|
| 289 | extern int ungetc (int __c, FILE *__stream);
|
|---|
| 290 | extern size_t fread (void *__restrict __ptr, size_t __size,
|
|---|
| 291 | size_t __n, FILE *__restrict __stream) ;
|
|---|
| 292 | extern size_t fwrite (const void *__restrict __ptr, size_t __size,
|
|---|
| 293 | size_t __n, FILE *__restrict __s);
|
|---|
| 294 |
|
|---|
| 295 | extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
|
|---|
| 296 | size_t __n, FILE *__restrict __stream) ;
|
|---|
| 297 | extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size,
|
|---|
| 298 | size_t __n, FILE *__restrict __stream);
|
|---|
| 299 |
|
|---|
| 300 | extern int fseek (FILE *__stream, long int __off, int __whence);
|
|---|
| 301 | extern long int ftell (FILE *__stream) ;
|
|---|
| 302 | extern void rewind (FILE *__stream);
|
|---|
| 303 |
|
|---|
| 304 | extern int fseeko (FILE *__stream, __off_t __off, int __whence);
|
|---|
| 305 | extern __off_t ftello (FILE *__stream) ;
|
|---|
| 306 |
|
|---|
| 307 | extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);
|
|---|
| 308 | extern int fsetpos (FILE *__stream, const fpos_t *__pos);
|
|---|
| 309 |
|
|---|
| 310 |
|
|---|
| 311 | extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 312 | extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
|
|---|
| 313 | extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
|
|---|
| 314 |
|
|---|
| 315 | extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 316 | extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
|
|---|
| 317 | extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
|
|---|
| 318 |
|
|---|
| 319 | extern void perror (const char *__s);
|
|---|
| 320 |
|
|---|
| 321 | extern int sys_nerr;
|
|---|
| 322 | extern const char *const sys_errlist[];
|
|---|
| 323 | extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
|
|---|
| 324 | extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
|
|---|
| 325 | extern FILE *popen (const char *__command, const char *__modes) ;
|
|---|
| 326 | extern int pclose (FILE *__stream);
|
|---|
| 327 | extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 328 | extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 329 | extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
|
|---|
| 330 | extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 331 |
|
|---|
| 332 | typedef long int wchar_t;
|
|---|
| 333 |
|
|---|
| 334 | typedef enum
|
|---|
| 335 | {
|
|---|
| 336 | P_ALL,
|
|---|
| 337 | P_PID,
|
|---|
| 338 | P_PGID
|
|---|
| 339 | } idtype_t;
|
|---|
| 340 | static __inline unsigned int
|
|---|
| 341 | __bswap_32 (unsigned int __bsx)
|
|---|
| 342 | {
|
|---|
| 343 | return __builtin_bswap32 (__bsx);
|
|---|
| 344 | }
|
|---|
| 345 | static __inline __uint64_t
|
|---|
| 346 | __bswap_64 (__uint64_t __bsx)
|
|---|
| 347 | {
|
|---|
| 348 | return __builtin_bswap64 (__bsx);
|
|---|
| 349 | }
|
|---|
| 350 | union 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 | };
|
|---|
| 367 | typedef union
|
|---|
| 368 | {
|
|---|
| 369 | union wait *__uptr;
|
|---|
| 370 | int *__iptr;
|
|---|
| 371 | } __WAIT_STATUS __attribute__ ((__transparent_union__));
|
|---|
| 372 |
|
|---|
| 373 | typedef struct
|
|---|
| 374 | {
|
|---|
| 375 | int quot;
|
|---|
| 376 | int rem;
|
|---|
| 377 | } div_t;
|
|---|
| 378 | typedef 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 |
|
|---|
| 391 | extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) ;
|
|---|
| 392 |
|
|---|
| 393 | extern double atof (const char *__nptr)
|
|---|
| 394 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
|
|---|
| 395 | extern int atoi (const char *__nptr)
|
|---|
| 396 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
|
|---|
| 397 | extern 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 |
|
|---|
| 405 | extern double strtod (const char *__restrict __nptr,
|
|---|
| 406 | char **__restrict __endptr)
|
|---|
| 407 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 408 |
|
|---|
| 409 |
|
|---|
| 410 | extern float strtof (const char *__restrict __nptr,
|
|---|
| 411 | char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 412 | extern long double strtold (const char *__restrict __nptr,
|
|---|
| 413 | char **__restrict __endptr)
|
|---|
| 414 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 415 |
|
|---|
| 416 |
|
|---|
| 417 | extern long int strtol (const char *__restrict __nptr,
|
|---|
| 418 | char **__restrict __endptr, int __base)
|
|---|
| 419 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 420 | extern unsigned long int strtoul (const char *__restrict __nptr,
|
|---|
| 421 | char **__restrict __endptr, int __base)
|
|---|
| 422 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 423 |
|
|---|
| 424 | __extension__
|
|---|
| 425 | extern long long int strtoq (const char *__restrict __nptr,
|
|---|
| 426 | char **__restrict __endptr, int __base)
|
|---|
| 427 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 428 | __extension__
|
|---|
| 429 | extern 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__
|
|---|
| 434 | extern long long int strtoll (const char *__restrict __nptr,
|
|---|
| 435 | char **__restrict __endptr, int __base)
|
|---|
| 436 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 437 | __extension__
|
|---|
| 438 | extern unsigned long long int strtoull (const char *__restrict __nptr,
|
|---|
| 439 | char **__restrict __endptr, int __base)
|
|---|
| 440 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 441 |
|
|---|
| 442 | extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) ;
|
|---|
| 443 | extern long int a64l (const char *__s)
|
|---|
| 444 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) ;
|
|---|
| 445 |
|
|---|
| 446 | typedef __u_char u_char;
|
|---|
| 447 | typedef __u_short u_short;
|
|---|
| 448 | typedef __u_int u_int;
|
|---|
| 449 | typedef __u_long u_long;
|
|---|
| 450 | typedef __quad_t quad_t;
|
|---|
| 451 | typedef __u_quad_t u_quad_t;
|
|---|
| 452 | typedef __fsid_t fsid_t;
|
|---|
| 453 | typedef __loff_t loff_t;
|
|---|
| 454 | typedef __ino_t ino_t;
|
|---|
| 455 | typedef __dev_t dev_t;
|
|---|
| 456 | typedef __gid_t gid_t;
|
|---|
| 457 | typedef __mode_t mode_t;
|
|---|
| 458 | typedef __nlink_t nlink_t;
|
|---|
| 459 | typedef __uid_t uid_t;
|
|---|
| 460 | typedef __pid_t pid_t;
|
|---|
| 461 | typedef __id_t id_t;
|
|---|
| 462 | typedef __daddr_t daddr_t;
|
|---|
| 463 | typedef __caddr_t caddr_t;
|
|---|
| 464 | typedef __key_t key_t;
|
|---|
| 465 |
|
|---|
| 466 | typedef __clock_t clock_t;
|
|---|
| 467 |
|
|---|
| 468 |
|
|---|
| 469 |
|
|---|
| 470 | typedef __time_t time_t;
|
|---|
| 471 |
|
|---|
| 472 |
|
|---|
| 473 | typedef __clockid_t clockid_t;
|
|---|
| 474 | typedef __timer_t timer_t;
|
|---|
| 475 | typedef unsigned long int ulong;
|
|---|
| 476 | typedef unsigned short int ushort;
|
|---|
| 477 | typedef unsigned int uint;
|
|---|
| 478 | typedef int int8_t __attribute__ ((__mode__ (__QI__)));
|
|---|
| 479 | typedef int int16_t __attribute__ ((__mode__ (__HI__)));
|
|---|
| 480 | typedef int int32_t __attribute__ ((__mode__ (__SI__)));
|
|---|
| 481 | typedef int int64_t __attribute__ ((__mode__ (__DI__)));
|
|---|
| 482 | typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__)));
|
|---|
| 483 | typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__)));
|
|---|
| 484 | typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__)));
|
|---|
| 485 | typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__)));
|
|---|
| 486 | typedef int register_t __attribute__ ((__mode__ (__word__)));
|
|---|
| 487 | typedef int __sig_atomic_t;
|
|---|
| 488 | typedef struct
|
|---|
| 489 | {
|
|---|
| 490 | unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))];
|
|---|
| 491 | } __sigset_t;
|
|---|
| 492 | typedef __sigset_t sigset_t;
|
|---|
| 493 | struct timespec
|
|---|
| 494 | {
|
|---|
| 495 | __time_t tv_sec;
|
|---|
| 496 | __syscall_slong_t tv_nsec;
|
|---|
| 497 | };
|
|---|
| 498 | struct timeval
|
|---|
| 499 | {
|
|---|
| 500 | __time_t tv_sec;
|
|---|
| 501 | __suseconds_t tv_usec;
|
|---|
| 502 | };
|
|---|
| 503 | typedef __suseconds_t suseconds_t;
|
|---|
| 504 | typedef long int __fd_mask;
|
|---|
| 505 | typedef struct
|
|---|
| 506 | {
|
|---|
| 507 | __fd_mask __fds_bits[1024 / (8 * (int) sizeof (__fd_mask))];
|
|---|
| 508 | } fd_set;
|
|---|
| 509 | typedef __fd_mask fd_mask;
|
|---|
| 510 |
|
|---|
| 511 | extern int select (int __nfds, fd_set *__restrict __readfds,
|
|---|
| 512 | fd_set *__restrict __writefds,
|
|---|
| 513 | fd_set *__restrict __exceptfds,
|
|---|
| 514 | struct timeval *__restrict __timeout);
|
|---|
| 515 | extern 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__
|
|---|
| 523 | extern unsigned int gnu_dev_major (unsigned long long int __dev)
|
|---|
| 524 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
|
|---|
| 525 | __extension__
|
|---|
| 526 | extern unsigned int gnu_dev_minor (unsigned long long int __dev)
|
|---|
| 527 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
|
|---|
| 528 | __extension__
|
|---|
| 529 | extern unsigned long long int gnu_dev_makedev (unsigned int __major,
|
|---|
| 530 | unsigned int __minor)
|
|---|
| 531 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
|
|---|
| 532 |
|
|---|
| 533 | typedef __blksize_t blksize_t;
|
|---|
| 534 | typedef __blkcnt_t blkcnt_t;
|
|---|
| 535 | typedef __fsblkcnt_t fsblkcnt_t;
|
|---|
| 536 | typedef __fsfilcnt_t fsfilcnt_t;
|
|---|
| 537 | typedef unsigned long int pthread_t;
|
|---|
| 538 | union pthread_attr_t
|
|---|
| 539 | {
|
|---|
| 540 | char __size[36];
|
|---|
| 541 | long int __align;
|
|---|
| 542 | };
|
|---|
| 543 | typedef union pthread_attr_t pthread_attr_t;
|
|---|
| 544 | typedef struct __pthread_internal_slist
|
|---|
| 545 | {
|
|---|
| 546 | struct __pthread_internal_slist *__next;
|
|---|
| 547 | } __pthread_slist_t;
|
|---|
| 548 | typedef 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;
|
|---|
| 570 | typedef union
|
|---|
| 571 | {
|
|---|
| 572 | char __size[4];
|
|---|
| 573 | int __align;
|
|---|
| 574 | } pthread_mutexattr_t;
|
|---|
| 575 | typedef 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;
|
|---|
| 591 | typedef union
|
|---|
| 592 | {
|
|---|
| 593 | char __size[4];
|
|---|
| 594 | int __align;
|
|---|
| 595 | } pthread_condattr_t;
|
|---|
| 596 | typedef unsigned int pthread_key_t;
|
|---|
| 597 | typedef int pthread_once_t;
|
|---|
| 598 | typedef 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;
|
|---|
| 617 | typedef union
|
|---|
| 618 | {
|
|---|
| 619 | char __size[8];
|
|---|
| 620 | long int __align;
|
|---|
| 621 | } pthread_rwlockattr_t;
|
|---|
| 622 | typedef volatile int pthread_spinlock_t;
|
|---|
| 623 | typedef union
|
|---|
| 624 | {
|
|---|
| 625 | char __size[20];
|
|---|
| 626 | long int __align;
|
|---|
| 627 | } pthread_barrier_t;
|
|---|
| 628 | typedef union
|
|---|
| 629 | {
|
|---|
| 630 | char __size[4];
|
|---|
| 631 | int __align;
|
|---|
| 632 | } pthread_barrierattr_t;
|
|---|
| 633 |
|
|---|
| 634 | extern long int random (void) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 635 | extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 636 | extern char *initstate (unsigned int __seed, char *__statebuf,
|
|---|
| 637 | size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
|
|---|
| 638 | extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 639 | struct 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 | };
|
|---|
| 649 | extern int random_r (struct random_data *__restrict __buf,
|
|---|
| 650 | int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 651 | extern int srandom_r (unsigned int __seed, struct random_data *__buf)
|
|---|
| 652 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
|
|---|
| 653 | extern 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)));
|
|---|
| 657 | extern int setstate_r (char *__restrict __statebuf,
|
|---|
| 658 | struct random_data *__restrict __buf)
|
|---|
| 659 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 660 |
|
|---|
| 661 | extern int rand (void) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 662 | extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 663 |
|
|---|
| 664 | extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 665 | extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 666 | extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 667 | extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 668 | extern long int nrand48 (unsigned short int __xsubi[3])
|
|---|
| 669 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 670 | extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 671 | extern long int jrand48 (unsigned short int __xsubi[3])
|
|---|
| 672 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 673 | extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 674 | extern unsigned short int *seed48 (unsigned short int __seed16v[3])
|
|---|
| 675 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 676 | extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 677 | struct 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 | };
|
|---|
| 685 | extern int drand48_r (struct drand48_data *__restrict __buffer,
|
|---|
| 686 | double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 687 | extern 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)));
|
|---|
| 690 | extern int lrand48_r (struct drand48_data *__restrict __buffer,
|
|---|
| 691 | long int *__restrict __result)
|
|---|
| 692 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 693 | extern 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)));
|
|---|
| 697 | extern int mrand48_r (struct drand48_data *__restrict __buffer,
|
|---|
| 698 | long int *__restrict __result)
|
|---|
| 699 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 700 | extern 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)));
|
|---|
| 704 | extern int srand48_r (long int __seedval, struct drand48_data *__buffer)
|
|---|
| 705 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
|
|---|
| 706 | extern int seed48_r (unsigned short int __seed16v[3],
|
|---|
| 707 | struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 708 | extern int lcong48_r (unsigned short int __param[7],
|
|---|
| 709 | struct drand48_data *__buffer)
|
|---|
| 710 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 711 |
|
|---|
| 712 | extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ;
|
|---|
| 713 | extern void *calloc (size_t __nmemb, size_t __size)
|
|---|
| 714 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ;
|
|---|
| 715 |
|
|---|
| 716 |
|
|---|
| 717 | extern void *realloc (void *__ptr, size_t __size)
|
|---|
| 718 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
|
|---|
| 719 | extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 720 |
|
|---|
| 721 | extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 722 |
|
|---|
| 723 | extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 724 |
|
|---|
| 725 | extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ;
|
|---|
| 726 | extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
|
|---|
| 727 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ;
|
|---|
| 728 | extern void *aligned_alloc (size_t __alignment, size_t __size)
|
|---|
| 729 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__alloc_size__ (2))) ;
|
|---|
| 730 |
|
|---|
| 731 | extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
|
|---|
| 732 | extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 733 | extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 734 |
|
|---|
| 735 | extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
|
|---|
| 736 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 737 |
|
|---|
| 738 | extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
|
|---|
| 739 | extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
|
|---|
| 740 |
|
|---|
| 741 |
|
|---|
| 742 | extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
|
|---|
| 743 |
|
|---|
| 744 |
|
|---|
| 745 | extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ;
|
|---|
| 746 |
|
|---|
| 747 | extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 748 | extern int setenv (const char *__name, const char *__value, int __replace)
|
|---|
| 749 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
|
|---|
| 750 | extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 751 | extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 752 | extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 753 | extern int mkstemp (char *__template) __attribute__ ((__nonnull__ (1))) ;
|
|---|
| 754 | extern int mkstemps (char *__template, int __suffixlen) __attribute__ ((__nonnull__ (1))) ;
|
|---|
| 755 | extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ;
|
|---|
| 756 |
|
|---|
| 757 | extern int system (const char *__command) ;
|
|---|
| 758 |
|
|---|
| 759 | extern char *realpath (const char *__restrict __name,
|
|---|
| 760 | char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) ;
|
|---|
| 761 | typedef int (*__compar_fn_t) (const void *, const void *);
|
|---|
| 762 |
|
|---|
| 763 | extern 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))) ;
|
|---|
| 766 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
|
|---|
| 767 | __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4)));
|
|---|
| 768 | extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ;
|
|---|
| 769 | extern 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 |
|
|---|
| 774 | extern div_t div (int __numer, int __denom)
|
|---|
| 775 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) ;
|
|---|
| 776 | extern 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 |
|
|---|
| 784 | extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt,
|
|---|
| 785 | int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ;
|
|---|
| 786 | extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt,
|
|---|
| 787 | int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ;
|
|---|
| 788 | extern char *gcvt (double __value, int __ndigit, char *__buf)
|
|---|
| 789 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ;
|
|---|
| 790 | extern char *qecvt (long double __value, int __ndigit,
|
|---|
| 791 | int *__restrict __decpt, int *__restrict __sign)
|
|---|
| 792 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ;
|
|---|
| 793 | extern char *qfcvt (long double __value, int __ndigit,
|
|---|
| 794 | int *__restrict __decpt, int *__restrict __sign)
|
|---|
| 795 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) ;
|
|---|
| 796 | extern char *qgcvt (long double __value, int __ndigit, char *__buf)
|
|---|
| 797 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) ;
|
|---|
| 798 | extern 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)));
|
|---|
| 801 | extern 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)));
|
|---|
| 804 | extern 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)));
|
|---|
| 808 | extern 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 |
|
|---|
| 813 | extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 814 | extern int mbtowc (wchar_t *__restrict __pwc,
|
|---|
| 815 | const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 816 | extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 817 | extern size_t mbstowcs (wchar_t *__restrict __pwcs,
|
|---|
| 818 | const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 819 | extern size_t wcstombs (char *__restrict __s,
|
|---|
| 820 | const wchar_t *__restrict __pwcs, size_t __n)
|
|---|
| 821 | __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 822 |
|
|---|
| 823 | extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) ;
|
|---|
| 824 | extern int getsubopt (char **__restrict __optionp,
|
|---|
| 825 | char *const *__restrict __tokens,
|
|---|
| 826 | char **__restrict __valuep)
|
|---|
| 827 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) ;
|
|---|
| 828 | extern int getloadavg (double __loadavg[], int __nelem)
|
|---|
| 829 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 830 |
|
|---|
| 831 |
|
|---|
| 832 |
|
|---|
| 833 | extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
|
|---|
| 834 | size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 835 | extern void *memmove (void *__dest, const void *__src, size_t __n)
|
|---|
| 836 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 837 |
|
|---|
| 838 | extern void *memccpy (void *__restrict __dest, const void *__restrict __src,
|
|---|
| 839 | int __c, size_t __n)
|
|---|
| 840 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 841 |
|
|---|
| 842 | extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 843 | extern int memcmp (const void *__s1, const void *__s2, size_t __n)
|
|---|
| 844 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 845 | extern void *memchr (const void *__s, int __c, size_t __n)
|
|---|
| 846 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 847 |
|
|---|
| 848 |
|
|---|
| 849 | extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
|
|---|
| 850 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 851 | extern char *strncpy (char *__restrict __dest,
|
|---|
| 852 | const char *__restrict __src, size_t __n)
|
|---|
| 853 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 854 | extern char *strcat (char *__restrict __dest, const char *__restrict __src)
|
|---|
| 855 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 856 | extern char *strncat (char *__restrict __dest, const char *__restrict __src,
|
|---|
| 857 | size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 858 | extern int strcmp (const char *__s1, const char *__s2)
|
|---|
| 859 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 860 | extern int strncmp (const char *__s1, const char *__s2, size_t __n)
|
|---|
| 861 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 862 | extern int strcoll (const char *__s1, const char *__s2)
|
|---|
| 863 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 864 | extern size_t strxfrm (char *__restrict __dest,
|
|---|
| 865 | const char *__restrict __src, size_t __n)
|
|---|
| 866 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
|
|---|
| 867 |
|
|---|
| 868 | typedef 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;
|
|---|
| 876 | typedef __locale_t locale_t;
|
|---|
| 877 | extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l)
|
|---|
| 878 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3)));
|
|---|
| 879 | extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n,
|
|---|
| 880 | __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4)));
|
|---|
| 881 | extern char *strdup (const char *__s)
|
|---|
| 882 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 883 | extern char *strndup (const char *__string, size_t __n)
|
|---|
| 884 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 885 |
|
|---|
| 886 | extern char *strchr (const char *__s, int __c)
|
|---|
| 887 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 888 | extern char *strrchr (const char *__s, int __c)
|
|---|
| 889 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 890 |
|
|---|
| 891 |
|
|---|
| 892 | extern size_t strcspn (const char *__s, const char *__reject)
|
|---|
| 893 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 894 | extern size_t strspn (const char *__s, const char *__accept)
|
|---|
| 895 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 896 | extern char *strpbrk (const char *__s, const char *__accept)
|
|---|
| 897 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 898 | extern char *strstr (const char *__haystack, const char *__needle)
|
|---|
| 899 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 900 | extern char *strtok (char *__restrict __s, const char *__restrict __delim)
|
|---|
| 901 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
|
|---|
| 902 |
|
|---|
| 903 | extern char *__strtok_r (char *__restrict __s,
|
|---|
| 904 | const char *__restrict __delim,
|
|---|
| 905 | char **__restrict __save_ptr)
|
|---|
| 906 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3)));
|
|---|
| 907 | extern char *strtok_r (char *__restrict __s, const char *__restrict __delim,
|
|---|
| 908 | char **__restrict __save_ptr)
|
|---|
| 909 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3)));
|
|---|
| 910 |
|
|---|
| 911 | extern size_t strlen (const char *__s)
|
|---|
| 912 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 913 |
|
|---|
| 914 | extern size_t strnlen (const char *__string, size_t __maxlen)
|
|---|
| 915 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 916 |
|
|---|
| 917 | extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 918 |
|
|---|
| 919 | extern int strerror_r (int __errnum, char *__buf, size_t __buflen) __asm__ ("" "__xpg_strerror_r") __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
|
|---|
| 920 | extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 921 | extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 922 | extern void bcopy (const void *__src, void *__dest, size_t __n)
|
|---|
| 923 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 924 | extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 925 | extern int bcmp (const void *__s1, const void *__s2, size_t __n)
|
|---|
| 926 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 927 | extern char *index (const char *__s, int __c)
|
|---|
| 928 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 929 | extern char *rindex (const char *__s, int __c)
|
|---|
| 930 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 931 | extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
|
|---|
| 932 | extern int strcasecmp (const char *__s1, const char *__s2)
|
|---|
| 933 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 934 | extern int strncasecmp (const char *__s1, const char *__s2, size_t __n)
|
|---|
| 935 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 936 | extern char *strsep (char **__restrict __stringp,
|
|---|
| 937 | const char *__restrict __delim)
|
|---|
| 938 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 939 | extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 940 | extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src)
|
|---|
| 941 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 942 | extern char *stpcpy (char *__restrict __dest, const char *__restrict __src)
|
|---|
| 943 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 944 | extern char *__stpncpy (char *__restrict __dest,
|
|---|
| 945 | const char *__restrict __src, size_t __n)
|
|---|
| 946 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 947 | extern char *stpncpy (char *__restrict __dest,
|
|---|
| 948 | const char *__restrict __src, size_t __n)
|
|---|
| 949 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 950 |
|
|---|
| 951 |
|
|---|
| 952 | extern int *__errno_location (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
|
|---|
| 953 |
|
|---|
| 954 | struct sched_param
|
|---|
| 955 | {
|
|---|
| 956 | int __sched_priority;
|
|---|
| 957 | };
|
|---|
| 958 |
|
|---|
| 959 |
|
|---|
| 960 | struct __sched_param
|
|---|
| 961 | {
|
|---|
| 962 | int __sched_priority;
|
|---|
| 963 | };
|
|---|
| 964 | typedef unsigned long int __cpu_mask;
|
|---|
| 965 | typedef struct
|
|---|
| 966 | {
|
|---|
| 967 | __cpu_mask __bits[1024 / (8 * sizeof (__cpu_mask))];
|
|---|
| 968 | } cpu_set_t;
|
|---|
| 969 |
|
|---|
| 970 | extern int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp)
|
|---|
| 971 | __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 972 | extern cpu_set_t *__sched_cpualloc (size_t __count) __attribute__ ((__nothrow__ , __leaf__)) ;
|
|---|
| 973 | extern void __sched_cpufree (cpu_set_t *__set) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 974 |
|
|---|
| 975 |
|
|---|
| 976 | extern int sched_setparam (__pid_t __pid, const struct sched_param *__param)
|
|---|
| 977 | __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 978 | extern int sched_getparam (__pid_t __pid, struct sched_param *__param) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 979 | extern int sched_setscheduler (__pid_t __pid, int __policy,
|
|---|
| 980 | const struct sched_param *__param) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 981 | extern int sched_getscheduler (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 982 | extern int sched_yield (void) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 983 | extern int sched_get_priority_max (int __algorithm) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 984 | extern int sched_get_priority_min (int __algorithm) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 985 | extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 986 |
|
|---|
| 987 |
|
|---|
| 988 |
|
|---|
| 989 | struct 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 |
|
|---|
| 1005 | struct itimerspec
|
|---|
| 1006 | {
|
|---|
| 1007 | struct timespec it_interval;
|
|---|
| 1008 | struct timespec it_value;
|
|---|
| 1009 | };
|
|---|
| 1010 | struct sigevent;
|
|---|
| 1011 |
|
|---|
| 1012 | extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1013 | extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1014 | extern double difftime (time_t __time1, time_t __time0)
|
|---|
| 1015 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
|
|---|
| 1016 | extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1017 | extern size_t strftime (char *__restrict __s, size_t __maxsize,
|
|---|
| 1018 | const char *__restrict __format,
|
|---|
| 1019 | const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1020 |
|
|---|
| 1021 | extern 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 |
|
|---|
| 1026 | extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1027 | extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1028 |
|
|---|
| 1029 | extern struct tm *gmtime_r (const time_t *__restrict __timer,
|
|---|
| 1030 | struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1031 | extern struct tm *localtime_r (const time_t *__restrict __timer,
|
|---|
| 1032 | struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1033 |
|
|---|
| 1034 | extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1035 | extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1036 |
|
|---|
| 1037 | extern char *asctime_r (const struct tm *__restrict __tp,
|
|---|
| 1038 | char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1039 | extern char *ctime_r (const time_t *__restrict __timer,
|
|---|
| 1040 | char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1041 | extern char *__tzname[2];
|
|---|
| 1042 | extern int __daylight;
|
|---|
| 1043 | extern long int __timezone;
|
|---|
| 1044 | extern char *tzname[2];
|
|---|
| 1045 | extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1046 | extern int daylight;
|
|---|
| 1047 | extern long int timezone;
|
|---|
| 1048 | extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1049 | extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1050 | extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1051 | extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
|
|---|
| 1052 | extern int nanosleep (const struct timespec *__requested_time,
|
|---|
| 1053 | struct timespec *__remaining);
|
|---|
| 1054 | extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1055 | extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1056 | extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp)
|
|---|
| 1057 | __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1058 | extern int clock_nanosleep (clockid_t __clock_id, int __flags,
|
|---|
| 1059 | const struct timespec *__req,
|
|---|
| 1060 | struct timespec *__rem);
|
|---|
| 1061 | extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1062 | extern int timer_create (clockid_t __clock_id,
|
|---|
| 1063 | struct sigevent *__restrict __evp,
|
|---|
| 1064 | timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1065 | extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1066 | extern int timer_settime (timer_t __timerid, int __flags,
|
|---|
| 1067 | const struct itimerspec *__restrict __value,
|
|---|
| 1068 | struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1069 | extern int timer_gettime (timer_t __timerid, struct itimerspec *__value)
|
|---|
| 1070 | __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1071 | extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1072 | extern int timespec_get (struct timespec *__ts, int __base)
|
|---|
| 1073 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1074 |
|
|---|
| 1075 | typedef int __jmp_buf[6];
|
|---|
| 1076 | enum
|
|---|
| 1077 | {
|
|---|
| 1078 | PTHREAD_CREATE_JOINABLE,
|
|---|
| 1079 | PTHREAD_CREATE_DETACHED
|
|---|
| 1080 | };
|
|---|
| 1081 | enum
|
|---|
| 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 | };
|
|---|
| 1093 | enum
|
|---|
| 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 | };
|
|---|
| 1100 | enum
|
|---|
| 1101 | {
|
|---|
| 1102 | PTHREAD_PRIO_NONE,
|
|---|
| 1103 | PTHREAD_PRIO_INHERIT,
|
|---|
| 1104 | PTHREAD_PRIO_PROTECT
|
|---|
| 1105 | };
|
|---|
| 1106 | enum
|
|---|
| 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 | };
|
|---|
| 1113 | enum
|
|---|
| 1114 | {
|
|---|
| 1115 | PTHREAD_INHERIT_SCHED,
|
|---|
| 1116 | PTHREAD_EXPLICIT_SCHED
|
|---|
| 1117 | };
|
|---|
| 1118 | enum
|
|---|
| 1119 | {
|
|---|
| 1120 | PTHREAD_SCOPE_SYSTEM,
|
|---|
| 1121 | PTHREAD_SCOPE_PROCESS
|
|---|
| 1122 | };
|
|---|
| 1123 | enum
|
|---|
| 1124 | {
|
|---|
| 1125 | PTHREAD_PROCESS_PRIVATE,
|
|---|
| 1126 | PTHREAD_PROCESS_SHARED
|
|---|
| 1127 | };
|
|---|
| 1128 | struct _pthread_cleanup_buffer
|
|---|
| 1129 | {
|
|---|
| 1130 | void (*__routine) (void *);
|
|---|
| 1131 | void *__arg;
|
|---|
| 1132 | int __canceltype;
|
|---|
| 1133 | struct _pthread_cleanup_buffer *__prev;
|
|---|
| 1134 | };
|
|---|
| 1135 | enum
|
|---|
| 1136 | {
|
|---|
| 1137 | PTHREAD_CANCEL_ENABLE,
|
|---|
| 1138 | PTHREAD_CANCEL_DISABLE
|
|---|
| 1139 | };
|
|---|
| 1140 | enum
|
|---|
| 1141 | {
|
|---|
| 1142 | PTHREAD_CANCEL_DEFERRED,
|
|---|
| 1143 | PTHREAD_CANCEL_ASYNCHRONOUS
|
|---|
| 1144 | };
|
|---|
| 1145 |
|
|---|
| 1146 | extern 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)));
|
|---|
| 1150 | extern void pthread_exit (void *__retval) __attribute__ ((__noreturn__));
|
|---|
| 1151 | extern int pthread_join (pthread_t __th, void **__thread_return);
|
|---|
| 1152 | extern int pthread_detach (pthread_t __th) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1153 | extern pthread_t pthread_self (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
|
|---|
| 1154 | extern int pthread_equal (pthread_t __thread1, pthread_t __thread2)
|
|---|
| 1155 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
|
|---|
| 1156 | extern int pthread_attr_init (pthread_attr_t *__attr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1157 | extern int pthread_attr_destroy (pthread_attr_t *__attr)
|
|---|
| 1158 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1159 | extern int pthread_attr_getdetachstate (const pthread_attr_t *__attr,
|
|---|
| 1160 | int *__detachstate)
|
|---|
| 1161 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 1162 | extern int pthread_attr_setdetachstate (pthread_attr_t *__attr,
|
|---|
| 1163 | int __detachstate)
|
|---|
| 1164 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1165 | extern int pthread_attr_getguardsize (const pthread_attr_t *__attr,
|
|---|
| 1166 | size_t *__guardsize)
|
|---|
| 1167 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 1168 | extern int pthread_attr_setguardsize (pthread_attr_t *__attr,
|
|---|
| 1169 | size_t __guardsize)
|
|---|
| 1170 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1171 | extern int pthread_attr_getschedparam (const pthread_attr_t *__restrict __attr,
|
|---|
| 1172 | struct sched_param *__restrict __param)
|
|---|
| 1173 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 1174 | extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr,
|
|---|
| 1175 | const struct sched_param *__restrict
|
|---|
| 1176 | __param) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 1177 | extern int pthread_attr_getschedpolicy (const pthread_attr_t *__restrict
|
|---|
| 1178 | __attr, int *__restrict __policy)
|
|---|
| 1179 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 1180 | extern int pthread_attr_setschedpolicy (pthread_attr_t *__attr, int __policy)
|
|---|
| 1181 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1182 | extern int pthread_attr_getinheritsched (const pthread_attr_t *__restrict
|
|---|
| 1183 | __attr, int *__restrict __inherit)
|
|---|
| 1184 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 1185 | extern int pthread_attr_setinheritsched (pthread_attr_t *__attr,
|
|---|
| 1186 | int __inherit)
|
|---|
| 1187 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1188 | extern int pthread_attr_getscope (const pthread_attr_t *__restrict __attr,
|
|---|
| 1189 | int *__restrict __scope)
|
|---|
| 1190 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 1191 | extern int pthread_attr_setscope (pthread_attr_t *__attr, int __scope)
|
|---|
| 1192 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1193 | extern int pthread_attr_getstackaddr (const pthread_attr_t *__restrict
|
|---|
| 1194 | __attr, void **__restrict __stackaddr)
|
|---|
| 1195 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) __attribute__ ((__deprecated__));
|
|---|
| 1196 | extern int pthread_attr_setstackaddr (pthread_attr_t *__attr,
|
|---|
| 1197 | void *__stackaddr)
|
|---|
| 1198 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__));
|
|---|
| 1199 | extern int pthread_attr_getstacksize (const pthread_attr_t *__restrict
|
|---|
| 1200 | __attr, size_t *__restrict __stacksize)
|
|---|
| 1201 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 1202 | extern int pthread_attr_setstacksize (pthread_attr_t *__attr,
|
|---|
| 1203 | size_t __stacksize)
|
|---|
| 1204 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1205 | extern 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)));
|
|---|
| 1209 | extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr,
|
|---|
| 1210 | size_t __stacksize) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1211 | extern int pthread_setschedparam (pthread_t __target_thread, int __policy,
|
|---|
| 1212 | const struct sched_param *__param)
|
|---|
| 1213 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3)));
|
|---|
| 1214 | extern 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)));
|
|---|
| 1218 | extern int pthread_setschedprio (pthread_t __target_thread, int __prio)
|
|---|
| 1219 | __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1220 | extern int pthread_once (pthread_once_t *__once_control,
|
|---|
| 1221 | void (*__init_routine) (void)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 1222 | extern int pthread_setcancelstate (int __state, int *__oldstate);
|
|---|
| 1223 | extern int pthread_setcanceltype (int __type, int *__oldtype);
|
|---|
| 1224 | extern int pthread_cancel (pthread_t __th);
|
|---|
| 1225 | extern void pthread_testcancel (void);
|
|---|
| 1226 | typedef 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__));
|
|---|
| 1235 | struct __pthread_cleanup_frame
|
|---|
| 1236 | {
|
|---|
| 1237 | void (*__cancel_routine) (void *);
|
|---|
| 1238 | void *__cancel_arg;
|
|---|
| 1239 | int __do_it;
|
|---|
| 1240 | int __cancel_type;
|
|---|
| 1241 | };
|
|---|
| 1242 | extern void __pthread_register_cancel (__pthread_unwind_buf_t *__buf)
|
|---|
| 1243 | __attribute__ ((__regparm__ (1)));
|
|---|
| 1244 | extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf)
|
|---|
| 1245 | __attribute__ ((__regparm__ (1)));
|
|---|
| 1246 | extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf)
|
|---|
| 1247 | __attribute__ ((__regparm__ (1))) __attribute__ ((__noreturn__))
|
|---|
| 1248 | __attribute__ ((__weak__))
|
|---|
| 1249 | ;
|
|---|
| 1250 | struct __jmp_buf_tag;
|
|---|
| 1251 | extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __attribute__ ((__nothrow__));
|
|---|
| 1252 | extern int pthread_mutex_init (pthread_mutex_t *__mutex,
|
|---|
| 1253 | const pthread_mutexattr_t *__mutexattr)
|
|---|
| 1254 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1255 | extern int pthread_mutex_destroy (pthread_mutex_t *__mutex)
|
|---|
| 1256 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1257 | extern int pthread_mutex_trylock (pthread_mutex_t *__mutex)
|
|---|
| 1258 | __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1259 | extern int pthread_mutex_lock (pthread_mutex_t *__mutex)
|
|---|
| 1260 | __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1261 | extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
|
|---|
| 1262 | const struct timespec *__restrict
|
|---|
| 1263 | __abstime) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 1264 | extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
|
|---|
| 1265 | __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1266 | extern int pthread_mutex_getprioceiling (const pthread_mutex_t *
|
|---|
| 1267 | __restrict __mutex,
|
|---|
| 1268 | int *__restrict __prioceiling)
|
|---|
| 1269 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 1270 | extern 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)));
|
|---|
| 1274 | extern int pthread_mutex_consistent (pthread_mutex_t *__mutex)
|
|---|
| 1275 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1276 | extern int pthread_mutexattr_init (pthread_mutexattr_t *__attr)
|
|---|
| 1277 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1278 | extern int pthread_mutexattr_destroy (pthread_mutexattr_t *__attr)
|
|---|
| 1279 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1280 | extern int pthread_mutexattr_getpshared (const pthread_mutexattr_t *
|
|---|
| 1281 | __restrict __attr,
|
|---|
| 1282 | int *__restrict __pshared)
|
|---|
| 1283 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 1284 | extern int pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr,
|
|---|
| 1285 | int __pshared)
|
|---|
| 1286 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1287 | extern int pthread_mutexattr_gettype (const pthread_mutexattr_t *__restrict
|
|---|
| 1288 | __attr, int *__restrict __kind)
|
|---|
| 1289 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 1290 | extern int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind)
|
|---|
| 1291 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1292 | extern int pthread_mutexattr_getprotocol (const pthread_mutexattr_t *
|
|---|
| 1293 | __restrict __attr,
|
|---|
| 1294 | int *__restrict __protocol)
|
|---|
| 1295 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 1296 | extern int pthread_mutexattr_setprotocol (pthread_mutexattr_t *__attr,
|
|---|
| 1297 | int __protocol)
|
|---|
| 1298 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1299 | extern int pthread_mutexattr_getprioceiling (const pthread_mutexattr_t *
|
|---|
| 1300 | __restrict __attr,
|
|---|
| 1301 | int *__restrict __prioceiling)
|
|---|
| 1302 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 1303 | extern int pthread_mutexattr_setprioceiling (pthread_mutexattr_t *__attr,
|
|---|
| 1304 | int __prioceiling)
|
|---|
| 1305 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1306 | extern int pthread_mutexattr_getrobust (const pthread_mutexattr_t *__attr,
|
|---|
| 1307 | int *__robustness)
|
|---|
| 1308 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 1309 | extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,
|
|---|
| 1310 | int __robustness)
|
|---|
| 1311 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1312 | extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock,
|
|---|
| 1313 | const pthread_rwlockattr_t *__restrict
|
|---|
| 1314 | __attr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1315 | extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock)
|
|---|
| 1316 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1317 | extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock)
|
|---|
| 1318 | __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1319 | extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock)
|
|---|
| 1320 | __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1321 | extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
|
|---|
| 1322 | const struct timespec *__restrict
|
|---|
| 1323 | __abstime) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 1324 | extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock)
|
|---|
| 1325 | __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1326 | extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock)
|
|---|
| 1327 | __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1328 | extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock,
|
|---|
| 1329 | const struct timespec *__restrict
|
|---|
| 1330 | __abstime) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 1331 | extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock)
|
|---|
| 1332 | __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1333 | extern int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr)
|
|---|
| 1334 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1335 | extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr)
|
|---|
| 1336 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1337 | extern int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t *
|
|---|
| 1338 | __restrict __attr,
|
|---|
| 1339 | int *__restrict __pshared)
|
|---|
| 1340 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 1341 | extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr,
|
|---|
| 1342 | int __pshared)
|
|---|
| 1343 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1344 | extern int pthread_rwlockattr_getkind_np (const pthread_rwlockattr_t *
|
|---|
| 1345 | __restrict __attr,
|
|---|
| 1346 | int *__restrict __pref)
|
|---|
| 1347 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 1348 | extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr,
|
|---|
| 1349 | int __pref) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1350 | extern int pthread_cond_init (pthread_cond_t *__restrict __cond,
|
|---|
| 1351 | const pthread_condattr_t *__restrict __cond_attr)
|
|---|
| 1352 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1353 | extern int pthread_cond_destroy (pthread_cond_t *__cond)
|
|---|
| 1354 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1355 | extern int pthread_cond_signal (pthread_cond_t *__cond)
|
|---|
| 1356 | __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1357 | extern int pthread_cond_broadcast (pthread_cond_t *__cond)
|
|---|
| 1358 | __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1359 | extern int pthread_cond_wait (pthread_cond_t *__restrict __cond,
|
|---|
| 1360 | pthread_mutex_t *__restrict __mutex)
|
|---|
| 1361 | __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 1362 | extern 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)));
|
|---|
| 1366 | extern int pthread_condattr_init (pthread_condattr_t *__attr)
|
|---|
| 1367 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1368 | extern int pthread_condattr_destroy (pthread_condattr_t *__attr)
|
|---|
| 1369 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1370 | extern int pthread_condattr_getpshared (const pthread_condattr_t *
|
|---|
| 1371 | __restrict __attr,
|
|---|
| 1372 | int *__restrict __pshared)
|
|---|
| 1373 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 1374 | extern int pthread_condattr_setpshared (pthread_condattr_t *__attr,
|
|---|
| 1375 | int __pshared) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1376 | extern 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)));
|
|---|
| 1380 | extern int pthread_condattr_setclock (pthread_condattr_t *__attr,
|
|---|
| 1381 | __clockid_t __clock_id)
|
|---|
| 1382 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1383 | extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared)
|
|---|
| 1384 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1385 | extern int pthread_spin_destroy (pthread_spinlock_t *__lock)
|
|---|
| 1386 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1387 | extern int pthread_spin_lock (pthread_spinlock_t *__lock)
|
|---|
| 1388 | __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1389 | extern int pthread_spin_trylock (pthread_spinlock_t *__lock)
|
|---|
| 1390 | __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1391 | extern int pthread_spin_unlock (pthread_spinlock_t *__lock)
|
|---|
| 1392 | __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1393 | extern 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)));
|
|---|
| 1397 | extern int pthread_barrier_destroy (pthread_barrier_t *__barrier)
|
|---|
| 1398 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1399 | extern int pthread_barrier_wait (pthread_barrier_t *__barrier)
|
|---|
| 1400 | __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1401 | extern int pthread_barrierattr_init (pthread_barrierattr_t *__attr)
|
|---|
| 1402 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1403 | extern int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr)
|
|---|
| 1404 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1405 | extern int pthread_barrierattr_getpshared (const pthread_barrierattr_t *
|
|---|
| 1406 | __restrict __attr,
|
|---|
| 1407 | int *__restrict __pshared)
|
|---|
| 1408 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
|
|---|
| 1409 | extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr,
|
|---|
| 1410 | int __pshared)
|
|---|
| 1411 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1412 | extern int pthread_key_create (pthread_key_t *__key,
|
|---|
| 1413 | void (*__destr_function) (void *))
|
|---|
| 1414 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
|
|---|
| 1415 | extern int pthread_key_delete (pthread_key_t __key) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1416 | extern void *pthread_getspecific (pthread_key_t __key) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1417 | extern int pthread_setspecific (pthread_key_t __key,
|
|---|
| 1418 | const void *__pointer) __attribute__ ((__nothrow__ , __leaf__)) ;
|
|---|
| 1419 | extern int pthread_getcpuclockid (pthread_t __thread_id,
|
|---|
| 1420 | __clockid_t *__clock_id)
|
|---|
| 1421 | __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
|
|---|
| 1422 | extern int pthread_atfork (void (*__prepare) (void),
|
|---|
| 1423 | void (*__parent) (void),
|
|---|
| 1424 | void (*__child) (void)) __attribute__ ((__nothrow__ , __leaf__));
|
|---|
| 1425 |
|
|---|
| 1426 | typedef 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;
|
|---|
| 1439 | int 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 | }
|
|---|
| 1477 | int 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 | }
|
|---|
| 1501 | void 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 | }
|
|---|
| 1507 | void 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 | }
|
|---|
| 1513 | int 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 | }
|
|---|
| 1543 | int 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 | }
|
|---|
| 1583 | int 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 | }
|
|---|
| 1594 | int 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 | }
|
|---|
| 1604 | typedef struct thread_tag
|
|---|
| 1605 | {
|
|---|
| 1606 | pthread_t pid;
|
|---|
| 1607 | int id;
|
|---|
| 1608 | bounded_buf_t * bbuf;
|
|---|
| 1609 | }thread_t;
|
|---|
| 1610 | void * 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 | }
|
|---|
| 1629 | void * 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 | }
|
|---|
| 1650 | int 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 | }
|
|---|