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