]> andersk Git - splint.git/blob - lib/unix.h
*** empty log message ***
[splint.git] / lib / unix.h
1 /*
2 ** unix.h
3 */
4
5 /*@-nextlinemacros@*/
6
7 /*
8 ** Extra stuff in some unixen, not in posix.
9 */
10
11 /*@unchecked@*/ int signgam;
12
13 typedef /*@integraltype@*/ clockid_t;
14
15 extern void bcopy (char *b1, /*@out@*/ char *b2, int length) 
16    /*@modifies *b2@*/ ;  /* Yes, the second parameter is the out param! */
17
18 extern int /*@alt lltX_bool@*/ bcmp (char *b1, char *b2, int length) /*@*/ ;
19    /* Return value is NOT like strcmp! */
20
21 extern void bzero (/*@out@*/ char *b1, int length) /*@modifies *b1@*/ ;
22 extern int ffs (int i) /*@*/ ;
23 extern int symlink (char *name1, char *name2) /*@modifies fileSystem@*/ ;
24
25 extern int 
26   setvbuf_unlocked (FILE *stream, /*@null@*/ /*@exposed@*/ char *buf, 
27                     int mode, size_t size)
28   /*@modifies internalState@*/ ;
29
30 extern void 
31   setbuffer (FILE *stream, /*@null@*/ /*@exposed@*/ char *buf, int size)
32   /*@modifies internalState@*/ ;
33
34 extern void setlinebuf (FILE *stream) /*@modifies internalState@*/ ;
35
36 extern int strerror_r (int errnum, /*@out@*/ char *strerrbuf, int buflen)
37   /*@modifies strerrbuf@*/ ;
38
39 extern size_t 
40   fread_unlocked (/*@out@*/ void *ptr, size_t size, size_t nitems, 
41                   FILE *stream) 
42   /*@modifies *stream, *ptr;@*/ ;
43
44 extern size_t 
45   fwrite_unlocked (void *pointer, size_t size, size_t num_items, FILE *stream)
46   /*@modifies *stream;@*/ ;
47
48 extern void funlockfile (FILE *file) /*@modifies *file;@*/ ;
49 extern void flockfile (FILE *file) /*@modifies *file@*/ ;
50
51 extern void /*@alt void * @*/ 
52   memccpy (/*@returned@*/ /*@out@*/ void *s1, 
53            /*@unique@*/ void *s2, int c, size_t n) 
54   /*@modifies *s1@*/ ;
55
56 extern int strcasecmp (char *s1, char *s2) /*@*/ ;
57 extern int strncasecmp (char *s1, char *s2, int n) /*@*/ ;
58 extern char *strdup (char *s) /*@*/ ;
59
60 extern /*@null@*/ char *tempnam (char *dir, /*@null@*/ char *pfx) 
61    /*@modifies internalState@*/ ;
62
63 extern /*@null@*/ /*@dependent@*/ char *
64   index (/*@returned@*/ char *s, char c) /*@*/ ;
65
66 extern /*@null@*/ /*@dependent@*/ char *
67   rindex (/*@returned@*/ char *s, char c) /*@*/ ;
68
69 extern /*@dependent@*/ /*@null@*/ FILE *popen (char *command, char *ttype)
70    /*@modifies fileSystem, errno@*/ ;
71 extern int pclose (FILE *stream) /*@modifies fileSystem, *stream, errno@*/ ;
72
73 extern double cbrt (double x) /*@modifies errno@*/ ;
74 extern double rint (double x) /*@*/ ;
75 extern double trunc (double x) /*@*/ ; 
76
77 /*@constant int ENOTBLK@*/
78 /*@constant int ETXTBSY@*/
79 /*@constant int EWOULDBLOCK@*/
80 /*@constant int EINPROGRESS@*/
81 /*@constant int EALREADY@*/
82 /*@constant int ENOTSOCK@*/
83 /*@constant int EDESTADDRREQ@*/
84 /*@constant int EMSGSIZE@*/
85 /*@constant int EPROTOTYPE@*/
86 /*@constant int ENOPROTOOPT@*/
87 /*@constant int EPROTONOSUPPORT@*/
88 /*@constant int ESOCKTNOSUPPORT@*/
89 /*@constant int EOPNOTSUPP@*/
90 /*@constant int EPFNOSUPPORT@*/
91 /*@constant int EAFNOSUPPORT@*/
92 /*@constant int EADDRINUSE@*/
93 /*@constant int EADDRNOTAVAIL@*/
94 /*@constant int ENETDOWN@*/
95 /*@constant int ENETUNREACH@*/
96 /*@constant int ENETRESET@*/
97 /*@constant int ECONNABORTED@*/
98 /*@constant int ECONNRESET@*/
99 /*@constant int ENOBUFS@*/
100 /*@constant int EISCONN@*/
101 /*@constant int ENOTCONN@*/
102 /*@constant int ESHUTDOWN@*/
103 /*@constant int ETOOMANYREFS@*/
104 /*@constant int ETIMEDOUT@*/
105 /*@constant int ECONNREFUSED@*/
106 /*@constant int ENAMETOOLONG@*/
107 /*@constant int EHOSTDOWN@*/
108 /*@constant int EHOSTUNREACH@*/
109 /*@constant int ENOTEMPTY@*/
110 /*@constant int EPROCLIM@*/
111 /*@constant int EUSERS@*/
112 /*@constant int EDQUOT@*/
113 /*@constant int ESTALE@*/
114 /*@constant int EREMOTE@*/
115 /*@constant int ENOMSG@*/
116 /*@constant int EIDRM@*/
117 /*@constant int EALIGN@*/
118 /*@constant int EDEADLK@*/
119 /*@constant int ENOLCK@*/
120 /*@constant int ENOSYS@*/
121 /*@constant int EACTIVE@*/
122 /*@constant int ENOACTIVE@*/
123 /*@constant int ENORESOURCES@*/
124 /*@constant int ENOSYSTEM@*/
125 /*@constant int ENODUST@*/
126 /*@constant int EDUPNOCONN@*/
127 /*@constant int EDUPNODISCONN@*/
128 /*@constant int EDUPNOTCNTD@*/
129 /*@constant int EDUPNOTIDLE@*/
130 /*@constant int EDUPNOTWAIT@*/
131 /*@constant int EDUPNOTRUN@*/
132 /*@constant int EDUPBADOPCODE@*/
133 /*@constant int EDUPINTRANSIT@*/
134 /*@constant int EDUPTOOMANYCPUS@*/
135 /*@constant int ELOOP@*/
136
137 /*@constant int LOCK_MAX@*/
138 /*@constant int FCHR_MAX@*/
139 /*@constant int USI_MAX@*/
140 /*@constant int WORD_BIT@*/
141 /*@constant int LONG_BIT@*/
142 /*@constant long NAME_MAX@*/
143 /*@constant long NGROUPS_MAX@*/
144 /*@constant long MAX_INPUT@*/
145 /*@constant long MAX_CANON@*/
146 /*@constant int MAX_CHAR@*/
147 /*@constant long OPEN_MAX@*/
148 /*@constant int PASS_MAX@*/
149 /*@constant int PATH_MAX@*/
150 /*@constant int PID_MAX@*/
151 /*@constant int SYSPID_MAX@*/
152 /*@constant long PIPE_BUF@*/
153 /*@constant int PIPE_MAX@*/
154 /*@constant int PROC_MAX@*/
155 /*@constant int STD_BLK@*/
156 /*@constant int SYS_NMLN@*/
157 /*@constant int SYS_OPEN@*/
158 /*@constant int NZERO@*/
159 /*@constant int UID_MAX@*/
160 /*@constant long MB_LEN_MAX@*/
161 /*@constant int NL_ARGMAX@*/
162 /*@constant int NL_MSGMAX@*/
163 /*@constant int NL_NMAX@*/
164 /*@constant int NL_SETMAX@*/
165 /*@constant int NL_TEXTMAX@*/
166 /*@constant int NL_LBLMAX@*/
167 /*@constant int NL_LANGMAX @*/
168
169 /*@constant double M_E@*/
170 /*@constant double M_LOG2E@*/
171 /*@constant double M_LOG10E@*/
172 /*@constant double M_LN2@*/
173 /*@constant double M_LN10@*/
174 /*@constant double M_PI@*/
175 /*@constant double M_PI_2@*/
176 /*@constant double M_PI_4@*/
177 /*@constant double M_1_PI@*/
178 /*@constant double M_2_PI@*/
179 /*@constant double M_2_SQRTPI@*/
180 /*@constant double M_SQRT2@*/
181 /*@constant double M_SQRT1_2@*/ 
182
183 /*@constant double MAXFLOAT@*/
184 /*@constant double HUGE@*/
185  
186 /*@constant int DOMAIN@*/
187 /*@constant int SING@*/
188 /*@constant int OVERFLOW@*/
189 /*@constant int UNDERFLOW@*/
190 /*@constant int TLOSS@*/
191 /*@constant int PLOSS@*/
192
193 extern /*@unchecked@*/ int daylight;
194 extern /*@unchecked@*/ long timezone;
195 extern /*@unchecked@*/ char *tzname[];
196
197 /*@-incondefs@*/
198 extern void tzset(void) /*@modifies daylight, timezone, tzname@*/ ;
199 /*@=incondefs@*/
200
201 typedef unsigned char uchar_t;
202 typedef unsigned short ushort_t;
203 typedef unsigned int uint_t;
204 typedef unsigned long ulong_t;
205 typedef volatile unsigned char vuchar_t;
206 typedef volatile unsigned short vushort_t;
207 typedef volatile unsigned int vuint_t;
208 typedef volatile unsigned long vulong_t;
209 typedef long label_t;
210 typedef int level_t;
211 typedef /*@integraltype@*/ daddr_t;
212 typedef char *caddr_t;  
213 typedef long *qaddr_t; 
214 typedef char *addr_t;
215 typedef long physadr_t;
216 typedef short cnt_t;
217 typedef int chan_t;     
218 typedef unsigned long rlim_t;
219 typedef int paddr_t;
220 typedef /*@integraltype@*/ key_t;
221 typedef void *mid_t;
222 typedef char slab_t[12];        
223 typedef ulong_t shmatt_t;       
224 typedef ulong_t msgqnum_t;      
225 typedef ulong_t msglen_t;
226 typedef long timer_t;
227 typedef uchar_t uchar;
228 typedef ushort_t ushort;
229 typedef uint_t uint;
230 typedef ulong_t ulong;
231 typedef uchar_t u_char;
232 typedef ushort_t u_short;
233 typedef uint_t u_int;
234 typedef ulong_t u_long;
235 typedef vuchar_t vu_char;
236 typedef vushort_t vu_short;
237 typedef vuint_t vu_int;
238 typedef vulong_t vu_long;
239 typedef long swblk_t;
240 typedef u_long fixpt_t;
241 typedef long segsz_t;
242 typedef /*@abstract@*/ fd_set;
243
244 /* Check ISO C99 inttypes.h ... */
245 typedef unsigned int u_int32_t;
246 typedef unsigned int uint32_t;
247
248 typedef unsigned short int u_int16_t;
249 typedef unsigned short int uint16_t;
250
251 int ttyname_r (int fg, /*@out@*/ char *buffer, int len) /*@modifies buffer@*/ ;
252 int ioctl (int d, int /*@alt long@*/ request, /*@out@*/ void *arg) 
253    /*@modifies *arg, errno@*/ ;  /* depends on request! */
254
255 pid_t vfork (void) /*@modifies fileSystem@*/ ;
256
257
258  struct iovec {
259         void    *iov_base;
260         size_t   iov_len;
261 };
262
263 /*@constant int UIO_MAXIOV@*/   /* BSD */
264 /*@constant int IOV_MAX@*/      /* supposedly SVR4 */
265
266         extern ssize_t
267 readv (int fd, const struct iovec iov[], int iovcnt)
268         /*@modifies iov[].iov_base, fileSystem, errno@*/;
269
270         extern ssize_t
271 writev (int fd, const struct iovec iov[], int iovcnt)
272         /*@modifies errno@*/;
273
274 /*________________________________________________________________________
275  * poll.h
276  */
277
278  struct poll {
279         int fd;
280         short events;
281         short revents;
282 };
283
284 /*@constant short POLLIN@*/
285 /*@constant short POLLRDNORM@*/
286 /*@constant short POLLRDBAND@*/
287 /*@constant short POLLPRI@*/
288 /*@constant short POLLOUT@*/
289 /*@constant short POLLWRNORM@*/
290 /*@constant short POLLWRBAND@*/
291 /*@constant short POLLERR@*/
292 /*@constant short POLLHUP@*/
293 /*@constant short POLLNVAL@*/
294
295 extern int poll (struct poll pollfd[], unsigned long nfds, int timeout)
296   /*@modifies pollfd[].revents, errno@*/ ;
297
298 /*
299 ** free does not take null
300 */
301
302 /*@-incondefs@*/
303 extern void free (/*@notnull@*/ /*@out@*/ /*@only@*/ void *p) /*@modifies *p@*/ ;
304 /*@=incondefs@*/
305
306 /*________________________________________________________________________
307  * sys/socket.h
308  */
309
310 /*@constant int SOCK_STREAM@*/
311 /*@constant int SOCK_DGRAM@*/
312 /*@constant int SOCK_RAW@*/
313 /*@constant int SOCK_RDM@*/
314 /*@constant int SOCK_SEQPACKET@*/
315 /*@constant int SO_DEBUG@*/
316 /*@constant int SO_ACCEPTCONN@*/
317 /*@constant int SO_REUSEADDR@*/
318 /*@constant int SO_KEEPALIVE@*/
319 /*@constant int SO_DONTROUTE@*/
320 /*@constant int SO_BROADCAST@*/
321 /*@constant int SO_USELOOPBACK@*/
322 /*@constant int SO_LINGER@*/
323 /*@constant int SO_OOBINLINE@*/
324 /*@constant int SO_REUSEPORT@*/
325 /*@constant int SO_SNDBUF@*/
326 /*@constant int SO_RCVBUF@*/
327 /*@constant int SO_SNDLOWAT@*/
328 /*@constant int SO_RCVLOWAT@*/
329 /*@constant int SO_SNDTIMEO@*/
330 /*@constant int SO_RCVTIMEO@*/
331 /*@constant int SO_ERROR@*/
332 /*@constant int SO_TYPE@*/
333 /*@constant int SOL_SOCKET@*/
334 /*@constant int AF_UNSPEC@*/
335 /*@constant int AF_LOCAL@*/
336 /*@constant int AF_UNIX@*/
337 /*@constant int AF_INET@*/
338 /*@constant int AF_IMPLINK@*/
339 /*@constant int AF_PUP@*/
340 /*@constant int AF_CHAOS@*/
341 /*@constant int AF_NS@*/
342 /*@constant int AF_ISO@*/
343 /*@constant int AF_OSI@*/
344 /*@constant int AF_ECMA@*/
345 /*@constant int AF_DATAKIT@*/
346 /*@constant int AF_CCITT@*/
347 /*@constant int AF_SNA@*/
348 /*@constant int AF_DECnet@*/
349 /*@constant int AF_DLI@*/
350 /*@constant int AF_LAT@*/
351 /*@constant int AF_HYLINK@*/
352 /*@constant int AF_APPLETALK@*/
353 /*@constant int AF_ROUTE@*/
354 /*@constant int AF_LINK@*/
355 /*@constant int pseudo_AF_XTP@*/
356 /*@constant int AF_COIP@*/
357 /*@constant int AF_CNT@*/
358 /*@constant int pseudo_AF_RTIP@*/
359 /*@constant int AF_IPX@*/
360 /*@constant int AF_SIP@*/
361 /*@constant int pseudo_AF_PIP@*/
362 /*@constant int AF_ISDN@*/
363 /*@constant int AF_E164@*/
364 /*@constant int AF_MAX@*/
365 /*@constant int MSG_OOB@*/
366 /*@constant int MSG_PEEK@*/
367 /*@constant int MSG_DONTROUTE@*/
368 /*@constant int MSG_EOR@*/
369 /*@constant int MSG_TRUNC@*/
370 /*@constant int MSG_CTRUNC@*/
371 /*@constant int MSG_WAITALL@*/
372 /*@constant int MSG_DONTWAIT@*/
373 /*@constant int MSG_EOF@*/
374 /*@constant int MSG_COMPAT@*/
375 /*@constant int PF_UNSPEC@*/
376 /*@constant int PF_LOCAL@*/
377 /*@constant int PF_UNIX@*/
378 /*@constant int PF_INET@*/
379 /*@constant int PF_IMPLINK@*/
380 /*@constant int PF_PUP@*/
381 /*@constant int PF_CHAOS@*/
382 /*@constant int PF_NS@*/
383 /*@constant int PF_ISO@*/
384 /*@constant int PF_OSI@*/
385 /*@constant int PF_ECMA@*/
386 /*@constant int PF_DATAKIT@*/
387 /*@constant int PF_CCITT@*/
388 /*@constant int PF_SNA@*/
389 /*@constant int PF_DECnet@*/
390 /*@constant int PF_DLI@*/
391 /*@constant int PF_LAT@*/
392 /*@constant int PF_HYLINK@*/
393 /*@constant int PF_APPLETALK@*/
394 /*@constant int PF_ROUTE@*/
395 /*@constant int PF_LINK@*/
396 /*@constant int PF_XTP@*/
397 /*@constant int PF_COIP@*/
398 /*@constant int PF_CNT@*/
399 /*@constant int PF_SIP@*/
400 /*@constant int PF_IPX@*/
401 /*@constant int PF_RTIP@*/
402 /*@constant int PF_PIP@*/
403 /*@constant int PF_ISDN@*/
404 /*@constant int PF_MAX@*/
405 /*@constant int NET_MAXID@*/
406 /*@constant int NET_RT_DUMP@*/
407 /*@constant int NET_RT_FLAGS@*/
408 /*@constant int NET_RT_IFLIST@*/
409 /*@constant int NET_RT_MAXID@*/
410 /*@constant int SOMAXCONN@*/
411 /*@constant int SCM_RIGHTS@*/
412
413  struct sockaddr {
414         u_char  sa_len;                 /* total length */
415         u_char  sa_family;              /* address family */
416         char    sa_data[14];            /* actually longer; address value */
417 };
418
419  struct linger {
420         int     l_onoff;                /* option on/off */
421         int     l_linger;               /* linger time */
422 };
423
424  struct sockproto {
425         u_short sp_family;              /* address family */
426         u_short sp_protocol;            /* protocol */
427 };
428  struct msghdr {
429         caddr_t msg_name;               /* optional address */
430         u_int   msg_namelen;            /* size of address */
431         struct  iovec *msg_iov;         /* scatter/gather array */
432         u_int   msg_iovlen;             /* # elements in msg_iov */
433         caddr_t msg_control;            /* ancillary data, see below */
434         u_int   msg_controllen;         /* ancillary data buffer len */
435         int     msg_flags;              /* flags on received message */
436 };
437
438  struct cmsghdr {
439         u_int   cmsg_len;               /* data byte count, including hdr */
440         int     cmsg_level;             /* originating protocol */
441         int     cmsg_type;              /* protocol-specific type */
442 /* followed by  u_char  cmsg_data[]; */
443 };
444
445         extern int
446 accept (int s, struct sockaddr *addr, int *addrlen)
447         /*@modifies *addrlen, errno@*/;
448
449         extern int
450 bind (int s, struct sockaddr *name, int namelen)
451         /*@modifies errno, fileSystem@*/;
452
453         extern int
454 connect (int s, struct sockaddr *name, int namelen)
455         /*@modifies errno, internalState@*/;
456
457 int getpeername (int s, /*@out@*/ struct sockaddr *name, size_t *namelen)
458         /*@modifies *name, *namelen, errno@*/;
459
460 int getsockname (int s, struct sockaddr *address, size_t *address_len)
461   /*?requires maxSet(address) > *address_len@*/ 
462   /*@modifies *address, *address_len, errno@*/;
463
464 int getsockopt (int s, int level, int optname, /*@out@*/ void *optval, size_t *optlen)
465         /*@modifies *optval, *optlen, errno@*/;
466
467         extern int
468 listen (int s, int backlog)
469         /*@modifies errno, internalState@*/;
470
471         extern ssize_t
472 recv (int s, /*@out@*/ void *buf, size_t len, int flags)
473         /*@modifies *buf, errno@*/;
474
475         extern ssize_t
476 recvfrom (int s, void *buf, size_t len, int flags, /*@null@*/ struct sockaddr *from, int *fromlen)
477         /*@modifies *buf, *from, *fromlen, errno@*/;
478
479         extern ssize_t
480 recvmsg (int s, struct msghdr *msg, int flags)
481         /*@modifies msg->msg_iov->iov_base[], errno@*/;
482
483         extern ssize_t
484 send (int s, const void *msg, size_t len, int flags)
485         /*@modifies errno@*/;
486
487         extern ssize_t
488 sendto (int s, const void *msg, size_t len, int flags, const struct sockaddr *to, int tolen)
489         /*@modifies errno@*/;
490
491         extern ssize_t
492 sendmsg (int s, const struct msghdr *msg, int flags)
493         /*@modifies errno@*/;
494
495         extern int
496 setsockopt (int s, int level, int optname, const void *optval, int optlen)
497         /*@modifies internalState, errno@*/;
498
499         extern int
500 shutdown (int s, int how)
501         /*@modifies errno@*/;
502
503         extern int
504 socket (int domain, int type, int protocol)
505         /*@modifies errno@*/;
506
507         extern int
508 socketpair (int d, int type, int protocol, /*@out@*/ int *sv)
509         /*@modifies errno@*/;
510
511 /*@constant int BADSIG@*/
512 /*@constant int SA_ONSTACK@*/
513 /*@constant int SA_RESTART@*/
514 /*@constant int SA_DISABLE@*/
515 /*@constant int SIGBUS@*/
516 /*@constant int SIGEMT@*/
517 /*@constant int SIGINFO@*/
518 /*@constant int SIGIO@*/
519 /*@constant int SIGIOT@*/
520 /*@constant int SIGPOLL@*/
521 /*@constant int SIGPROF@*/
522 /*@constant int SIGPWR@*/
523 /*@constant int SIGSYS@*/
524 /*@constant int SIGTRAP@*/
525 /*@constant int SIGURG@*/
526 /*@constant int SIGVTALRM@*/
527 /*@constant int SIGWINCH@*/
528 /*@constant int SIGXCPU@*/
529 /*@constant int SIGXFSZ@*/
530
531 extern void psignal (int sig, const char *msg)
532    /*@modifies fileSystem@*/;
533
534 /*@unchecked@*/ extern char *optarg;
535 /*@unchecked@*/ extern int optind;
536 /*@unchecked@*/ extern int optopt;
537 /*@unchecked@*/ extern int opterr;
538 /*@unchecked@*/ extern int optreset;
539
540         extern int
541 getopt (int argc, char * const *argv, const char *optstring)
542         /*@globals optarg, optind, optopt, opterr, optreset@*/
543         /*@modifies optarg, optind, optopt@*/;
544
545         extern int
546 setenv (const char *name, const char *value, int overwrite)
547         /*@globals environ@*/
548         /*@modifies *environ, errno@*/;
549
550         extern int
551 putenv (const char *string)
552         /*@globals environ@*/
553         /*@modifies *environ, errno@*/;
554
555         extern void
556 unsetenv (const char *name)
557         /*@globals environ@*/
558         /*@modifies *environ@*/;
559
560 /*________________________________________________________________________
561  * sys/wait.h
562  */
563
564         extern int
565 WCOREDUMP (int x)
566         /*@*/;
567
568         extern int
569 W_EXITCODE (int ret, int sig)
570         /*@*/;
571
572         extern int
573 W_STOPCODE (int sig)
574         /*@*/;
575
576 /*@constant int WAIT_ANY@*/
577 /*@constant int WAIT_MYPGRP@*/
578 /*@constant int WSTOPPED@*/
579
580         extern pid_t
581 wait3 (int *statloc, int options, /*@null@*/ /*@out@*/ struct rusage *rusage)
582         /*@modifies *statloc, *rusage, errno@*/;
583
584         extern pid_t
585 wait4 (pid_t p, int *statloc, int opt, /*@null@*/ /*@out@*/ struct rusage *r)
586         /*@modifies *statloc, *r, errno@*/;
587
588 struct timeval {
589   long  tv_sec;
590   long  tv_usec;
591 } ;
592
593 struct timespec {
594   long  ts_sec;
595   long  ts_nsec;
596 } ;
597
598 struct timezone {
599   int   tz_minuteswest;
600   int   tz_dsttime;
601 } ;
602
603 /*@constant int DST_NONE@*/
604 /*@constant int DST_USA@*/
605 /*@constant int DST_AUST@*/
606 /*@constant int DST_WET@*/
607 /*@constant int DST_MET@*/
608 /*@constant int DST_EET@*/
609 /*@constant int DST_CAN@*/
610
611 /*@constant int ITIMER_PROF@*/
612 /*@constant int ITIMER_REAL@*/
613 /*@constant int ITIMER_VIRTUAL@*/
614
615  struct itimerval {
616         struct  timeval it_interval;
617         struct  timeval it_value;
618 };
619
620  struct clockinfo {
621         int     hz;
622         int     tick;
623         int     stathz;
624         int     profhz;
625 };
626
627         extern int
628 adjtime (const struct timeval *delta, /*@null@*/ /*@out@*/ struct timeval *olddelta)
629         /*@modifies internalState, *olddelta, errno@*/;
630
631         extern int
632 getitimer (int which, /*@out@*/ struct itimerval *value)
633         /*@modifies errno, *value*/;
634
635         extern int
636 gettimeofday (/*@null@*/ /*@out@*/ struct timeval *tp, /*@null@*/ /*@out@*/ struct timezone *tzp)
637         /*@modifies *tp, *tzp, errno@*/;
638
639         extern int
640 setitimer (int which, struct itimerval *val, /*@null@*/ /*@out@*/ struct itimerval *oval)
641         /*@modifies *oval, errno, internalState*/;
642
643         extern int
644 settimeofday (const struct timeval *t, const struct timezone *z)
645         /*@modifies internalState, errno@*/;
646
647         extern int
648 utimes (const char *file, /*@null@*/ const struct timeval *times)
649         /*@modifies fileSystem, errno*/;
650
651 /*________________________________________________________________________
652  * sys/mman.h
653  */
654
655 /*@constant int PROT_READ@*/
656 /*@constant int PROT_WRITE@*/
657 /*@constant int PROT_EXEC@*/
658 /*@constant int MAP_SHARED@*/
659 /*@constant int MAP_PRIVATE@*/
660 /*@constant int MAP_COPY@*/
661 /*@constant int MAP_FIXED@*/
662 /*@constant int MAP_RENAME@*/
663 /*@constant int MAP_NORESERVE@*/
664 /*@constant int MAP_INHERIT@*/
665 /*@constant int MAP_NOEXTEND@*/
666 /*@constant int MAP_HASSEMAPHORE@*/
667 /*@constant int MS_ASYNC@*/
668 /*@constant int MS_INVALIDATE@*/
669 /*@constant int MAP_FILE@*/
670 /*@constant int MAP_ANON@*/
671 /*@constant int MADV_NORMAL@*/
672 /*@constant int MADV_RANDOM@*/
673 /*@constant int MADV_SEQUENTIAL@*/
674 /*@constant int MADV_WILLNEED@*/
675 /*@constant int MADV_DONTNEED@*/
676
677         extern caddr_t
678 mmap (/*@null@*/ /*@returned@*/ caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
679         /*@modifies addr@*/;
680
681         extern int
682 madvise (caddr_t addr, int len, int behav)
683         /*@*/;
684
685         extern int
686 mprotect (caddr_t addr, int len, int prot)
687         /*@*/;
688
689         extern int
690 munmap (caddr_t addr, size_t len)
691         /*@*/;
692
693         extern int
694 msync (caddr_t addr, int len, int flags)
695         /*@*/;
696
697         extern int
698 mlock (caddr_t addr, size_t len)
699         /*@*/;
700
701         extern int
702 munlock (caddr_t addr, size_t len)
703         /*@*/;
704
705
706 /*________________________________________________________________________
707  * sys/ioctl.h
708  */
709
710  struct winsize {
711         unsigned short  ws_row;
712         unsigned short  ws_col;
713         unsigned short  ws_xpixel;
714         unsigned short  ws_ypixel;
715 };
716
717 /*@constant int TIOCMODG@*/
718 /*@constant int TIOCMODS@*/
719 /*@constant int TIOCM_LE@*/
720 /*@constant int TIOCM_DTR@*/
721 /*@constant int TIOCM_RTS@*/
722 /*@constant int TIOCM_ST@*/
723 /*@constant int TIOCM_SR@*/
724 /*@constant int TIOCM_CTS@*/
725 /*@constant int TIOCM_CAR@*/
726 /*@constant int TIOCM_CD@*/
727 /*@constant int TIOCM_RNG@*/
728 /*@constant int TIOCM_RI@*/
729 /*@constant int TIOCM_DSR@*/
730 /*@constant int TIOCEXCL@*/
731 /*@constant int TIOCNXCL@*/
732 /*@constant int TIOCFLUSH@*/
733 /*@constant int TIOCGETA@*/
734 /*@constant int TIOCSETA@*/
735 /*@constant int TIOCSETAW@*/
736 /*@constant int TIOCSETAF@*/
737 /*@constant int TIOCGETD@*/
738 /*@constant int TIOCSETD@*/
739 /*@constant int TIOCSBRK@*/
740 /*@constant int TIOCCBRK@*/
741 /*@constant int TIOCSDTR@*/
742 /*@constant int TIOCCDTR@*/
743 /*@constant int TIOCGPGRP@*/
744 /*@constant int TIOCSPGRP@*/
745 /*@constant int TIOCOUTQ@*/
746 /*@constant int TIOCSTI@*/
747 /*@constant int TIOCNOTTY@*/
748 /*@constant int TIOCPKT@*/
749 /*@constant int TIOCPKT_DATA@*/
750 /*@constant int TIOCPKT_FLUSHREAD@*/
751 /*@constant int TIOCPKT_FLUSHWRITE@*/
752 /*@constant int TIOCPKT_STOP@*/
753 /*@constant int TIOCPKT_START@*/
754 /*@constant int TIOCPKT_NOSTOP@*/
755 /*@constant int TIOCPKT_DOSTOP@*/
756 /*@constant int TIOCPKT_IOCTL@*/
757 /*@constant int TIOCSTOP@*/
758 /*@constant int TIOCSTART@*/
759 /*@constant int TIOCMSET@*/
760 /*@constant int TIOCMBIS@*/
761 /*@constant int TIOCMBIC@*/
762 /*@constant int TIOCMGET@*/
763 /*@constant int TIOCREMOTE@*/
764 /*@constant int TIOCGWINSZ@*/
765 /*@constant int TIOCSWINSZ@*/
766 /*@constant int TIOCUCNTL@*/
767 /*@constant int TIOCSTAT@*/
768 /*@constant int TIOCCONS@*/
769 /*@constant int TIOCSCTTY@*/
770 /*@constant int TIOCEXT@*/
771 /*@constant int TIOCSIG@*/
772 /*@constant int TIOCDRAIN@*/
773 /*@constant int TIOCMSDTRWAIT@*/
774 /*@constant int TIOCMGDTRWAIT@*/
775 /*@constant int TIOCTIMESTAMP@*/
776 /*@constant int TIOCSDRAINWAIT@*/
777 /*@constant int TIOCGDRAINWAIT@*/
778 /*@constant int TTYDISC@*/
779 /*@constant int TABLDISC@*/
780 /*@constant int SLIPDISC@*/
781 /*@constant int PPPDISC@*/
782
783 /*@constant int MAXHOSTNAMELEN@*/
784
785         extern void
786 FD_CLR (int n, fd_set *p)
787         /*@modifies *p@*/;
788
789         extern void
790 FD_COPY (fd_set *f, /*@out@*/ fd_set *t)
791         /*@modifies *t@*/;
792
793         extern int /*@alt lltX_bool@*/
794 FD_ISSET (int n, fd_set *p)
795         /*@*/;
796
797         extern void
798 FD_SET (int n, fd_set *p)
799         /*@modifies *p@*/;
800
801         extern void
802 FD_ZERO (fd_set /*@out@*/ *p)
803         /*@modifies *p@*/;
804
805         extern int
806 fchdir (int fd)
807         /*@modifies internalState, errno@*/;
808
809         extern int
810 fchown (int fd, uid_t owner, gid_t group)
811         /*@modifies errno, fileSystem@*/;
812
813         extern int
814 fsync (int fd)
815         /*@modifies errno, fileSystem@*/;
816
817         extern int
818 ftruncate (int fd, off_t length)
819         /*@modifies errno, fileSystem@*/;
820
821 int gethostname (/*@out@*/ char *address, size_t address_len) 
822    /*:errorstatus@*/
823    /*@modifies address@*/ ;
824
825 int initgroups (const char *name, int basegid)
826    /*@modifies internalState@*/;
827
828         extern int
829 lchown (const char *path, uid_t owner, gid_t group)
830         /*@modifies errno, fileSystem@*/;
831
832         extern int
833 readlink (const char *path, /*@out@*/ char *buf, int size)
834         /*@modifies *buf, errno@*/;
835
836         extern int
837 select (int mfd, fd_set /*@null@*/ *r, fd_set /*@null@*/ *w, fd_set /*@null@*/ *e, struct timeval *t)
838         /*@modifies *r, *w, *e, *t, errno@*/;
839
840         extern int
841 setegid (gid_t egid)
842         /*@modifies errno, internalState@*/;
843
844         extern int
845 seteuid (uid_t euid)
846         /*@modifies errno, internalState@*/;
847
848         extern int
849 setgroups (int ngroups, const gid_t *gidset)
850         /*@modifies errno, internalState@*/;
851
852         extern int
853 setregid (gid_t rgid, gid_t egid)
854         /*@modifies errno, internalState@*/;
855
856         extern int
857 setreuid (gid_t ruid, gid_t euid)
858         /*@modifies errno, internalState@*/;
859
860         extern void
861 sync (void)
862         /*@modifies fileSystem@*/;
863
864         extern int
865 symlink (const char *path, const char *path2)
866         /*@modifies fileSystem@*/;
867
868         extern int
869 truncate (const char *name, off_t length)
870         /*@modifies errno, fileSystem@*/;
871
872 /*@constant int EBADRPC@*/
873 /*@constant int ERPCMISMATCH@*/
874 /*@constant int EPROGUNAVAIL@*/
875 /*@constant int EPROGMISMATCH@*/
876 /*@constant int EPROCUNAVAIL@*/
877 /*@constant int EFTYPE@*/
878 /*@constant int EAUTH@*/
879 /*@constant int ENEEDAUTH@*/
880 /*@constant int ELAST@*/
881
882 /*________________________________________________________________________
883  * tar.h
884  */
885
886 /*@unchecked@*/ extern char *TMAGIC;
887 /*@constant int TMAGLEN@*/
888 /*@unchecked@*/ extern char *TVERSION;
889 /*@constant int TVERSLEN@*/
890
891 /*@constant int REGTYPE@*/
892 /*@constant int AREGTYPE@*/
893 /*@constant int LNKTYPE@*/
894 /*@constant int SYMTYPE@*/
895 /*@constant int CHRTYPE@*/
896 /*@constant int BLKTYPE@*/
897 /*@constant int DIRTYPE@*/
898 /*@constant int FIFOTYPE@*/
899 /*@constant int CONTTYPE@*/
900
901 /*@constant int TSUID@*/
902 /*@constant int TSGID@*/
903 /*@constant int TSVTX@*/
904
905 /*@constant int TUREAD@*/
906 /*@constant int TUWRITE@*/
907 /*@constant int TUEXEC@*/
908 /*@constant int TGREAD@*/
909 /*@constant int TGWRITE@*/
910 /*@constant int TGEXEC@*/
911 /*@constant int TOREAD@*/
912 /*@constant int TOWRITE@*/
913 /*@constant int TOEXEC@*/
914
915 struct ipc_perm {
916   uid_t uid;    /* user id */
917   gid_t gid;    /* group id */
918   uid_t cuid;   /* creator user id */
919   gid_t cgid;   /* creator group id */
920   mode_t        mode;   /* r/w permission */
921   ulong seq;    /* slot usage sequence number */
922   key_t key;    /* user specified msg/sem/shm key */
923 } ;
924
925 /*@constant int IPC_R@*/
926 /*@constant int IPC_W@*/
927 /*@constant int IPC_M@*/
928 /*@constant int IPC_CREAT@*/
929 /*@constant int IPC_EXCL@*/
930 /*@constant int IPC_NOWAIT@*/
931 /*@constant key_t IPC_PRIVATE@*/
932 /*@constant int IPC_RMID@*/
933 /*@constant int IPC_SET@*/
934 /*@constant int IPC_STAT@*/
935
936 /*________________________________________________________________________
937  * sys/msg.h
938  */
939
940  struct msqid_ds {
941         struct  ipc_perm msg_perm;      /* msg queue permission bits */
942         struct  msg *msg_first; /* first message in the queue */
943         struct  msg *msg_last;  /* last message in the queue */
944         u_long  msg_cbytes;     /* number of bytes in use on the queue */
945         u_long  msg_qnum;       /* number of msgs in the queue */
946         u_long  msg_qbytes;     /* max # of bytes on the queue */
947         pid_t   msg_lspid;      /* pid of last msgsnd() */
948         pid_t   msg_lrpid;      /* pid of last msgrcv() */
949         time_t  msg_stime;      /* time of last msgsnd() */
950         time_t  msg_rtime;      /* time of last msgrcv() */
951         time_t  msg_ctime;      /* time of last msgctl() */
952 };
953
954  struct mymesg {
955         long    mtype;          /* message type (+ve integer) */
956         char    mtext[];        /* message body */
957 };
958
959 /*@constant int MSG_NOERROR@*/
960 /*@constant int MSGMAX@*/
961 /*@constant int MSGMNB@*/
962 /*@constant int MSGMNI@*/
963 /*@constant int MSGTQL@*/
964
965         extern int
966 msgctl (int id , int cmd, /*@out@*/ struct msqid_ds *buf)
967         /*@modifies errno, *buf@*/;
968
969         extern int
970 msgget (key_t key, int flag)
971         /*@modifies errno@*/;
972
973         extern int
974 msgrcv (int id, /*@out@*/ void *ptr, size_t nbytes, long type, int flags)
975         /*@modifies errno, *ptr@*/;
976
977         extern int
978 msgsnd (int id, const void *ptr, size_t nbytes, int flag)
979         /*@modifies errno@*/;
980
981 /*________________________________________________________________________
982  * sys/sem.h
983  */
984
985  struct semid_ds {
986         struct ipc_perm sem_perm;
987         struct sem     *sem_base;
988         ushort          sem_nsems;
989         time_t          sem_otime;
990         time_t          sem_ctime;
991 };
992
993  struct sem {
994         ushort semval;
995         pid_t  sempid;
996         ushort semncnt;
997         ushort semzcnt;
998 };
999
1000  union semun {
1001         int val;
1002         struct semid_ds *buf;
1003         ushort *array;
1004 };
1005
1006  struct sembuf {
1007         ushort sem_num;
1008         short sem_op;
1009         short sem_flg;
1010 };
1011
1012 /*@constant int SEM_A@*/
1013 /*@constant int SEMAEM@*/
1014 /*@constant int SEMMNI@*/
1015 /*@constant int SEMMNS@*/
1016 /*@constant int SEMMNU@*/
1017 /*@constant int SEMMSL@*/
1018 /*@constant int SEMOPN@*/
1019 /*@constant int SEM_R@*/
1020 /*@constant int SEMUME@*/
1021 /*@constant int SEM_UNDO@*/
1022 /*@constant int SEMVMX@*/
1023 /*@constant int GETVAL@*/
1024 /*@constant int SETVAL@*/
1025 /*@constant int GETPID@*/
1026 /*@constant int GETNCNT@*/
1027 /*@constant int GETZCNT@*/
1028 /*@constant int GETALL@*/
1029 /*@constant int SETALL@*/
1030
1031 /*@constant int ERMID@*/
1032
1033         extern int
1034 semctl (int id, int semnum, int cmd, union semun arg)
1035         /*@modifies errno@*/;
1036
1037         extern int
1038 semget (key_t key, int nsems, int flag)
1039         /*@modifies errno@*/;
1040
1041         extern int
1042 semop (int id, struct sembuf *semoparray, size_t nops)
1043         /*@modifies errno@*/;
1044
1045 /*________________________________________________________________________
1046  * sys/shm.h
1047  */
1048
1049  struct shmid_ds {
1050         struct ipc_perm shm_perm;
1051         int shm_segsz;
1052         ushort shm_lkcnt;
1053         pid_t shm_lpid;
1054         pid_t shm_cpid;
1055         ulong shm_nattch;
1056         ulong shm_cnattch;
1057         time_t shm_atime;
1058         time_t shm_dtime;
1059         time_t shm_ctime;
1060 };
1061
1062 /*@constant int SHMLBA@*/
1063 /*@constant int SHM_LOCK@*/
1064 /*@constant int SHMMAX@*/
1065 /*@constant int SHMMIN@*/
1066 /*@constant int SHMMNI@*/
1067 /*@constant int SHM_R@*/
1068 /*@constant int SHM_RDONLY@*/
1069 /*@constant int SHM_RND@*/
1070 /*@constant int SHMSEG@*/
1071 /*@constant int SHM_W@*/
1072 /*@constant int SHM_UNLOCK@*/
1073
1074         void *
1075 shmat (int id, /*@null@*/ void *addr, int flag)
1076         /*@modifies errno@*/;
1077
1078         extern int
1079 shmctl (int id, int cmd, /*@out@*/ struct shmid_ds *buf)
1080         /*@modifies errno, *buf@*/;
1081
1082         extern int
1083 shmdt (void *addr)
1084         /*@modifies errno@*/;
1085
1086         extern int
1087 shmget (key_t key, int size, int flag)
1088         /*@modifies errno@*/;
1089
1090 /*________________________________________________________________________
1091  * syslog.h
1092  */
1093
1094 /*@constant int LOG_EMERG@*/
1095 /*@constant int LOG_ALERT@*/
1096 /*@constant int LOG_CRIT@*/
1097 /*@constant int LOG_ERR@*/
1098 /*@constant int LOG_WARNING@*/
1099 /*@constant int LOG_NOTICE@*/
1100 /*@constant int LOG_INFO@*/
1101 /*@constant int LOG_DEBUG@*/
1102
1103 /*@constant int LOG_KERN@*/
1104 /*@constant int LOG_USER@*/
1105 /*@constant int LOG_MAIL@*/
1106 /*@constant int LOG_DAEMON@*/
1107 /*@constant int LOG_AUTH@*/
1108 /*@constant int LOG_SYSLOG@*/
1109 /*@constant int LOG_LPR@*/
1110 /*@constant int LOG_NEWS@*/
1111 /*@constant int LOG_UUCP@*/
1112 /*@constant int LOG_CRON@*/
1113 /*@constant int LOG_AUTHPRIV@*/
1114 /*@constant int LOG_FTP@*/
1115 /*@constant int LOG_LOCAL0@*/
1116 /*@constant int LOG_LOCAL1@*/
1117 /*@constant int LOG_LOCAL2@*/
1118 /*@constant int LOG_LOCAL3@*/
1119 /*@constant int LOG_LOCAL4@*/
1120 /*@constant int LOG_LOCAL5@*/
1121 /*@constant int LOG_LOCAL6@*/
1122 /*@constant int LOG_LOCAL7@*/
1123
1124 /*@constant int LOG_PID@*/
1125 /*@constant int LOG_CONS@*/
1126 /*@constant int LOG_ODELAY@*/
1127 /*@constant int LOG_NDELAY@*/
1128 /*@constant int LOG_NOWAIT@*/
1129 /*@constant int LOG_PERROR@*/
1130
1131         extern int
1132 LOG_MASK (int pri)
1133         /*@*/;
1134
1135         extern int
1136 LOG_UPTO (int pri)
1137         /*@*/;
1138
1139         extern void
1140 closelog (void)
1141         /*@modifies fileSystem@*/;
1142
1143         extern void
1144 openlog (const char *ident, int logopt, int facility)
1145         /*@modifies fileSystem@*/;
1146
1147         extern int
1148 setlogmask (int maskpri)
1149         /*@modifies internalState@*/;
1150
1151         extern void /*@printflike@*/
1152 syslog (int priority, const char *message, ...)
1153         /*@modifies fileSystem@*/;
1154
1155         extern void
1156 vsyslog (int priority, const char *message, va_list args)
1157         /*@modifies fileSystem@*/;
1158
1159 /*________________________________________________________________________
1160  * pwd.h
1161  */
1162
1163         extern extern void
1164 endpwent (void)
1165         /*@modifies internalState@*/;
1166
1167         extern /*@null@*/ struct passwd *
1168 getpwent (void)
1169         /*@modifies internalState@*/;
1170
1171         extern int
1172 setpassent (int stayopen)
1173         /*@modifies internalState@*/;
1174
1175         extern int
1176 setpwent (void)
1177         /*@modifies internalState@*/;
1178
1179 /*________________________________________________________________________
1180  * grp.h
1181  */
1182
1183         extern void
1184 endgrent (void)
1185         /*@modifies internalState@*/;
1186
1187         extern /*@null@*/ struct group *
1188 getgrent (void)
1189         /*@modifies internalState@*/;
1190
1191         extern int
1192 setgrent (void)
1193         /*@modifies internalState@*/;
1194
1195         extern void
1196 setgrfile (const char *name)
1197         /*@modifies internalState@*/;
1198
1199         extern int
1200 setgroupent (int stayopen)
1201         /*@modifies internalState@*/;
1202
1203 /*________________________________________________________________________
1204  * sys/stat.h
1205  */
1206
1207 /*@constant int S_ISTXT@*/
1208 /*@constant int S_IREAD@*/
1209 /*@constant int S_IWRITE@*/
1210 /*@constant int S_IEXEC@*/
1211 /*@constant int S_IFMT@*/
1212 /*@constant int S_IFIFO@*/
1213 /*@constant int S_IFCHR@*/
1214 /*@constant int S_IFDIR@*/
1215 /*@constant int S_IFBLK@*/
1216 /*@constant int S_IFREG@*/
1217 /*@constant int S_IFLNK@*/
1218 /*@constant int S_IFSOCK@*/
1219 /*@constant int S_ISVTX@*/
1220 /*@constant int S_ISVTX@*/
1221 /*@constant int SF_SETTABLE@*/
1222 /*@constant int SF_ARCHIVED@*/
1223 /*@constant int ACCESSPERMS@*/
1224 /*@constant int ALLPERMS@*/
1225 /*@constant int DEFFILEMODE@*/
1226 /*@constant int S_BLKSIZE@*/
1227 /*@constant int SF_IMMUTABLE@*/
1228 /*@constant int SF_APPEND@*/
1229 /*@constant int UF_NODUMP@*/
1230 /*@constant int UF_IMMUTABLE@*/
1231 /*@constant int UF_APPEND@*/
1232
1233         extern int /*@alt lltX_bool@*/
1234 S_ISLNK (/*@sef@*/ mode_t m)
1235         /*@*/;
1236
1237         extern int /*@alt lltX_bool@*/
1238 S_ISSOCK (/*@sef@*/ mode_t m)
1239         /*@*/;
1240
1241         extern int
1242 chflags (const char *path, u_long flags)
1243         /*@modifies fileSystem, errno@*/;
1244
1245         extern int
1246 fchflags (int fd, u_long flags)
1247         /*@modifies fileSystem, errno@*/;
1248
1249         extern int
1250 fchmod (int fd, mode_t mode)
1251         /*@modifies fileSystem, errno@*/;
1252
1253         extern int
1254 lstat (const char *path, /*@out@*/ struct stat *buf)
1255         /*@modifies errno, *buf@*/;
1256
1257 /*________________________________________________________________________
1258  * stropts.h
1259  */
1260
1261 /*@constant int FMNAMESZ@*/
1262 /*@constant int MSG_BAND@*/
1263 /*@constant int MSG_HIPRI@*/
1264 /*@constant int RS_HIPRI@*/
1265 /*@constant int S_INPUT@*/
1266 /*@constant int S_RDNORM@*/
1267 /*@constant int S_RDBAND@*/
1268 /*@constant int S_BANDURG@*/
1269 /*@constant int S_HIPRI@*/
1270 /*@constant int S_OUTPUT@*/
1271 /*@constant int S_WRNORM@*/
1272 /*@constant int S_WRBAND@*/
1273 /*@constant int S_MSG@*/
1274 /*@constant int S_ERROR@*/
1275 /*@constant int S_HANGUP@*/
1276
1277  struct strbuf {
1278         int maxlen;
1279         int len;
1280         char *buf;
1281 }
1282
1283  struct str_mlist {
1284         char l_name[];
1285 }
1286
1287  struct str_list {
1288         int sl_nmods;
1289         struct str_mlist *sl_modlist;
1290 }
1291
1292         extern int
1293 getmsg (int fd, /*@out@*/ struct strbuf *c, /*@out@*/ struct strbuf *d, int *f)
1294         /*@modifies *c, *d, errno@*/;
1295
1296         extern int
1297 getpmsg (int fd, /*@out@*/ struct strbuf *c, /*@out@*/ struct strbuf *d, int *b, int *f)
1298         /*@modifies *b, *c, *d, errno@*/;
1299
1300         extern int
1301 putmsg (int fd, const struct strbuf *c, const struct strbuf *d, int *f)
1302         /*@modifies internalState, errno@*/;
1303
1304         extern int
1305 putpmsg (int fd, const struct strbuf *c, const struct strbuf *d, int b, int *f)
1306         /*@modifies internalState, errno@*/;
1307
1308 /*________________________________________________________________________
1309  * sys/resource.h
1310  */
1311
1312 /*@constant int RLIMIT_CPU@*/
1313 /*@constant int RLIMIT_FSIZE@*/
1314 /*@constant int RLIMIT_DATA@*/
1315 /*@constant int RLIMIT_STACK@*/
1316 /*@constant int RLIMIT_CORE@*/
1317 /*@constant int RLIMIT_RSS@*/
1318 /*@constant int RLIMIT_MEMLOCK@*/
1319 /*@constant int RLIMIT_NPROC@*/
1320 /*@constant int RLIMIT_NOFILE@*/
1321 /*@constant int RLIM_NLIMITS@*/
1322 /*@constant int RLIM_INFINITY@*/
1323 /*@constant int PRIO_MIN@*/
1324 /*@constant int PRIO_MAX@*/
1325 /*@constant int PRIO_PROCESS@*/
1326 /*@constant int PRIO_PGRP@*/
1327 /*@constant int PRIO_USER@*/
1328 /*@constant int RUSAGE_SELF@*/
1329 /*@constant int RUSAGE_CHILDREN@*/
1330
1331  struct rusage {
1332         struct timeval ru_utime;        /* user time used */
1333         struct timeval ru_stime;        /* system time used */
1334         long    ru_maxrss;              /* max resident set size */
1335         long    ru_ixrss;               /* integral shared memory size */
1336         long    ru_idrss;               /* integral unshared data " */
1337         long    ru_isrss;               /* integral unshared stack " */
1338         long    ru_minflt;              /* page reclaims */
1339         long    ru_majflt;              /* page faults */
1340         long    ru_nswap;               /* swaps */
1341         long    ru_inblock;             /* block input operations */
1342         long    ru_oublock;             /* block output operations */
1343         long    ru_msgsnd;              /* messages sent */
1344         long    ru_msgrcv;              /* messages received */
1345         long    ru_nsignals;            /* signals received */
1346         long    ru_nvcsw;               /* voluntary context switches */
1347         long    ru_nivcsw;              /* involuntary " */
1348 };
1349
1350  struct rlimit {
1351         long  rlim_cur;
1352         long  rlim_max;
1353 };
1354
1355  struct loadavg {
1356         unsigned long ldavg[3];
1357         long fscale;
1358 };
1359
1360         extern int
1361 getpriority (int which, int who)
1362         /*@modifies errno@*/;
1363
1364         extern int
1365 getrlimit (int res, /*@out@*/ struct rlimit *rlp)
1366         /*@modifies *rlp, errno@*/;
1367
1368         extern int
1369 getrusage (int who, /*@out@*/ struct rusage *rusage)
1370         /*@modifies *rusage, errno@*/;
1371
1372         extern int
1373 setpriority (int which, int who, int prio)
1374         /*@modifies errno, internalState@*/;
1375
1376         extern int
1377 setrlimit (int resource, const struct rlimit *rlp)
1378         /*@modifies errno, internalState@*/;
1379
1380
1381 /*
1382 ** in <netdb.h>
1383 */
1384
1385 struct servent
1386 {
1387   /*@observer@*/ char *s_name;                  /* Official service name.  */
1388   /*@observer@*/ char **s_aliases;              /* Alias list.  */
1389   int s_port;                                   /* Port number.  */
1390   /*@observer@*/ char *s_proto;                 /* Protocol to use.  */
1391 } ;
1392
1393 /*@observer@*/ /*@dependent@*/ /*@null@*/ struct servent *getservbyname (const char *name, /*@null@*/ const char *proto) 
1394      /*@warn multithreaded "Unsafe in multithreaded applications, use getsrvbyname_r instead"@*/ ;
1395
1396 struct servent *getservbyname_r (const char *name, /*@null@*/ const char *proto, /*@out@*/ /*@returned@*/ struct servent *result, /*@out@*/ char *buffer, int buflen) 
1397      /*@requires maxSet (buffer) >= buflen@*/ ;
1398
1399
1400 /*@observer@*/ /*@dependent@*/ struct servent *getservbyport (int port, /*@null@*/ const char *proto)
1401      /*@warn multithreaded "Unsafe in multithreaded applications, use getservbyport_r instead"@*/ ;
1402
1403 struct servent *getservbyport_r (int port, /*@null@*/ const char *proto, /*@out@*/ /*@returned@*/ struct servent *result, /*@out@*/ char *buffer, int buflen)
1404      /*@requires maxSet (buffer) >= buflen@*/ ;
1405
1406 /*@null@*/ struct servent *getservent (void);
1407
1408 /*@null@*/ struct servent *getservent_r (struct servent *result, char *buffer, int buflen);
1409
1410 int setservent (int stayopen);
1411
1412 int endservent (void);
1413
1414
1415 extern int h_errno;
1416
1417 /*@null@*/ /*@observer@*/ struct hostent *gethostbyname (/*@nullterminated@*/ /*@notnull@*/ const char *name)
1418      /*@warn multithreaded "Unsafe in multithreaded applications, use gethostbyname_r instead"@*/ 
1419      /*@modifies h_errno@*/ ;
1420
1421 struct hostent *gethostbyname_r (/*@nullterminated@*/ const char *name, /*@notnull@*/ /*@returned@*/ struct hostent *hent, /*@out@*/ /*@exposed@*/ char *buffer, int bufsize, /*@out@*/ int *h_errnop)
1422      /*@requires maxSet(buffer) >= bufsize@*/ ;
1423
1424 /*@null@*/ /*@observer@*/ struct hostent *gethostbyaddr (/*@notnull@*/ const void *addr, size_t addrlen, int type) 
1425      /*@requires maxRead(addr) == addrlen@*/ /*@i534 ??? is this right? */
1426      /*@warn multithreaded "Unsafe in multithreaded applications, use gethostbyaddr_r instead"@*/ 
1427      /*@modifies h_errno@*/ ;
1428
1429 struct hostent *gethostbyaddr_r (/*@notnull@*/ const void *addr, size_t addrlen, int type, 
1430                                  /*@returned@*/ /*@out@*/ struct hostent *hent, 
1431                                  /*@exposed@*/ /*@out@*/ char *buffer, int bufsize, /*@out@*/ int *h_errnop)
1432      /*@requires maxRead(addr) == addrlen 
1433           /\ maxSet(buffer) >= bufsize@*/ /*@i534 ??? is this right? */ ;
1434
1435 /*@observer@*/ /*@null@*/ struct hostent *gethostent (void)
1436     /*@warn multithreaded "Unsafe in multithreaded applications, use gethostent_r instead"@*/ ;
1437
1438 struct hostent *gethostent_r (/*@out@*/ /*@returned@*/ struct hostent *hent, /*@exposed@*/ /*@out@*/ char *buffer, int bufsize)
1439      /*@requires maxSet(buffer) >= bufsize@*/ ;
1440
1441      /*@i534 need to annotate these: */
1442 struct hostent *fgethostent(FILE *f);
1443
1444 struct hostent *fgethostent_r(FILE*f, struct hostent *hent, char buffer, int bufsize);
1445
1446 void sethostent(int stayopen);
1447
1448 void endhostent(void);
1449
1450 void herror(const char *string);
1451
1452 char *hstrerror(int err);
1453
1454 struct hostent {
1455   /*@observer@*/ /*@nullterminated@*/ char *h_name;   /* official name of host */
1456   /*@observer@*/ /*@nullterminated@*/ char * /*:observer@*/ /*:nullterminated@*/ *h_aliases;   /* alias list */
1457   int  h_addrtype;   /* host address type*/
1458   int  h_length;   /* length ofaddress*/
1459   /*@observer@*/ /*@nullterminated@*/ char * /*:observer@*/ /*:nullterminated@*/ *h_addr_list; /* list of addressesfrom name server */
1460   /*@observer@*/ /*@nullterminated@*/ char *h_addr; /* first address in list (backward compatibility) */
1461 } ;
1462
1463 /*
1464 ** arpa/inet.h
1465 */
1466
1467 typedef uint32_t in_addr_t;
1468
1469 struct in_addr
1470 {
1471   in_addr_t s_addr;
1472 };
1473
1474 typedef uint16_t in_port_t;
1475
1476 in_addr_t htonl (in_addr_t hostlong) /*@*/ ;
1477 in_port_t htons (in_port_t hostshort) /*@*/ ;
1478 in_addr_t ntohl (in_addr_t netlong) /*@*/ ;
1479 in_port_t ntohs (in_port_t netshort) /*@*/ ;
1480
1481 /*
1482 ** unistd.h
1483 */
1484
1485 int chroot (/*@notnull@*/ /*@nullterminated@*/ const char *path)
1486    /*:statusreturn@*/
1487    /*@warn superuser "Only super-user processes may call chroot."@*/
1488      /*: other wanings? */ ;
1489
1490 int fchroot (int fildes)
1491    /*:statusreturn@*/
1492    /*@warn superuser "Only super-user processes may call fchroot."@*/ ;
This page took 0.271403 seconds and 5 git commands to generate.