]> andersk Git - splint.git/blob - lib/linux.h
noexpand always false.
[splint.git] / lib / linux.h
1 /*
2 ** linux.h
3 */
4
5 /*
6 ** Based on Linux Standard Base Specification 1.0.0 
7 ** http://www.linuxbase.org/spec/gLSB/gLSB/libc-ddefs.html
8 */
9
10 /*
11
12 Data Definitions for libc
13
14 dirent.h
15 */
16
17 typedef struct __dirstream DIR;
18
19 /* Not in LSB: based on RedHat 7.0: */
20
21 struct dirent {
22 #ifndef __USE_FILE_OFFSET64
23     __ino_t d_ino;
24     __off_t d_off;
25 #else
26     __ino64_t d_ino;
27     __off64_t d_off;
28 #endif
29   unsigned short int d_reclen;
30   unsigned char d_type;
31   char d_name[256];             /* We must not include limits.h! */
32 } ; 
33
34 /*@i43 struct dirent not in LSB spec
35        why doesn't alphasort64 use struct dirent64's?
36 */
37
38 int acct (/*@null@*/ const char *filename) 
39    /*:statusreturn@*/
40    /*@modifies systemState@*/ ;
41
42 int alphasort (const struct dirent **a, const struct dirent **b) /*@*/ ;
43 int alphasort64(const struct dirent **a, const struct dirent **b) /*@*/ ; 
44
45 /*
46 ftw.h
47 */
48
49 typedef int (*__ftw_func_t) (char *__filename, struct stat * __status,
50                              int __flag);
51
52 typedef int (*__ftw64_func_t) (char *__filename, struct stat64 * __status,
53                                int __flag);
54
55 typedef int (*__nftw_func_t) (char *__filename, struct stat * __status,
56                               int __flag, struct FTW * __info);
57
58 typedef int (*__nftw64_func_t) (char *__filename, struct stat64 * __status,
59                                 int __flag, struct FTW * __info);
60
61 /* 
62 glob.h
63 */
64
65 typedef struct
66 {
67   __size_t gl_pathc;
68   char **gl_pathv;
69   __size_t gl_offs;
70   int gl_flags;
71   void (*gl_closedir) ();
72   struct dirent64 *(*gl_readdir) ();
73   void *(*gl_opendir) ();
74   int (*gl_lstat) ();
75   int (*gl_stat) ();
76 }
77 glob_t;
78
79 typedef struct
80 {
81   __size_t gl_pathc;
82   char **gl_pathv;
83   __size_t gl_offs;
84   int gl_flags;
85   void (*gl_closedir) ();
86   struct dirent64 *(*gl_readdir) ();
87   void *(*gl_opendir) ();
88   int (*gl_lstat) ();
89   int (*gl_stat) ();
90 }
91 glob64_t;
92  
93 /*
94 grp.h
95 */
96
97 struct group
98 {
99   char *gr_name;
100   char *gr_passwd;
101   __gid_t gr_gid;
102   char **gr_mem;
103 }
104 ;
105  
106 /*
107 iconv.h
108 */
109
110 typedef void *iconv_t;
111  
112 /*
113 inttypes.h
114 */
115
116 typedef lldiv_t imaxdiv_t;
117
118 typedef long long intmax_t;
119
120 typedef unsigned long long uintmax_t;
121  
122 /*
123 locale.h
124 */
125
126 struct lconv
127 {
128   char *decimal_point;
129   char *thousands_sep;
130   char *grouping;
131   char *int_curr_symbol;
132   char *currency_symbol;
133   char *mon_decimal_point;
134   char *mon_thousands_sep;
135   char *mon_grouping;
136   char *positive_sign;
137   char *negative_sign;
138   char int_frac_digits;
139   char frac_digits;
140   char p_cs_precedes;
141   char p_sep_by_space;
142   char n_cs_precedes;
143   char n_sep_by_space;
144   char p_sign_posn;
145   char n_sign_posn;
146 }
147 ;
148  
149 /*
150 nl_types.h
151 */
152
153 typedef void *nl_catd;
154
155 typedef int nl_item;
156  
157 /*
158 pwd.h
159 */
160
161 struct passwd
162 {
163   char *pw_name;
164   char *pw_passwd;
165   __uid_t pw_uid;
166   __gid_t pw_gid;
167   char *pw_gecos;
168   char *pw_dir;
169   char *pw_shell;
170 }
171 ;
172  
173 /*
174 regex.h
175 */
176
177 typedef unsigned long reg_syntax_t;
178
179 typedef struct re_pattern_buffer
180 {
181   unsigned char *buffer;
182   unsigned long allocated;
183   unsigned long used;
184   reg_syntax_t syntax;
185   char *fastmap;
186   char *translate;
187   size_t re_nsub;
188   unsigned int can_be_null;
189   unsigned int regs_allocated;
190   unsigned int fastmap_accurate;
191   unsigned int no_sub;
192   unsigned int not_bol;
193   unsigned int not_eol;
194   unsigned int newline_anchor;
195 }
196 regex_t;
197
198 typedef int regoff_t;
199
200 typedef struct
201 {
202   regoff_t rm_so;
203   regoff_t rm_eo;
204 }
205 regmatch_t;
206  
207 /*
208 search.h
209 */
210
211 typedef enum
212 {
213   FIND,
214   ENTER
215 }
216 ACTION;
217
218 typedef enum
219 {
220   preorder,
221   postorder,
222   endorder,
223   leaf
224 }
225 VISIT;
226
227 typedef struct entry
228 {
229   char *key;
230   void *data;
231 }
232 ENTRY;
233
234 typedef void (*__action_fn_t) (void *__nodep, VISIT __value, int __level);
235  
236 /*
237 setjmp.h
238 */
239
240 typedef int __jmp_buf;
241
242 typedef struct __jmp_buf_tag
243 {
244   __jmp_buf __jmpbuf;
245   int __mask_was_saved;
246   __sigset_t __saved_mask;
247 }
248 jmp_buf;
249
250 typedef jmp_buf sigjmp_buf;
251  
252 /*
253 signal.h
254 */
255
256 typedef union sigval
257 {
258   int sival_int;
259   void *sival_ptr;
260 }
261 sigval_t;
262
263 typedef void (*__sighandler_t) ();
264
265 struct sigevent
266 {
267   sigval_t sigev_value;
268   int sigev_signo;
269   int sigev_notify;
270 }
271 ;
272
273 typedef struct
274 {
275   unsigned long __val[1];
276 }
277 __sigset_t;
278
279 typedef __sigset_t sigset_t;
280
281 struct sigaction;
282
283 typedef struct
284 {
285   int si_band;
286   int si_fd;
287   struct _sifields;
288   struct _sigpoll;
289 }
290 siginfo_t;
291
292 struct sigaltstack
293 {
294   void *ss_sp;
295   int ss_flags;
296   size_t ss_size;
297 }
298 ;
299
300 struct sigstack
301 {
302   void *ss_sp;
303   int ss_onstack;
304 }
305 ;
306  
307 /*
308 stdio.h
309 */
310
311 typedef struct _IO_FILE FILE;
312
313 typedef __off_t fpos_t;
314
315 typedef __off64_t fpos64_t;
316  
317 /*
318 stdlib.h
319 */
320
321 typedef struct
322 {
323   long long quot;
324   long long rem;
325 }
326 lldiv_t;
327
328 typedef struct
329 {
330   int quot;
331   int rem;
332 }
333 div_t;
334
335 typedef struct
336 {
337   long quot;
338   long rem;
339 }
340 ldiv_t;
341
342 typedef int (*__compar_fn_t) ();
343  
344 /*
345 sys/sem.h
346 */
347
348 struct sembuf
349 {
350   short sem_num;
351   short sem_op;
352   short sem_flg;
353 }
354 ;
355  
356 /*
357 sys/socket.h
358 */
359
360 typedef unsigned short sa_family_t;
361
362 typedef unsigned int socklen_t;
363
364 struct sockaddr
365 {
366   sa_family_t sa_family;
367   char sa_data[1];
368 }
369 ;
370
371 struct msghdr
372 {
373   void *msg_name;
374   socklen_t msg_namelen;
375   struct iovec *msg_iov;
376   size_t msg_iovlen;
377   void *msg_control;
378   size_t msg_controllen;
379   int msg_flags;
380 }
381 ;
382  
383 /*
384 sys/times.h
385 */
386
387 struct tms
388 {
389   clock_t tms_utime;
390   clock_t tms_stime;
391   clock_t tms_cutime;
392   clock_t tms_cstime;
393 }
394 ;
395  
396 /*
397 sys/utsname.h
398 */
399
400 struct utsname
401 {
402   char sysname[1];
403   char nodename[1];
404   char release[1];
405   char version[1];
406   char machine[1];
407   char __domainname[1];
408 }
409 ;
410  
411 /*
412 sys/wait.h
413 */
414
415 typedef enum
416 {
417   P_ALL,
418   P_PID,
419   P_PGID
420 }
421 idtype_t;
422  
423 /*
424 time.h
425 */
426
427 typedef long __clock_t;
428
429 struct timespec
430 {
431   long tv_sec;
432   long tv_nsec;
433 }
434 ;
435
436 struct tm
437 {
438   int tm_sec;
439   int tm_min;
440   int tm_hour;
441   int tm_mday;
442   int tm_mon;
443   int tm_year;
444   int tm_wday;
445   int tm_yday;
446   int tm_isdst;
447   long __tm_gmtoff;
448   char *__tm_zone;
449 }
450 ;
451
452 typedef __clock_t clock_t;
453
454 typedef __time_t time_t;
455  
456 int adjtime (/*@notnull@*/ const struct timeval *delta, /*@null@*/ struct timeval *olddelta)
457      /*@warn superuser "Only super-user processes may call adjtime."@*/
458      /*:statusreturn@*/ 
459      /*@modifies systemState@*/ ;
460
461 /*
462 unistd.h
463 */
464
465 typedef __ssize_t ssize_t;
466
467 typedef __pid_t pid_t;
468
469 typedef __off_t off_t;
470
471 extern /*@observer@*/ /*@nullterminated@*/ /*@null@*/ 
472 char *bindtextdomain (/*@null@*/ /*@nullterminated@*/ const char *domainname,
473                       /*@null@*/ /*@nullterminated@*/ const char *dirname) /*@*/ ;
474 /* LSB doesn't specify: taken from
475    http://www.hgmp.mrc.ac.uk/cgi-bin/man.cgi?section=3C&topic=bindtextdomain
476 */
477  
478
479 /*
480 utime.h
481 */
482
483 struct utimbuf
484 {
485   __time_t actime;
486   __time_t modtime;
487 }
488 ;
489  
490 /*
491 wchar.h
492 */
493
494 typedef long wchar_t;
495
496 typedef unsigned int wint_t;
497
498 typedef struct
499 {
500   int count;
501   wint_t value;
502 }
503 mbstate_t;
504  
505 /*
506 wctype.h
507 */
508
509 typedef unsigned long wctype_t;
510
511 typedef __int32_t *wctrans_t;
512  
513 /*
514 wordexp.h
515 */
516
517 typedef struct
518 {
519   int we_wordc;
520   char **we_wordv;
521   int we_offs;
522 }
523 wordexp_t;
524  
525 /*
526 timex.h
527 */
528
529 struct timex {
530   int modes; /* mode selector */
531   long offset; /* time offset (usec) */
532   long freq; /* frequency offset (scaled ppm) */
533   long maxerror; /* maximum error (usec) */
534   long esterror; /* estimated error (usec) */
535   int status; /* clock command/status */
536   long constant; /* pll time constant */
537   long precision; /* clock precision (usec) (read only) */
538   long tolerance; /* clock frequency tolerance (ppm) (read only) */
539   struct timeval time; /* current time (read only) */
540   long tick; /* usecs between clock ticks */
541
542 };
543
544 /*@constant int ADJ_OFFSET@*/
545 /*@constant int ADJ_FREQUENCY@*/
546 /*@constant int ADJ_MAXERROR@*/
547 /*@constant int ADJ_ESTERROR@*/
548 /*@constant int ADJ_STATUS@*/
549 /*@constant int ADJ_TIMECONST@*/
550 /*@constant int ADJ_TICK@*/
551 /*@constant int ADJ_OFFSET_SINGLESHOT@*/
552
553 int adjtimex (/*@notnull@*/ struct timex *buf)
554      /*@warn superuser "Only super-user processes may call adjtimex unless the modes field is 0."@*/
555      /*:statusreturn@*/
556      /*@modifies systemState@*/ ;
557
558 /*
559 termios.h
560 */
561
562 typedef unsigned char   cc_t;
563 typedef unsigned int    speed_t;
564 typedef unsigned int    tcflag_t;
565
566 struct termios
567 {
568   tcflag_t c_iflag;             /* input mode flags */
569   tcflag_t c_oflag;             /* output mode flags */
570   tcflag_t c_cflag;             /* control mode flags */
571   tcflag_t c_lflag;             /* local mode flags */
572   cc_t c_cc[NCCS];              /* control characters */
573 };
574
575 int cfmakeraw (/*@out@*/ struct termios *termios_p)
576      /*:statusreturn@*/ ; 
577
578 int cfsetspeed(struct termios *t, speedt speed)
579      /*:statusreturn@*/ ;
580    
581 /*
582 ** Built in
583 */
584
585 /*@exits@*/ void __assert_fail (/*@notnull@*/ const char *assertion,
586                                 /*@notnull@*/ const char *file,
587                                 unsigned int line,
588                                 /*@null@*/ const char *function) 
589      /*@modifies stderr@*/;
This page took 0.079153 seconds and 5 git commands to generate.