]> andersk Git - splint.git/blame - lib/unix.h
Added back previosuly removed file lslinit.c to get splint to compile.
[splint.git] / lib / unix.h
CommitLineData
885824d3 1/*
2** unix.h
3*/
4
5/*@-nextlinemacros@*/
6
345671f3 7/*
8** sys/types.h
9**
10** evans - 2001-08-27: from http://www.opengroup.org/onlinepubs/007908799/xsh/systypes.h.html
11*/
12
13typedef /*@integraltype@*/ blkcnt_t;
14typedef /*@integraltype@*/ blksize_t;
8fe44445 15
16/*@-redef@*/ /* These are also defined by ansi.h: */
345671f3 17typedef /*@integraltype@*/ clock_t;
345671f3 18typedef /*@integraltype@*/ dev_t;
345671f3 19typedef /*@integraltype@*/ gid_t;
345671f3 20typedef /*@unsignedintegraltype@*/ ino_t;
345671f3 21typedef /*@integraltype@*/ mode_t;
22typedef /*@integraltype@*/ nlink_t;
23typedef /*@integraltype@*/ off_t;
24typedef /*@integraltype@*/ pid_t;
8fe44445 25typedef /*@integraltype@*/ time_t;
26typedef /*@integraltype@*/ uid_t;
27
28/*@=redef@*/
29
30typedef /*@integraltype@*/ clockid_t;
31typedef /*@unsignedintegraltype@*/ fsblkcnt_t;
32typedef /*@unsignedintegraltype@*/ fsfilcnt_t;
33typedef /*@integraltype@*/ id_t;
34
35typedef /*@integraltype@*/ key_t;
345671f3 36typedef /*@integraltype@*/ pthread_attr_t;
37typedef /*@integraltype@*/ pthread_cond_t;
38typedef /*@integraltype@*/ pthread_condattr_t;
39typedef /*@integraltype@*/ pthread_key_t;
40typedef /*@integraltype@*/ pthread_mutex_t;
41typedef /*@integraltype@*/ pthread_mutexattr_t;
42typedef /*@integraltype@*/ pthread_once_t;
43typedef /*@integraltype@*/ pthread_rwlock_t;
44typedef /*@integraltype@*/ pthread_rwlockattr_t;
45typedef /*@integraltype@*/ pthread_t;
46typedef /*@signedintegraltype@*/ suseconds_t;
345671f3 47typedef /*@integraltype@*/ timer_t;
345671f3 48typedef /*@unsignedintegraltype@*/ useconds_t;
49
885824d3 50/*
51** Extra stuff in some unixen, not in posix.
52*/
53
8fe44445 54extern /*@unchecked@*/ int signgam;
885824d3 55
8fe44445 56/*@-redef@*/ /* Defined by ansi: */
885824d3 57typedef /*@integraltype@*/ clockid_t;
8fe44445 58/*@=redef@*/
885824d3 59
60extern void bcopy (char *b1, /*@out@*/ char *b2, int length)
61 /*@modifies *b2@*/ ; /* Yes, the second parameter is the out param! */
62
63extern int /*@alt lltX_bool@*/ bcmp (char *b1, char *b2, int length) /*@*/ ;
64 /* Return value is NOT like strcmp! */
65
66extern void bzero (/*@out@*/ char *b1, int length) /*@modifies *b1@*/ ;
67extern int ffs (int i) /*@*/ ;
68extern int symlink (char *name1, char *name2) /*@modifies fileSystem@*/ ;
69
70extern int
71 setvbuf_unlocked (FILE *stream, /*@null@*/ /*@exposed@*/ char *buf,
72 int mode, size_t size)
73 /*@modifies internalState@*/ ;
74
75extern void
76 setbuffer (FILE *stream, /*@null@*/ /*@exposed@*/ char *buf, int size)
77 /*@modifies internalState@*/ ;
78
79extern void setlinebuf (FILE *stream) /*@modifies internalState@*/ ;
80
81extern int strerror_r (int errnum, /*@out@*/ char *strerrbuf, int buflen)
82 /*@modifies strerrbuf@*/ ;
83
84extern size_t
85 fread_unlocked (/*@out@*/ void *ptr, size_t size, size_t nitems,
86 FILE *stream)
87 /*@modifies *stream, *ptr;@*/ ;
88
89extern size_t
90 fwrite_unlocked (void *pointer, size_t size, size_t num_items, FILE *stream)
91 /*@modifies *stream;@*/ ;
92
885824d3 93extern void /*@alt void * @*/
94 memccpy (/*@returned@*/ /*@out@*/ void *s1,
95 /*@unique@*/ void *s2, int c, size_t n)
96 /*@modifies *s1@*/ ;
97
98extern int strcasecmp (char *s1, char *s2) /*@*/ ;
99extern int strncasecmp (char *s1, char *s2, int n) /*@*/ ;
1d239d69 100extern /*@null@*/ /*@only@*/ char *strdup (char *s) /*@*/ ;
885824d3 101
885824d3 102extern /*@null@*/ /*@dependent@*/ char *
103 index (/*@returned@*/ char *s, char c) /*@*/ ;
104
105extern /*@null@*/ /*@dependent@*/ char *
106 rindex (/*@returned@*/ char *s, char c) /*@*/ ;
107
885824d3 108
109extern double cbrt (double x) /*@modifies errno@*/ ;
110extern double rint (double x) /*@*/ ;
111extern double trunc (double x) /*@*/ ;
112
113/*@constant int ENOTBLK@*/
114/*@constant int ETXTBSY@*/
115/*@constant int EWOULDBLOCK@*/
116/*@constant int EINPROGRESS@*/
117/*@constant int EALREADY@*/
118/*@constant int ENOTSOCK@*/
119/*@constant int EDESTADDRREQ@*/
120/*@constant int EMSGSIZE@*/
121/*@constant int EPROTOTYPE@*/
122/*@constant int ENOPROTOOPT@*/
123/*@constant int EPROTONOSUPPORT@*/
124/*@constant int ESOCKTNOSUPPORT@*/
125/*@constant int EOPNOTSUPP@*/
126/*@constant int EPFNOSUPPORT@*/
127/*@constant int EAFNOSUPPORT@*/
128/*@constant int EADDRINUSE@*/
129/*@constant int EADDRNOTAVAIL@*/
130/*@constant int ENETDOWN@*/
131/*@constant int ENETUNREACH@*/
132/*@constant int ENETRESET@*/
133/*@constant int ECONNABORTED@*/
134/*@constant int ECONNRESET@*/
135/*@constant int ENOBUFS@*/
136/*@constant int EISCONN@*/
137/*@constant int ENOTCONN@*/
138/*@constant int ESHUTDOWN@*/
139/*@constant int ETOOMANYREFS@*/
140/*@constant int ETIMEDOUT@*/
141/*@constant int ECONNREFUSED@*/
142/*@constant int ENAMETOOLONG@*/
143/*@constant int EHOSTDOWN@*/
144/*@constant int EHOSTUNREACH@*/
145/*@constant int ENOTEMPTY@*/
146/*@constant int EPROCLIM@*/
147/*@constant int EUSERS@*/
148/*@constant int EDQUOT@*/
149/*@constant int ESTALE@*/
150/*@constant int EREMOTE@*/
151/*@constant int ENOMSG@*/
152/*@constant int EIDRM@*/
153/*@constant int EALIGN@*/
154/*@constant int EDEADLK@*/
155/*@constant int ENOLCK@*/
156/*@constant int ENOSYS@*/
157/*@constant int EACTIVE@*/
158/*@constant int ENOACTIVE@*/
159/*@constant int ENORESOURCES@*/
160/*@constant int ENOSYSTEM@*/
161/*@constant int ENODUST@*/
162/*@constant int EDUPNOCONN@*/
163/*@constant int EDUPNODISCONN@*/
164/*@constant int EDUPNOTCNTD@*/
165/*@constant int EDUPNOTIDLE@*/
166/*@constant int EDUPNOTWAIT@*/
167/*@constant int EDUPNOTRUN@*/
168/*@constant int EDUPBADOPCODE@*/
169/*@constant int EDUPINTRANSIT@*/
170/*@constant int EDUPTOOMANYCPUS@*/
171/*@constant int ELOOP@*/
172
173/*@constant int LOCK_MAX@*/
174/*@constant int FCHR_MAX@*/
175/*@constant int USI_MAX@*/
176/*@constant int WORD_BIT@*/
177/*@constant int LONG_BIT@*/
4aadc959 178
86d93ed3 179/*@-incondefs@*/ /* some constant are also declared in posix.h*/
180
181/*@constant long NAME_MAX@*/
182
885824d3 183/*@constant long NGROUPS_MAX@*/
4aadc959 184
885824d3 185/*@constant long MAX_CANON@*/
186/*@constant int MAX_CHAR@*/
187/*@constant long OPEN_MAX@*/
188/*@constant int PASS_MAX@*/
4aadc959 189
885824d3 190/*@constant int PID_MAX@*/
191/*@constant int SYSPID_MAX@*/
86d93ed3 192/*@constant long PIPE_BUF@*/
193/*@=incondefs@*/
885824d3 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
234extern /*@unchecked@*/ int daylight;
235extern /*@unchecked@*/ long timezone;
236extern /*@unchecked@*/ char *tzname[];
237
238/*@-incondefs@*/
239extern void tzset(void) /*@modifies daylight, timezone, tzname@*/ ;
240/*@=incondefs@*/
241
8fe44445 242/*@-redef@*/ /* Defined by ansi: */
243typedef /*@integraltype@*/ key_t;
244/*@-incondefs@*/ typedef long timer_t; /*@=incondefs@*/
245/*@=redef@*/
246
885824d3 247typedef unsigned char uchar_t;
248typedef unsigned short ushort_t;
249typedef unsigned int uint_t;
250typedef unsigned long ulong_t;
251typedef volatile unsigned char vuchar_t;
252typedef volatile unsigned short vushort_t;
253typedef volatile unsigned int vuint_t;
254typedef volatile unsigned long vulong_t;
255typedef long label_t;
256typedef int level_t;
257typedef /*@integraltype@*/ daddr_t;
258typedef char *caddr_t;
259typedef long *qaddr_t;
260typedef char *addr_t;
261typedef long physadr_t;
262typedef short cnt_t;
263typedef int chan_t;
264typedef unsigned long rlim_t;
265typedef int paddr_t;
885824d3 266typedef void *mid_t;
267typedef char slab_t[12];
268typedef ulong_t shmatt_t;
269typedef ulong_t msgqnum_t;
270typedef ulong_t msglen_t;
885824d3 271typedef uchar_t uchar;
272typedef ushort_t ushort;
273typedef uint_t uint;
274typedef ulong_t ulong;
275typedef uchar_t u_char;
276typedef ushort_t u_short;
277typedef uint_t u_int;
278typedef ulong_t u_long;
279typedef vuchar_t vu_char;
280typedef vushort_t vu_short;
281typedef vuint_t vu_int;
282typedef vulong_t vu_long;
283typedef long swblk_t;
284typedef u_long fixpt_t;
285typedef long segsz_t;
286typedef /*@abstract@*/ fd_set;
287
885824d3 288int ioctl (int d, int /*@alt long@*/ request, /*@out@*/ void *arg)
289 /*@modifies *arg, errno@*/ ; /* depends on request! */
290
885824d3 291pid_t vfork (void) /*@modifies fileSystem@*/ ;
292
140c27a8 293/*
294** sys/uio.h
295*/
885824d3 296
15b3d2b2 297struct iovec {
140c27a8 298 void *iov_base;
299 size_t iov_len; /*: maxSet(iov_base) = iov_len */
885824d3 300};
301
140c27a8 302/* from limits.h */
885824d3 303/*@constant int UIO_MAXIOV@*/ /* BSD */
304/*@constant int IOV_MAX@*/ /* supposedly SVR4 */
305
140c27a8 306ssize_t readv (int fd, const struct iovec *iov, int iovcnt)
307 /*@modifies iov->iov_base, fileSystem, errno@*/;
885824d3 308
140c27a8 309ssize_t writev (int fd, const struct iovec *iov, int iovcnt)
310 /*@modifies errno@*/;
885824d3 311
312/*________________________________________________________________________
313 * poll.h
314 */
315
316 struct poll {
317 int fd;
318 short events;
319 short revents;
320};
321
322/*@constant short POLLIN@*/
323/*@constant short POLLRDNORM@*/
324/*@constant short POLLRDBAND@*/
325/*@constant short POLLPRI@*/
326/*@constant short POLLOUT@*/
327/*@constant short POLLWRNORM@*/
328/*@constant short POLLWRBAND@*/
329/*@constant short POLLERR@*/
330/*@constant short POLLHUP@*/
331/*@constant short POLLNVAL@*/
332
333extern int poll (struct poll pollfd[], unsigned long nfds, int timeout)
334 /*@modifies pollfd[].revents, errno@*/ ;
335
336/*
337** free does not take null
338*/
339
340/*@-incondefs@*/
341extern void free (/*@notnull@*/ /*@out@*/ /*@only@*/ void *p) /*@modifies *p@*/ ;
342/*@=incondefs@*/
343
344/*________________________________________________________________________
345 * sys/socket.h
346 */
347
140c27a8 348
349
350
885824d3 351/*@constant int SOCK_RDM@*/
140c27a8 352
353
354
355
356
357
358
885824d3 359/*@constant int SO_USELOOPBACK@*/
140c27a8 360
361
885824d3 362/*@constant int SO_REUSEPORT@*/
140c27a8 363
364
365
366
367
368
369
370
371
372
885824d3 373/*@constant int AF_LOCAL@*/
140c27a8 374
375
885824d3 376/*@constant int AF_IMPLINK@*/
377/*@constant int AF_PUP@*/
378/*@constant int AF_CHAOS@*/
379/*@constant int AF_NS@*/
380/*@constant int AF_ISO@*/
381/*@constant int AF_OSI@*/
382/*@constant int AF_ECMA@*/
383/*@constant int AF_DATAKIT@*/
384/*@constant int AF_CCITT@*/
385/*@constant int AF_SNA@*/
386/*@constant int AF_DECnet@*/
387/*@constant int AF_DLI@*/
388/*@constant int AF_LAT@*/
389/*@constant int AF_HYLINK@*/
390/*@constant int AF_APPLETALK@*/
391/*@constant int AF_ROUTE@*/
392/*@constant int AF_LINK@*/
393/*@constant int pseudo_AF_XTP@*/
394/*@constant int AF_COIP@*/
395/*@constant int AF_CNT@*/
396/*@constant int pseudo_AF_RTIP@*/
397/*@constant int AF_IPX@*/
398/*@constant int AF_SIP@*/
399/*@constant int pseudo_AF_PIP@*/
400/*@constant int AF_ISDN@*/
401/*@constant int AF_E164@*/
402/*@constant int AF_MAX@*/
140c27a8 403
404
405
406
407
408
885824d3 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@*/
885824d3 447
885824d3 448
885824d3 449
140c27a8 450/*
451** sys/socket.h
452** (updated 26 May 2002)
453*/
454
455typedef /*@unsignedintegraltype@*/ socklen_t;
456
457struct sockaddr {
458 sa_family_t sa_family; /* address family */
459 char sa_data[]; /* variable length */
885824d3 460};
140c27a8 461
462struct sockaddr_storage {
463 sa_family_t ss_family;
464} ;
465
466struct msghdr {
467 void *msg_name;
468 socklen_t msg_namelen; /*: maxSet (msg_name) >= msg_namelen */
469 struct iovec *msg_iov; /* scatter/gather array */
470 int msg_iovlen; /* # elements in msg_iov */ /*: maxSet (msg_iov) >= msg_iovlen */
471 void *msg_control; /* ancillary data, see below */
472 socklen_t msg_controllen; /*: maxSet (msg_control) >= msg_controllen */
473 int msg_flags; /* flags on received message */
474} ;
475
476struct cmsghdr {
477 socklen_t cmsg_len; /* data byte count, including hdr */
478 int cmsg_level; /* originating protocol */
479 int cmsg_type; /* protocol-specific type */
480} ;
481
482/*@constant int SCM_RIGHTS@*/
483
484/*@exposed@*/ unsigned char *CMSG_DATA (/*@sef@*/ struct cmsghdr *) /*@*/ ;
485/*@null@*/ /*@exposed@*/ struct cmsghdr *CMSG_NXTHDR (struct msghdr *, struct cmsghdr *) /*@*/ ;
486/*@null@*/ /*@exposed@*/ struct cmsghdr *CMSG_FIRSTHDR (struct msghdr *) /*@*/ ;
487
488struct linger {
489 int l_onoff;
490 int l_linger;
885824d3 491};
492
140c27a8 493/*@constant int SOCK_DGRAM@*/
494/*@constant int SOCK_RAW@*/
495/*@constant int SOCK_SEQPACKET@*/
496/*@constant int SOCK_STREAM@*/
497
498/*@constant int SOL_SOCKET@*/
499
500/*@constant int SO_ACCEPTCONN@*/
501/*@constant int SO_BROADCAST@*/
502/*@constant int SO_DEBUG@*/
503/*@constant int SO_DONTROUTE@*/
504/*@constant int SO_ERROR@*/
505/*@constant int SO_KEEPALIVE@*/
506/*@constant int SO_LINGER@*/
507/*@constant int SO_OOBINLINE@*/
508/*@constant int SO_RCVBUF@*/
509/*@constant int SO_RCVLOWAT@*/
510/*@constant int SO_RCVTIMEO@*/
511/*@constant int SO_REUSEADDR@*/
512/*@constant int SO_SNDBUF@*/
513/*@constant int SO_SNDLOWAT@*/
514/*@constant int SO_SNDTIMEO@*/
515/*@constant int SO_TYPE@*/
516
517/*@constant int SOMAXCONN@*/
518
519/*@constant int MSG_CTRUNC@*/
520/*@constant int MSG_DONTROUTE@*/
521/*@constant int MSG_EOR@*/
522/*@constant int MSG_OOB@*/
523/*@constant int MSG_PEEK@*/
524/*@constant int MSG_TRUNC@*/
525/*@constant int MSG_WAITALL@*/
526
527/*@constant int AF_INET@*/
528/*@constant int AF_INET6@*/
529/*@constant int AF_UNIX@*/
530/*@constant int AF_UNSPEC@*/
531
532/*@constant int SHUT_RD@*/
533/*@constant int SHUT_RDWR@*/
534/*@constant int SHUT_WR@*/
535
536# if 0
537/*
538** These were in the old unix.h spec, but are not in SUS6
539*/
540
541struct sockproto {
542 u_short sp_family; /* address family */
543 u_short sp_protocol; /* protocol */
885824d3 544};
545
140c27a8 546# endif
885824d3 547
140c27a8 548int accept (int s, struct sockaddr *addr, int *addrlen)
549 /*@modifies *addrlen, errno@*/;
885824d3 550
140c27a8 551int bind (int s, const struct sockaddr *name, int namelen)
552 /*@modifies errno, fileSystem@*/;
885824d3 553
140c27a8 554int connect (int s, const struct sockaddr *name, int namelen)
555 /*@modifies errno, internalState@*/;
86d93ed3 556
140c27a8 557int getpeername (int s, /*@out@*/ struct sockaddr *restrict name, socklen_t *restrict namelen)
558 /*@modifies *name, *namelen, errno@*/;
559
86d93ed3 560#ifdef STRICT
885824d3 561
86d93ed3 562int getsockname (int s, /*@out@*/ struct sockaddr *address, socklen_t *address_len)
563 /*@i556@*/ /*: can't do this? requires maxSet(address) >= (*address_len) @*/
7272a1c1 564 /*@modifies *address, *address_len, errno@*/;
885824d3 565
86d93ed3 566#else
567int getsockname (int s, /*@out@*/ struct sockaddr *address, socklen_t /*@alt size_t@*/ *address_len)
155af98d 568 /*@i556@*/ /*: can't do this? requires maxSet(address) >= (*address_len) @*/
86d93ed3 569 /*@modifies *address, *address_len, errno@*/;
570
571#endif
572
7272a1c1 573int getsockopt (int s, int level, int optname, /*@out@*/ void *optval, size_t *optlen)
885824d3 574 /*@modifies *optval, *optlen, errno@*/;
575
576 extern int
577listen (int s, int backlog)
578 /*@modifies errno, internalState@*/;
579
580 extern ssize_t
581recv (int s, /*@out@*/ void *buf, size_t len, int flags)
582 /*@modifies *buf, errno@*/;
583
584 extern ssize_t
585recvfrom (int s, void *buf, size_t len, int flags, /*@null@*/ struct sockaddr *from, int *fromlen)
586 /*@modifies *buf, *from, *fromlen, errno@*/;
587
588 extern ssize_t
589recvmsg (int s, struct msghdr *msg, int flags)
590 /*@modifies msg->msg_iov->iov_base[], errno@*/;
591
592 extern ssize_t
593send (int s, const void *msg, size_t len, int flags)
594 /*@modifies errno@*/;
595
596 extern ssize_t
597sendto (int s, const void *msg, size_t len, int flags, const struct sockaddr *to, int tolen)
598 /*@modifies errno@*/;
599
600 extern ssize_t
601sendmsg (int s, const struct msghdr *msg, int flags)
602 /*@modifies errno@*/;
603
604 extern int
605setsockopt (int s, int level, int optname, const void *optval, int optlen)
606 /*@modifies internalState, errno@*/;
607
608 extern int
609shutdown (int s, int how)
610 /*@modifies errno@*/;
611
612 extern int
613socket (int domain, int type, int protocol)
614 /*@modifies errno@*/;
615
616 extern int
617socketpair (int d, int type, int protocol, /*@out@*/ int *sv)
618 /*@modifies errno@*/;
619
620/*@constant int BADSIG@*/
621/*@constant int SA_ONSTACK@*/
622/*@constant int SA_RESTART@*/
623/*@constant int SA_DISABLE@*/
624/*@constant int SIGBUS@*/
625/*@constant int SIGEMT@*/
626/*@constant int SIGINFO@*/
627/*@constant int SIGIO@*/
628/*@constant int SIGIOT@*/
629/*@constant int SIGPOLL@*/
630/*@constant int SIGPROF@*/
631/*@constant int SIGPWR@*/
632/*@constant int SIGSYS@*/
633/*@constant int SIGTRAP@*/
634/*@constant int SIGURG@*/
635/*@constant int SIGVTALRM@*/
636/*@constant int SIGWINCH@*/
637/*@constant int SIGXCPU@*/
638/*@constant int SIGXFSZ@*/
639
640extern void psignal (int sig, const char *msg)
641 /*@modifies fileSystem@*/;
642
885824d3 643 extern int
644setenv (const char *name, const char *value, int overwrite)
645 /*@globals environ@*/
646 /*@modifies *environ, errno@*/;
647
885824d3 648 extern void
649unsetenv (const char *name)
650 /*@globals environ@*/
651 /*@modifies *environ@*/;
652
653/*________________________________________________________________________
654 * sys/wait.h
655 */
656
657 extern int
658WCOREDUMP (int x)
659 /*@*/;
660
661 extern int
662W_EXITCODE (int ret, int sig)
663 /*@*/;
664
665 extern int
666W_STOPCODE (int sig)
667 /*@*/;
668
669/*@constant int WAIT_ANY@*/
670/*@constant int WAIT_MYPGRP@*/
671/*@constant int WSTOPPED@*/
672
673 extern pid_t
674wait3 (int *statloc, int options, /*@null@*/ /*@out@*/ struct rusage *rusage)
675 /*@modifies *statloc, *rusage, errno@*/;
676
677 extern pid_t
678wait4 (pid_t p, int *statloc, int opt, /*@null@*/ /*@out@*/ struct rusage *r)
679 /*@modifies *statloc, *r, errno@*/;
680
681struct timeval {
682 long tv_sec;
683 long tv_usec;
684} ;
685
686struct timespec {
687 long ts_sec;
688 long ts_nsec;
689} ;
690
691struct timezone {
692 int tz_minuteswest;
693 int tz_dsttime;
694} ;
695
696/*@constant int DST_NONE@*/
697/*@constant int DST_USA@*/
698/*@constant int DST_AUST@*/
699/*@constant int DST_WET@*/
700/*@constant int DST_MET@*/
701/*@constant int DST_EET@*/
702/*@constant int DST_CAN@*/
703
704/*@constant int ITIMER_PROF@*/
705/*@constant int ITIMER_REAL@*/
706/*@constant int ITIMER_VIRTUAL@*/
707
708 struct itimerval {
709 struct timeval it_interval;
710 struct timeval it_value;
711};
712
713 struct clockinfo {
714 int hz;
715 int tick;
716 int stathz;
717 int profhz;
718};
719
720 extern int
721adjtime (const struct timeval *delta, /*@null@*/ /*@out@*/ struct timeval *olddelta)
722 /*@modifies internalState, *olddelta, errno@*/;
723
724 extern int
725getitimer (int which, /*@out@*/ struct itimerval *value)
726 /*@modifies errno, *value*/;
727
728 extern int
729gettimeofday (/*@null@*/ /*@out@*/ struct timeval *tp, /*@null@*/ /*@out@*/ struct timezone *tzp)
730 /*@modifies *tp, *tzp, errno@*/;
731
732 extern int
733setitimer (int which, struct itimerval *val, /*@null@*/ /*@out@*/ struct itimerval *oval)
734 /*@modifies *oval, errno, internalState*/;
735
736 extern int
737settimeofday (const struct timeval *t, const struct timezone *z)
738 /*@modifies internalState, errno@*/;
739
740 extern int
741utimes (const char *file, /*@null@*/ const struct timeval *times)
742 /*@modifies fileSystem, errno*/;
743
744/*________________________________________________________________________
745 * sys/mman.h
746 */
747
748/*@constant int PROT_READ@*/
749/*@constant int PROT_WRITE@*/
750/*@constant int PROT_EXEC@*/
751/*@constant int MAP_SHARED@*/
752/*@constant int MAP_PRIVATE@*/
753/*@constant int MAP_COPY@*/
754/*@constant int MAP_FIXED@*/
755/*@constant int MAP_RENAME@*/
756/*@constant int MAP_NORESERVE@*/
757/*@constant int MAP_INHERIT@*/
758/*@constant int MAP_NOEXTEND@*/
759/*@constant int MAP_HASSEMAPHORE@*/
760/*@constant int MS_ASYNC@*/
761/*@constant int MS_INVALIDATE@*/
762/*@constant int MAP_FILE@*/
763/*@constant int MAP_ANON@*/
764/*@constant int MADV_NORMAL@*/
765/*@constant int MADV_RANDOM@*/
766/*@constant int MADV_SEQUENTIAL@*/
767/*@constant int MADV_WILLNEED@*/
768/*@constant int MADV_DONTNEED@*/
769
770 extern caddr_t
771mmap (/*@null@*/ /*@returned@*/ caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
772 /*@modifies addr@*/;
773
774 extern int
775madvise (caddr_t addr, int len, int behav)
776 /*@*/;
777
778 extern int
779mprotect (caddr_t addr, int len, int prot)
780 /*@*/;
781
782 extern int
345671f3 783 int munmap (/*@only@*/ caddr_t addr, size_t len)
784 /*@modifies fileSystem, *addr, errno @*/;
785
885824d3 786 extern int
787msync (caddr_t addr, int len, int flags)
788 /*@*/;
789
790 extern int
791mlock (caddr_t addr, size_t len)
792 /*@*/;
793
794 extern int
795munlock (caddr_t addr, size_t len)
796 /*@*/;
797
798
799/*________________________________________________________________________
800 * sys/ioctl.h
801 */
802
803 struct winsize {
804 unsigned short ws_row;
805 unsigned short ws_col;
806 unsigned short ws_xpixel;
807 unsigned short ws_ypixel;
808};
809
810/*@constant int TIOCMODG@*/
811/*@constant int TIOCMODS@*/
812/*@constant int TIOCM_LE@*/
813/*@constant int TIOCM_DTR@*/
814/*@constant int TIOCM_RTS@*/
815/*@constant int TIOCM_ST@*/
816/*@constant int TIOCM_SR@*/
817/*@constant int TIOCM_CTS@*/
818/*@constant int TIOCM_CAR@*/
819/*@constant int TIOCM_CD@*/
820/*@constant int TIOCM_RNG@*/
821/*@constant int TIOCM_RI@*/
822/*@constant int TIOCM_DSR@*/
823/*@constant int TIOCEXCL@*/
824/*@constant int TIOCNXCL@*/
825/*@constant int TIOCFLUSH@*/
826/*@constant int TIOCGETA@*/
827/*@constant int TIOCSETA@*/
828/*@constant int TIOCSETAW@*/
829/*@constant int TIOCSETAF@*/
830/*@constant int TIOCGETD@*/
831/*@constant int TIOCSETD@*/
832/*@constant int TIOCSBRK@*/
833/*@constant int TIOCCBRK@*/
834/*@constant int TIOCSDTR@*/
835/*@constant int TIOCCDTR@*/
836/*@constant int TIOCGPGRP@*/
837/*@constant int TIOCSPGRP@*/
838/*@constant int TIOCOUTQ@*/
839/*@constant int TIOCSTI@*/
840/*@constant int TIOCNOTTY@*/
841/*@constant int TIOCPKT@*/
842/*@constant int TIOCPKT_DATA@*/
843/*@constant int TIOCPKT_FLUSHREAD@*/
844/*@constant int TIOCPKT_FLUSHWRITE@*/
845/*@constant int TIOCPKT_STOP@*/
846/*@constant int TIOCPKT_START@*/
847/*@constant int TIOCPKT_NOSTOP@*/
848/*@constant int TIOCPKT_DOSTOP@*/
849/*@constant int TIOCPKT_IOCTL@*/
850/*@constant int TIOCSTOP@*/
851/*@constant int TIOCSTART@*/
852/*@constant int TIOCMSET@*/
853/*@constant int TIOCMBIS@*/
854/*@constant int TIOCMBIC@*/
855/*@constant int TIOCMGET@*/
856/*@constant int TIOCREMOTE@*/
857/*@constant int TIOCGWINSZ@*/
858/*@constant int TIOCSWINSZ@*/
859/*@constant int TIOCUCNTL@*/
860/*@constant int TIOCSTAT@*/
861/*@constant int TIOCCONS@*/
862/*@constant int TIOCSCTTY@*/
863/*@constant int TIOCEXT@*/
864/*@constant int TIOCSIG@*/
865/*@constant int TIOCDRAIN@*/
866/*@constant int TIOCMSDTRWAIT@*/
867/*@constant int TIOCMGDTRWAIT@*/
868/*@constant int TIOCTIMESTAMP@*/
869/*@constant int TIOCSDRAINWAIT@*/
870/*@constant int TIOCGDRAINWAIT@*/
871/*@constant int TTYDISC@*/
872/*@constant int TABLDISC@*/
873/*@constant int SLIPDISC@*/
874/*@constant int PPPDISC@*/
875
876/*@constant int MAXHOSTNAMELEN@*/
877
878 extern void
879FD_CLR (int n, fd_set *p)
880 /*@modifies *p@*/;
881
882 extern void
883FD_COPY (fd_set *f, /*@out@*/ fd_set *t)
884 /*@modifies *t@*/;
885
886 extern int /*@alt lltX_bool@*/
887FD_ISSET (int n, fd_set *p)
888 /*@*/;
889
890 extern void
891FD_SET (int n, fd_set *p)
892 /*@modifies *p@*/;
893
894 extern void
895FD_ZERO (fd_set /*@out@*/ *p)
896 /*@modifies *p@*/;
897
898 extern int
899fchdir (int fd)
900 /*@modifies internalState, errno@*/;
901
902 extern int
903fchown (int fd, uid_t owner, gid_t group)
904 /*@modifies errno, fileSystem@*/;
905
906 extern int
907fsync (int fd)
908 /*@modifies errno, fileSystem@*/;
909
910 extern int
911ftruncate (int fd, off_t length)
912 /*@modifies errno, fileSystem@*/;
913
b072092f 914int gethostname (/*@out@*/ char *address, size_t address_len)
915 /*:errorstatus@*/
916 /*@modifies address@*/ ;
885824d3 917
b072092f 918int initgroups (const char *name, int basegid)
919 /*@modifies internalState@*/;
885824d3 920
140c27a8 921int lchown (const char *path, uid_t owner, gid_t group)
922 /*@modifies errno, fileSystem@*/;
923
924int select (int mfd, fd_set /*@null@*/ *r, fd_set /*@null@*/ *w, fd_set /*@null@*/ *e, /*@null@*/ struct timeval *t)
925 /*@modifies *r, *w, *e, *t, errno@*/;
926 /* evans - 2002-05-26: added null for t, bug reported by Enrico Scholz */
927
928int setegid (gid_t egid)
929 /*@modifies errno, internalState@*/;
930
931int seteuid (uid_t euid)
932 /*@modifies errno, internalState@*/;
933
934int setgroups (int ngroups, const gid_t *gidset)
935 /*@modifies errno, internalState@*/;
936
937int setregid (gid_t rgid, gid_t egid)
938 /*@modifies errno, internalState@*/;
939
940int setreuid (gid_t ruid, gid_t euid)
941 /*@modifies errno, internalState@*/;
942
943void sync (void)
944 /*@modifies fileSystem@*/;
945
946int symlink (const char *path, const char *path2)
947 /*@modifies fileSystem@*/;
948
949int truncate (const char *name, off_t length)
950 /*@modifies errno, fileSystem@*/;
951
885824d3 952/*@constant int EBADRPC@*/
953/*@constant int ERPCMISMATCH@*/
954/*@constant int EPROGUNAVAIL@*/
955/*@constant int EPROGMISMATCH@*/
956/*@constant int EPROCUNAVAIL@*/
957/*@constant int EFTYPE@*/
958/*@constant int EAUTH@*/
959/*@constant int ENEEDAUTH@*/
960/*@constant int ELAST@*/
961
79127b5d 962/*
963** tar.h
964*/
885824d3 965
966/*@unchecked@*/ extern char *TMAGIC;
967/*@constant int TMAGLEN@*/
968/*@unchecked@*/ extern char *TVERSION;
969/*@constant int TVERSLEN@*/
970
971/*@constant int REGTYPE@*/
972/*@constant int AREGTYPE@*/
973/*@constant int LNKTYPE@*/
974/*@constant int SYMTYPE@*/
975/*@constant int CHRTYPE@*/
976/*@constant int BLKTYPE@*/
977/*@constant int DIRTYPE@*/
978/*@constant int FIFOTYPE@*/
979/*@constant int CONTTYPE@*/
980
981/*@constant int TSUID@*/
982/*@constant int TSGID@*/
983/*@constant int TSVTX@*/
984
985/*@constant int TUREAD@*/
986/*@constant int TUWRITE@*/
987/*@constant int TUEXEC@*/
988/*@constant int TGREAD@*/
989/*@constant int TGWRITE@*/
990/*@constant int TGEXEC@*/
991/*@constant int TOREAD@*/
992/*@constant int TOWRITE@*/
993/*@constant int TOEXEC@*/
994
995struct ipc_perm {
996 uid_t uid; /* user id */
997 gid_t gid; /* group id */
998 uid_t cuid; /* creator user id */
999 gid_t cgid; /* creator group id */
1000 mode_t mode; /* r/w permission */
1001 ulong seq; /* slot usage sequence number */
1002 key_t key; /* user specified msg/sem/shm key */
1003} ;
1004
1005/*@constant int IPC_R@*/
1006/*@constant int IPC_W@*/
1007/*@constant int IPC_M@*/
1008/*@constant int IPC_CREAT@*/
1009/*@constant int IPC_EXCL@*/
1010/*@constant int IPC_NOWAIT@*/
1011/*@constant key_t IPC_PRIVATE@*/
1012/*@constant int IPC_RMID@*/
1013/*@constant int IPC_SET@*/
1014/*@constant int IPC_STAT@*/
1015
79127b5d 1016/*
1017** sys/msg.h
1018*/
885824d3 1019
1020 struct msqid_ds {
1021 struct ipc_perm msg_perm; /* msg queue permission bits */
1022 struct msg *msg_first; /* first message in the queue */
1023 struct msg *msg_last; /* last message in the queue */
1024 u_long msg_cbytes; /* number of bytes in use on the queue */
1025 u_long msg_qnum; /* number of msgs in the queue */
1026 u_long msg_qbytes; /* max # of bytes on the queue */
1027 pid_t msg_lspid; /* pid of last msgsnd() */
1028 pid_t msg_lrpid; /* pid of last msgrcv() */
1029 time_t msg_stime; /* time of last msgsnd() */
1030 time_t msg_rtime; /* time of last msgrcv() */
1031 time_t msg_ctime; /* time of last msgctl() */
1032};
1033
1034 struct mymesg {
1035 long mtype; /* message type (+ve integer) */
1036 char mtext[]; /* message body */
1037};
1038
1039/*@constant int MSG_NOERROR@*/
1040/*@constant int MSGMAX@*/
1041/*@constant int MSGMNB@*/
1042/*@constant int MSGMNI@*/
1043/*@constant int MSGTQL@*/
1044
1045 extern int
1046msgctl (int id , int cmd, /*@out@*/ struct msqid_ds *buf)
1047 /*@modifies errno, *buf@*/;
1048
1049 extern int
1050msgget (key_t key, int flag)
1051 /*@modifies errno@*/;
1052
1053 extern int
1054msgrcv (int id, /*@out@*/ void *ptr, size_t nbytes, long type, int flags)
1055 /*@modifies errno, *ptr@*/;
1056
1057 extern int
1058msgsnd (int id, const void *ptr, size_t nbytes, int flag)
1059 /*@modifies errno@*/;
1060
79127b5d 1061/*
1062** sys/sem.h
1063*/
885824d3 1064
1065 struct semid_ds {
1066 struct ipc_perm sem_perm;
1067 struct sem *sem_base;
1068 ushort sem_nsems;
1069 time_t sem_otime;
1070 time_t sem_ctime;
1071};
1072
1073 struct sem {
1074 ushort semval;
1075 pid_t sempid;
1076 ushort semncnt;
1077 ushort semzcnt;
1078};
1079
1080 union semun {
1081 int val;
1082 struct semid_ds *buf;
1083 ushort *array;
1084};
1085
1086 struct sembuf {
1087 ushort sem_num;
1088 short sem_op;
1089 short sem_flg;
1090};
1091
1092/*@constant int SEM_A@*/
1093/*@constant int SEMAEM@*/
1094/*@constant int SEMMNI@*/
1095/*@constant int SEMMNS@*/
1096/*@constant int SEMMNU@*/
1097/*@constant int SEMMSL@*/
1098/*@constant int SEMOPN@*/
1099/*@constant int SEM_R@*/
1100/*@constant int SEMUME@*/
1101/*@constant int SEM_UNDO@*/
1102/*@constant int SEMVMX@*/
1103/*@constant int GETVAL@*/
1104/*@constant int SETVAL@*/
1105/*@constant int GETPID@*/
1106/*@constant int GETNCNT@*/
1107/*@constant int GETZCNT@*/
1108/*@constant int GETALL@*/
1109/*@constant int SETALL@*/
1110
1111/*@constant int ERMID@*/
1112
1113 extern int
1114semctl (int id, int semnum, int cmd, union semun arg)
1115 /*@modifies errno@*/;
1116
1117 extern int
1118semget (key_t key, int nsems, int flag)
1119 /*@modifies errno@*/;
1120
1121 extern int
1122semop (int id, struct sembuf *semoparray, size_t nops)
1123 /*@modifies errno@*/;
1124
79127b5d 1125/*
1126** sys/shm.h
1127*/
885824d3 1128
1129 struct shmid_ds {
1130 struct ipc_perm shm_perm;
1131 int shm_segsz;
1132 ushort shm_lkcnt;
1133 pid_t shm_lpid;
1134 pid_t shm_cpid;
1135 ulong shm_nattch;
1136 ulong shm_cnattch;
1137 time_t shm_atime;
1138 time_t shm_dtime;
1139 time_t shm_ctime;
1140};
1141
1142/*@constant int SHMLBA@*/
1143/*@constant int SHM_LOCK@*/
1144/*@constant int SHMMAX@*/
1145/*@constant int SHMMIN@*/
1146/*@constant int SHMMNI@*/
1147/*@constant int SHM_R@*/
1148/*@constant int SHM_RDONLY@*/
1149/*@constant int SHM_RND@*/
1150/*@constant int SHMSEG@*/
1151/*@constant int SHM_W@*/
1152/*@constant int SHM_UNLOCK@*/
1153
79127b5d 1154void * shmat (int id, /*@null@*/ void *addr, int flag)
1155 /*@modifies errno@*/ ;
1156
1157extern int shmctl (int id, int cmd, /*@out@*/ struct shmid_ds *buf)
1158 /*@modifies errno, *buf@*/ ;
885824d3 1159
79127b5d 1160extern int shmdt (void *addr)
1161 /*@modifies errno@*/ ;
885824d3 1162
79127b5d 1163extern int shmget (key_t key, int size, int flag)
1164 /*@modifies errno@*/ ;
885824d3 1165
79127b5d 1166# if 0
1167 /*
1168 ** this is in stdio.h!
1169 */
885824d3 1170
79127b5d 1171/*
1172** stdio.h
1173*/
1174
1175/*
1176** evans 2001-12-30: added from http://www.opengroup.org/onlinepubs/007908799/xsh/stdio.h.html
1177*/
1178
1179/*@constant unsignedintegraltype BUFSIZ@*/
1180/*@constant unsignedintegraltype FILENAME_MAX@*/
1181/*@constant unsignedintegraltype FOPEN_MAX@*/
1182/*@constant bool _IOFBF@*/
1183/*@constant bool _IOLBF@*/
1184/*@constant bool _IONBF@*/
1185/*@constant unsignedintegraltype L_ctermid@*/
1186/*@constant unsignedintegraltype L_cuserid@*/
1187/*@constant unsignedintegraltype L_tmpnam@*/
1188/*@constant unsignedintegraltype SEEK_CUR@*/
1189/*@constant unsignedintegraltype SEEK_END@*/
1190/*@constant unsignedintegraltype SEEK_SET@*/
1191/*@constant unsignedintegraltype TMP_MAX@*/
1192
1193/* EOF */
1194/* NULL */
1195
1196/*@constant observer char *P_tmpdir@*/
1197
d5047b91 1198void clearerr (FILE *s)
1199 /*@modifies s@*/ ;
1200
79127b5d 1201/*@dependent@*/ char *ctermid (/*@returned@*/ /*@null@*/ char *) /*@*/ ;
1202 /* Result may be static pointer if parameter is NULL, otherwise is fresh. */
1203
1204char *cuserid (/*@null@*/ /*@returned@*/ char *)
1205 /*@warn legacy "cuserid is obsolete"@*/ /*@*/ ;
1206
d5047b91 1207/* fclose in standard.h */
1208
79127b5d 1209/*@null@*/ FILE *fdopen (int, const char *)
1210 /*@modifies errno, fileSystem@*/ ;
1211
d5047b91 1212/* feof, ferror fflush, fgetc, fgetpos, fgets - in standard.h */
1213
79127b5d 1214int fileno (/*@notnull@*/ FILE *)
1215 /*:errorcode -1:*/
1216 /*@modifies errno@*/ ;
1217
1218void flockfile (/*@notnull@*/ FILE *f)
1219 /*@modifies f, fileSystem@*/ ;
1220
1221int fseeko (FILE *stream, off_t offset, int whence)
1222 /*:errorcode -1:*/
1223 /*@modifies stream, errno@*/ ;
1224
1225off_t ftello(FILE *stream)
1226 /*:errorcode -1:*/ /*@modifies errno*/ ;
1227
1228int ftrylockfile(FILE *stream)
1229 /*:errorcode !0:*/
1230 /*@modifies stream, fileSystem, errno*/ ;
1231
1232void funlockfile (FILE *stream)
1233 /*@modifies stream, fileSystem*/ ;
1234
1235int getc_unlocked(FILE *stream)
1236 /*@warn multithreaded "getc_unlocked is a thread unsafe version of getc"@*/
1237 /*@modifies *stream, fileSystem, errno@*/ ;
1238
1239int getchar_unlocked (void)
1240 /*@warn multithreaded "getchar_unlocked is a thread unsafe version of getchar"@*/
1241 /*@globals stdin@*/
1242 /*@modifies *stdin, fileSystem@*/ ;
1243
1244int getopt (int, char * const[], const char)
1245 /*@warn legacy@*/ ;
1246
1247int getw (FILE *stream)
1248 /*:errorcode EOF:*/
1249 /*@modifies fileSystem, *stream, errno@*/ ;
1250
1251int pclose(FILE *stream)
1252 /*:errorcode -1:*/
1253 /*@modifies *stream, errno@*/ ;
1254
1255/*@null@*/ FILE *popen (const char *command, const char *mode)
1256 /*:errorcode NULL:*/
1257 /*@modifies fileSystem, errno@*/ ;
1258
1259int putc_unlocked (int, FILE *stream)
1260 /*@warn multithreaded "putc_unlocked is a thread unsafe version of putc"@*/
1261 /*:errorcode EOF:*/
1262 /*@modifies fileSystem, *stream, errno@*/ ;
1263
1264int putchar_unlocked(int)
1265 /*@warn multithreaded "putchar_unlocked is a thread unsafe version of putchar"@*/
1266 /*:errorcode EOF:*/
1267 /*@modifies fileSystem, *stdout, errno@*/ ;
1268
1269int putw(int, FILE *stream)
1270 /*:errorcode EOF:*/
1271 /*@modifies fileSystem, *stdout, errno@*/ ;
1272
1273int remove (const char *)
1274 /*@modifies fileSystem@*/ ;
1275
1276int rename (const char *, const char *)
1277 /*@modifies fileSystem@*/ ;
1278
1279void rewind (FILE *stream)
1280 /*@modifies *stream@*/ ;
1281
d5047b91 1282void setbuf (FILE *stream, /*@null@*/ /*@dependent@*/ /*@exposed@*/ char *buf)
1283 /*@modifies stream@*/
1284
1285int setvbuf (FILE *stream, /*@null@*/ /*@dependent@*/ /*@exposed@*/ char *buf, int type, size_t size)
1286 /*@modifies stream@*/
1287 /*:errorcode !0:*/ ;
1288
1289int snprintf (char *s, size_t n, const char *format, ...);
1290
79127b5d 1291 int sprintf(char *, const char *, ...);
1292 int sscanf(const char *, const char *, int ...);
1293 char *tempnam(const char *, const char *);
1294 FILE *tmpfile(void);
1295 char *tmpnam(char *);
1296 int ungetc(int, FILE *);
1297 int vfprintf(FILE *, const char *, va_list);
1298 int vprintf(const char *, va_list);
1299 int vsnprintf(char *, size_t, const char *, va_list);
1300 int vsprintf(char *, const char *, va_list);
1301
1302
1303 The following external variables are defined:
1304
1305
1306 extern char *optarg; )
1307 extern int opterr; )
1308 extern int optind; ) (LEGACY)
1309 extern int optopt; )
1310
1311# endif
1312
1313/*
1314** syslog.h
1315*/
885824d3 1316
1317/*@constant int LOG_EMERG@*/
1318/*@constant int LOG_ALERT@*/
1319/*@constant int LOG_CRIT@*/
1320/*@constant int LOG_ERR@*/
1321/*@constant int LOG_WARNING@*/
1322/*@constant int LOG_NOTICE@*/
1323/*@constant int LOG_INFO@*/
1324/*@constant int LOG_DEBUG@*/
1325
1326/*@constant int LOG_KERN@*/
1327/*@constant int LOG_USER@*/
1328/*@constant int LOG_MAIL@*/
1329/*@constant int LOG_DAEMON@*/
1330/*@constant int LOG_AUTH@*/
1331/*@constant int LOG_SYSLOG@*/
1332/*@constant int LOG_LPR@*/
1333/*@constant int LOG_NEWS@*/
1334/*@constant int LOG_UUCP@*/
1335/*@constant int LOG_CRON@*/
1336/*@constant int LOG_AUTHPRIV@*/
1337/*@constant int LOG_FTP@*/
1338/*@constant int LOG_LOCAL0@*/
1339/*@constant int LOG_LOCAL1@*/
1340/*@constant int LOG_LOCAL2@*/
1341/*@constant int LOG_LOCAL3@*/
1342/*@constant int LOG_LOCAL4@*/
1343/*@constant int LOG_LOCAL5@*/
1344/*@constant int LOG_LOCAL6@*/
1345/*@constant int LOG_LOCAL7@*/
1346
1347/*@constant int LOG_PID@*/
1348/*@constant int LOG_CONS@*/
1349/*@constant int LOG_ODELAY@*/
1350/*@constant int LOG_NDELAY@*/
1351/*@constant int LOG_NOWAIT@*/
1352/*@constant int LOG_PERROR@*/
1353
d5047b91 1354int LOG_MASK (int pri)
1355 /*@*/;
1356
1357int LOG_UPTO (int pri)
1358 /*@*/;
1359
1360void closelog (void)
1361 /*@modifies fileSystem@*/;
1362
1363void openlog (const char *ident, int logopt, int facility)
1364 /*@modifies fileSystem@*/;
1365
1366int setlogmask (int maskpri)
1367 /*@modifies internalState@*/;
1368
1369void /*@printflike@*/ syslog (int priority, const char *message, ...)
1370 /*@modifies fileSystem@*/;
1371
1372void vsyslog (int priority, const char *message, va_list args)
1373 /*@modifies fileSystem@*/;
885824d3 1374
1375/*________________________________________________________________________
1376 * pwd.h
1377 */
1378
1379 extern extern void
1380endpwent (void)
1381 /*@modifies internalState@*/;
1382
1383 extern /*@null@*/ struct passwd *
1384getpwent (void)
1385 /*@modifies internalState@*/;
1386
1387 extern int
1388setpassent (int stayopen)
1389 /*@modifies internalState@*/;
1390
1391 extern int
1392setpwent (void)
1393 /*@modifies internalState@*/;
1394
1395/*________________________________________________________________________
1396 * grp.h
1397 */
1398
1399 extern void
1400endgrent (void)
1401 /*@modifies internalState@*/;
1402
1403 extern /*@null@*/ struct group *
1404getgrent (void)
1405 /*@modifies internalState@*/;
1406
1407 extern int
1408setgrent (void)
1409 /*@modifies internalState@*/;
1410
1411 extern void
1412setgrfile (const char *name)
1413 /*@modifies internalState@*/;
1414
1415 extern int
1416setgroupent (int stayopen)
1417 /*@modifies internalState@*/;
1418
1d239d69 1419/*
1420** sys/stat.h
1421**
1422** evans 2001-08-26 - updated from http://www.opengroup.org/onlinepubs/007908799/xsh/sysstat.h.html
1423*/
1424
1425/*
1426** struct stat replaces POSIX version - more required fields in Unix
1427*/
1428
8fe44445 1429/*@-redef@*/ /*@-matchfields@*/
1d239d69 1430struct stat {
1431 dev_t st_dev; /* ID of device containing file */
1432 ino_t st_ino; /* file serial number */
1433 mode_t st_mode; /* mode of file (see below) */
1434 nlink_t st_nlink; /* number of links to the file */
1435 uid_t st_uid; /* user ID of file */
1436 gid_t st_gid; /* group ID of file */
1437 dev_t st_rdev; /* device ID (if file is character or block special) */
1438 off_t st_size; /* file size in bytes (if file is a regular file) */
1439 time_t st_atime; /* time of last access */
1440 time_t st_mtime; /* time of last data modification */
1441 time_t st_ctime; /* time of last status change */
1442 blksize_t st_blksize; /* a filesystem-specific preferred I/O block size for
1443 this object. In some filesystem types, this may
1444 vary from file to file */
1445 blkcnt_t st_blocks; /* number of blocks allocated for this object */
8fe44445 1446} ;
1447/*@=redef@*/ /*@=matchfields@*/
885824d3 1448
1d239d69 1449/*@constant mode_t S_IWUSR@*/
1450/*@constant mode_t S_IXUSR@*/
1451/*@constant mode_t S_IRWXG@*/
1452/*@constant mode_t S_IRGRP@*/
1453/*@constant mode_t S_IWGRP@*/
1454/*@constant mode_t S_IXGRP@*/
1455/*@constant mode_t S_IRWXO@*/
1456/*@constant mode_t S_IROTH@*/
1457/*@constant mode_t S_IWOTH@*/
1458/*@constant mode_t S_IXOTH@*/
1459/*@constant mode_t S_ISUID@*/
1460/*@constant mode_t S_ISGID@*/
1461/*@constant mode_t S_ISVTX@*/
1462
1463# if 0
345671f3 1464/*These are the old definitions - they don't appear to be in the Single UNIX Specification */
1465
885824d3 1466/*@constant int S_ISTXT@*/
1467/*@constant int S_IREAD@*/
1468/*@constant int S_IWRITE@*/
1469/*@constant int S_IEXEC@*/
1470/*@constant int S_IFMT@*/
1471/*@constant int S_IFIFO@*/
1472/*@constant int S_IFCHR@*/
1473/*@constant int S_IFDIR@*/
1474/*@constant int S_IFBLK@*/
1475/*@constant int S_IFREG@*/
1476/*@constant int S_IFLNK@*/
1477/*@constant int S_IFSOCK@*/
1478/*@constant int S_ISVTX@*/
1479/*@constant int S_ISVTX@*/
1480/*@constant int SF_SETTABLE@*/
1481/*@constant int SF_ARCHIVED@*/
1482/*@constant int ACCESSPERMS@*/
1483/*@constant int ALLPERMS@*/
1484/*@constant int DEFFILEMODE@*/
1485/*@constant int S_BLKSIZE@*/
1486/*@constant int SF_IMMUTABLE@*/
1487/*@constant int SF_APPEND@*/
1488/*@constant int UF_NODUMP@*/
1489/*@constant int UF_IMMUTABLE@*/
1490/*@constant int UF_APPEND@*/
1d239d69 1491# endif
885824d3 1492
1d239d69 1493int /*@alt lltX_bool@*/ S_ISBLK (/*@sef@*/ mode_t m) /*@*/;
1494int /*@alt lltX_bool@*/ S_ISCHR (/*@sef@*/ mode_t m) /*@*/;
1495int /*@alt lltX_bool@*/ S_ISDIR (/*@sef@*/ mode_t m) /*@*/;
1496int /*@alt lltX_bool@*/ S_ISFIFO (/*@sef@*/ mode_t m) /*@*/;
1497int /*@alt lltX_bool@*/ S_ISREG (/*@sef@*/ mode_t m) /*@*/;
1498int /*@alt lltX_bool@*/ S_ISLNK (/*@sef@*/ mode_t m) /*@*/;
885824d3 1499
1d239d69 1500int /*@alt lltX_bool@*/ S_TYPEISMQ (/*@sef@*/ struct stat *buf) /*@*/ ;
1501int /*@alt lltX_bool@*/ S_TYPEISSEM (/*@sef@*/ struct stat *buf) /*@*/ ;
1502int /*@alt lltX_bool@*/ S_TYPEISSHM (/*@sef@*/ struct stat *buf) /*@*/ ;
885824d3 1503
1d239d69 1504/* in POSIX: chmod, fstat, mkdir, mkfifo, stat, umask */
885824d3 1505
1d239d69 1506int lstat(const char *, /*@out@*/ struct stat *)
b87215ab 1507 /*:errorcode -1:*/
1508 /*@modifies errno@*/ ;
1509
1d239d69 1510int mknod (const char *, mode_t, dev_t)
1511 /*@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."@*/
1512 /*:errorcode -1:*/
1513 /*@modifies errno@*/ ;
885824d3 1514
1d239d69 1515int chflags (const char *path, u_long flags)
1516 /*@warn unixstandard "Not in Single UNIX Specification Version 2"@*/
1517 /*@modifies fileSystem, errno@*/;
1518
1519int fchflags (int fd, u_long flags)
1520 /*@warn unixstandard "Not in Single UNIX Specification Version 2"@*/
1521 /*@modifies fileSystem, errno@*/;
885824d3 1522
b87215ab 1523/* evans 2002-03-17: this was missing, reported by Ralf Wildenhues */
1524int fchmod(int fildes, mode_t mode)
1525 /*@modifies fileSystem, errno@*/ ;
1526
1527/*
1528** sys/statvfs.h
1529** from http://www.opengroup.org/onlinepubs/007908799/xsh/sysstatvfs.h.html
1530*/
1531
1532struct statvfs {
1533 unsigned long f_bsize;
1534 unsigned long f_frsize;
1535 fsblkcnt_t f_blocks;
1536 fsblkcnt_t f_bfree;
1537 fsblkcnt_t f_bavail;
1538 fsfilcnt_t f_files;
1539 fsfilcnt_t f_ffree;
1540 fsfilcnt_t f_favail;
1541 unsigned long f_fsid;
1542 unsigned long f_flag;
1543 unsigned long f_namemax;
1544} ;
1545
1546/*@constant unsigned long ST_RDONLY; @*/
1547/*@constant unsigned long ST_NOSUID; @*/
1548
1549int fstatvfs (int fildes, /*@out@*/ struct statvfs *buf)
1550 /*@modifies buf@*/ ;
1551
1552int statvfs (const char *path, /*@out@*/ struct statvfs *buf)
1553 /*@modifies buf@*/ ;
1554
1555
885824d3 1556/*________________________________________________________________________
1557 * stropts.h
1558 */
1559
1560/*@constant int FMNAMESZ@*/
1561/*@constant int MSG_BAND@*/
1562/*@constant int MSG_HIPRI@*/
1563/*@constant int RS_HIPRI@*/
1564/*@constant int S_INPUT@*/
1565/*@constant int S_RDNORM@*/
1566/*@constant int S_RDBAND@*/
1567/*@constant int S_BANDURG@*/
1568/*@constant int S_HIPRI@*/
1569/*@constant int S_OUTPUT@*/
1570/*@constant int S_WRNORM@*/
1571/*@constant int S_WRBAND@*/
1572/*@constant int S_MSG@*/
1573/*@constant int S_ERROR@*/
1574/*@constant int S_HANGUP@*/
1575
1576 struct strbuf {
1577 int maxlen;
1578 int len;
1579 char *buf;
1580}
1581
1582 struct str_mlist {
1583 char l_name[];
1584}
1585
1586 struct str_list {
1587 int sl_nmods;
1588 struct str_mlist *sl_modlist;
1589}
1590
1591 extern int
1592getmsg (int fd, /*@out@*/ struct strbuf *c, /*@out@*/ struct strbuf *d, int *f)
1593 /*@modifies *c, *d, errno@*/;
1594
1595 extern int
1596getpmsg (int fd, /*@out@*/ struct strbuf *c, /*@out@*/ struct strbuf *d, int *b, int *f)
1597 /*@modifies *b, *c, *d, errno@*/;
1598
1599 extern int
1600putmsg (int fd, const struct strbuf *c, const struct strbuf *d, int *f)
1601 /*@modifies internalState, errno@*/;
1602
dfd82dce 1603extern int putpmsg (int fd, const struct strbuf *c, const struct strbuf *d, int b, int *f)
1604 /*@modifies internalState, errno@*/;
885824d3 1605
1606/*________________________________________________________________________
1607 * sys/resource.h
1608 */
1609
1610/*@constant int RLIMIT_CPU@*/
1611/*@constant int RLIMIT_FSIZE@*/
1612/*@constant int RLIMIT_DATA@*/
1613/*@constant int RLIMIT_STACK@*/
1614/*@constant int RLIMIT_CORE@*/
1615/*@constant int RLIMIT_RSS@*/
1616/*@constant int RLIMIT_MEMLOCK@*/
1617/*@constant int RLIMIT_NPROC@*/
1618/*@constant int RLIMIT_NOFILE@*/
1619/*@constant int RLIM_NLIMITS@*/
1620/*@constant int RLIM_INFINITY@*/
1621/*@constant int PRIO_MIN@*/
1622/*@constant int PRIO_MAX@*/
1623/*@constant int PRIO_PROCESS@*/
1624/*@constant int PRIO_PGRP@*/
1625/*@constant int PRIO_USER@*/
1626/*@constant int RUSAGE_SELF@*/
1627/*@constant int RUSAGE_CHILDREN@*/
1628
1629 struct rusage {
1630 struct timeval ru_utime; /* user time used */
1631 struct timeval ru_stime; /* system time used */
1632 long ru_maxrss; /* max resident set size */
1633 long ru_ixrss; /* integral shared memory size */
1634 long ru_idrss; /* integral unshared data " */
1635 long ru_isrss; /* integral unshared stack " */
1636 long ru_minflt; /* page reclaims */
1637 long ru_majflt; /* page faults */
1638 long ru_nswap; /* swaps */
1639 long ru_inblock; /* block input operations */
1640 long ru_oublock; /* block output operations */
1641 long ru_msgsnd; /* messages sent */
1642 long ru_msgrcv; /* messages received */
1643 long ru_nsignals; /* signals received */
1644 long ru_nvcsw; /* voluntary context switches */
1645 long ru_nivcsw; /* involuntary " */
1646};
1647
1648 struct rlimit {
1649 long rlim_cur;
1650 long rlim_max;
1651};
1652
1653 struct loadavg {
1654 unsigned long ldavg[3];
1655 long fscale;
1656};
1657
1658 extern int
1659getpriority (int which, int who)
1660 /*@modifies errno@*/;
1661
1662 extern int
1663getrlimit (int res, /*@out@*/ struct rlimit *rlp)
1664 /*@modifies *rlp, errno@*/;
1665
1666 extern int
1667getrusage (int who, /*@out@*/ struct rusage *rusage)
1668 /*@modifies *rusage, errno@*/;
1669
1670 extern int
1671setpriority (int which, int who, int prio)
1672 /*@modifies errno, internalState@*/;
1673
1674 extern int
1675setrlimit (int resource, const struct rlimit *rlp)
1676 /*@modifies errno, internalState@*/;
1677
7272a1c1 1678
1679/*
1680** in <netdb.h>
1681*/
1682
1683struct servent
1684{
1685 /*@observer@*/ char *s_name; /* Official service name. */
1686 /*@observer@*/ char **s_aliases; /* Alias list. */
1687 int s_port; /* Port number. */
1688 /*@observer@*/ char *s_proto; /* Protocol to use. */
1689} ;
1690
1691/*@observer@*/ /*@dependent@*/ /*@null@*/ struct servent *getservbyname (const char *name, /*@null@*/ const char *proto)
1692 /*@warn multithreaded "Unsafe in multithreaded applications, use getsrvbyname_r instead"@*/ ;
1693
1694struct servent *getservbyname_r (const char *name, /*@null@*/ const char *proto, /*@out@*/ /*@returned@*/ struct servent *result, /*@out@*/ char *buffer, int buflen)
1695 /*@requires maxSet (buffer) >= buflen@*/ ;
1696
1697
1698/*@observer@*/ /*@dependent@*/ struct servent *getservbyport (int port, /*@null@*/ const char *proto)
1699 /*@warn multithreaded "Unsafe in multithreaded applications, use getservbyport_r instead"@*/ ;
1700
1701struct servent *getservbyport_r (int port, /*@null@*/ const char *proto, /*@out@*/ /*@returned@*/ struct servent *result, /*@out@*/ char *buffer, int buflen)
1702 /*@requires maxSet (buffer) >= buflen@*/ ;
1703
1704/*@null@*/ struct servent *getservent (void);
1705
1706/*@null@*/ struct servent *getservent_r (struct servent *result, char *buffer, int buflen);
1707
1708int setservent (int stayopen);
7272a1c1 1709int endservent (void);
1710
7272a1c1 1711extern int h_errno;
1712
1713/*@null@*/ /*@observer@*/ struct hostent *gethostbyname (/*@nullterminated@*/ /*@notnull@*/ const char *name)
1714 /*@warn multithreaded "Unsafe in multithreaded applications, use gethostbyname_r instead"@*/
1715 /*@modifies h_errno@*/ ;
1716
1717struct hostent *gethostbyname_r (/*@nullterminated@*/ const char *name, /*@notnull@*/ /*@returned@*/ struct hostent *hent, /*@out@*/ /*@exposed@*/ char *buffer, int bufsize, /*@out@*/ int *h_errnop)
1718 /*@requires maxSet(buffer) >= bufsize@*/ ;
1719
1720/*@null@*/ /*@observer@*/ struct hostent *gethostbyaddr (/*@notnull@*/ const void *addr, size_t addrlen, int type)
8fe44445 1721 /*@requires maxRead(addr) == addrlen@*/ /*:i534 ??? is this right? */
7272a1c1 1722 /*@warn multithreaded "Unsafe in multithreaded applications, use gethostbyaddr_r instead"@*/
1723 /*@modifies h_errno@*/ ;
1724
1725struct hostent *gethostbyaddr_r (/*@notnull@*/ const void *addr, size_t addrlen, int type,
1726 /*@returned@*/ /*@out@*/ struct hostent *hent,
1727 /*@exposed@*/ /*@out@*/ char *buffer, int bufsize, /*@out@*/ int *h_errnop)
8fe44445 1728 /*@requires maxRead(addr) == addrlen /\ maxSet(buffer) >= bufsize@*/
1729 /*:i534 ??? is this right? */ ;
7272a1c1 1730
1731/*@observer@*/ /*@null@*/ struct hostent *gethostent (void)
1732 /*@warn multithreaded "Unsafe in multithreaded applications, use gethostent_r instead"@*/ ;
1733
1734struct hostent *gethostent_r (/*@out@*/ /*@returned@*/ struct hostent *hent, /*@exposed@*/ /*@out@*/ char *buffer, int bufsize)
1735 /*@requires maxSet(buffer) >= bufsize@*/ ;
1736
8fe44445 1737/*:i534 need to annotate these: */
7272a1c1 1738
8fe44445 1739struct hostent *fgethostent(FILE *f);
7272a1c1 1740struct hostent *fgethostent_r(FILE*f, struct hostent *hent, char buffer, int bufsize);
7272a1c1 1741void sethostent(int stayopen);
7272a1c1 1742void endhostent(void);
7272a1c1 1743void herror(const char *string);
7272a1c1 1744char *hstrerror(int err);
1745
1746struct hostent {
1747 /*@observer@*/ /*@nullterminated@*/ char *h_name; /* official name of host */
1748 /*@observer@*/ /*@nullterminated@*/ char * /*:observer@*/ /*:nullterminated@*/ *h_aliases; /* alias list */
1749 int h_addrtype; /* host address type*/
1750 int h_length; /* length ofaddress*/
1751 /*@observer@*/ /*@nullterminated@*/ char * /*:observer@*/ /*:nullterminated@*/ *h_addr_list; /* list of addressesfrom name server */
1752 /*@observer@*/ /*@nullterminated@*/ char *h_addr; /* first address in list (backward compatibility) */
1753} ;
1754
7272a1c1 1755/*
1756** unistd.h
b87215ab 1757** from http://www.opengroup.org/onlinepubs/007908799/xsh/unistd.h.html
7272a1c1 1758*/
1759
b87215ab 1760/*@constant int _POSIX_VERSION@*/
1761/*@constant int _POSIX2_VERSION@*/
1762/*@constant int _POSIX2_C_VERSION@*/
1763/*@constant int _XOPEN_VERSION@*/
1764/*@constant int _XOPEN_XCU_VERSION@*/
1765
1766/* for access: */
1767
1768/*@constant int R_OK@*/
1769/*@constant int W_OK@*/
1770/*@constant int X_OK@*/
1771/*@constant int F_OK@*/
1772
1773/* for confstr: */
1774/*@constant int _CS_PATH@*/
1775/*@constant int _CS_XBS5_ILP32_OFF32_CFLAGS@*/
1776/*@constant int _CS_XBS5_ILP32_OFF32_LDFLAGS@*/
1777/*@constant int _CS_XBS5_ILP32_OFF32_LIBS@*/
1778/*@constant int _CS_XBS5_ILP32_OFF32_LINTFLAGS@*/
1779/*@constant int _CS_XBS5_ILP32_OFFBIG_CFLAGS@*/
1780/*@constant int _CS_XBS5_ILP32_OFFBIG_LDFLAGS@*/
1781/*@constant int _CS_XBS5_ILP32_OFFBIG_LIBS@*/
1782/*@constant int _CS_XBS5_ILP32_OFFBIG_LINTFLAGS@*/
1783/*@constant int _CS_XBS5_LP64_OFF64_CFLAGS@*/
1784/*@constant int _CS_XBS5_LP64_OFF64_LDFLAGS@*/
1785/*@constant int _CS_XBS5_LP64_OFF64_LIBS@*/
1786/*@constant int _CS_XBS5_LP64_OFF64_LINTFLAGS@*/
1787/*@constant int _CS_XBS5_LPBIG_OFFBIG_CFLAGS@*/
1788/*@constant int _CS_XBS5_LPBIG_OFFBIG_LDFLAGS@*/
1789/*@constant int _CS_XBS5_LPBIG_OFFBIG_LIBS@*/
1790/*@constant int _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS@*/
1791
1792/* name parameters to sysconf: */
1793
1794/*@constant int _SC_2_C_BIND@*/
1795/*@constant int _SC_2_C_DEV@*/
1796/*@constant int _SC_2_C_VERSION@*/
1797/*@constant int _SC_2_FORT_DEV@*/
1798/*@constant int _SC_2_FORT_RUN@*/
1799/*@constant int _SC_2_LOCALEDEF@*/
1800/*@constant int _SC_2_SW_DEV@*/
1801/*@constant int _SC_2_UPE@*/
1802/*@constant int _SC_2_VERSION@*/
1803/*@constant int _SC_ARG_MAX@*/
1804/*@constant int _SC_AIO_LISTIO_MAX@*/
1805/*@constant int _SC_AIO_MAX@*/
1806/*@constant int _SC_AIO_PRIO_DELTA_MAX@*/
1807/*@constant int _SC_ASYNCHRONOUS_IO@*/
1808/*@constant int _SC_ATEXIT_MAX@*/
1809/*@constant int _SC_BC_BASE_MAX@*/
1810/*@constant int _SC_BC_DIM_MAX@*/
1811/*@constant int _SC_BC_SCALE_MAX@*/
1812/*@constant int _SC_BC_STRING_MAX@*/
1813/*@constant int _SC_CHILD_MAX@*/
1814/*@constant int _SC_CLK_TCK@*/
1815/*@constant int _SC_COLL_WEIGHTS_MAX@*/
1816/*@constant int _SC_DELAYTIMER_MAX@*/
1817/*@constant int _SC_EXPR_NEST_MAX@*/
1818/*@constant int _SC_FSYNC@*/
1819/*@constant int _SC_GETGR_R_SIZE_MAX@*/
1820/*@constant int _SC_GETPW_R_SIZE_MAX@*/
1821/*@constant int _SC_IOV_MAX@*/
1822/*@constant int _SC_JOB_CONTROL@*/
1823/*@constant int _SC_LINE_MAX@*/
1824/*@constant int _SC_LOGIN_NAME_MAX@*/
1825/*@constant int _SC_MAPPED_FILES@*/
1826/*@constant int _SC_MEMLOCK@*/
1827/*@constant int _SC_MEMLOCK_RANGE@*/
1828/*@constant int _SC_MEMORY_PROTECTION@*/
1829/*@constant int _SC_MESSAGE_PASSING@*/
1830/*@constant int _SC_MQ_OPEN_MAX@*/
1831/*@constant int _SC_MQ_PRIO_MAX@*/
1832/*@constant int _SC_NGROUPS_MAX@*/
1833/*@constant int _SC_OPEN_MAX@*/
1834/*@constant int _SC_PAGESIZE@*/
1835/*@constant int _SC_PAGE_SIZE@*/
1836/*@constant int _SC_PASS_MAX@*/
1837/*@constant int _SC_PRIORITIZED_IO@*/
1838/*@constant int _SC_PRIORITY_SCHEDULING@*/
1839/*@constant int _SC_RE_DUP_MAX@*/
1840/*@constant int _SC_REALTIME_SIGNALS@*/
1841/*@constant int _SC_RTSIG_MAX@*/
1842/*@constant int _SC_SAVED_IDS@*/
1843/*@constant int _SC_SEMAPHORES@*/
1844/*@constant int _SC_SEM_NSEMS_MAX@*/
1845/*@constant int _SC_SEM_VALUE_MAX@*/
1846/*@constant int _SC_SHARED_MEMORY_OBJECTS@*/
1847/*@constant int _SC_SIGQUEUE_MAX@*/
1848/*@constant int _SC_STREAM_MAX@*/
1849/*@constant int _SC_SYNCHRONIZED_IO@*/
1850/*@constant int _SC_THREADS@*/
1851/*@constant int _SC_THREAD_ATTR_STACKADDR@*/
1852/*@constant int _SC_THREAD_ATTR_STACKSIZE@*/
1853/*@constant int _SC_THREAD_DESTRUCTOR_ITERATIONS@*/
1854/*@constant int _SC_THREAD_KEYS_MAX@*/
1855/*@constant int _SC_THREAD_PRIORITY_SCHEDULING@*/
1856/*@constant int _SC_THREAD_PRIO_INHERIT@*/
1857/*@constant int _SC_THREAD_PRIO_PROTECT@*/
1858/*@constant int _SC_THREAD_PROCESS_SHARED@*/
1859/*@constant int _SC_THREAD_SAFE_FUNCTIONS@*/
1860/*@constant int _SC_THREAD_STACK_MIN@*/
1861/*@constant int _SC_THREAD_THREADS_MAX@*/
1862/*@constant int _SC_TIMERS@*/
1863/*@constant int _SC_TIMER_MAX@*/
1864/*@constant int _SC_TTY_NAME_MAX@*/
1865/*@constant int _SC_TZNAME_MAX@*/
1866/*@constant int _SC_VERSION@*/
1867/*@constant int _SC_XOPEN_VERSION@*/
1868/*@constant int _SC_XOPEN_CRYPT@*/
1869/*@constant int _SC_XOPEN_ENH_I18N@*/
1870/*@constant int _SC_XOPEN_SHM@*/
1871/*@constant int _SC_XOPEN_UNIX@*/
1872/*@constant int _SC_XOPEN_XCU_VERSION@*/
1873/*@constant int _SC_XOPEN_LEGACY@*/
1874/*@constant int _SC_XOPEN_REALTIME@*/
1875/*@constant int _SC_XOPEN_REALTIME_THREADS@*/
1876/*@constant int _SC_XBS5_ILP32_OFF32@*/
1877/*@constant int _SC_XBS5_ILP32_OFFBIG@*/
1878/*@constant int _SC_XBS5_LP64_OFF64@*/
1879/*@constant int _SC_XBS5_LPBIG_OFFBIG@*/
1880
1881
1882int access(const char *, int) /*@modifies errno@*/ /*:errorcode -1:*/ ;
1883unsigned int alarm (unsigned int) /*@modifies internalState@*/ ;
1884
1885int brk(void *)
1886 /*@modifies errno@*/
1887 /*:errorcode -1:*/
1888 /*@warn legacy "brk is obsolete"@*/ ;
1889
1890int chdir (const char *)
1891 /*@modifies internalState, errno@*/
1892 /*:errorcode -1:*/ ;
1893
1894int chown (const char *, uid_t, gid_t)
1895 /*@modifies internalState, errno@*/
1896 /*:errorcode -1:*/ ;
1897
1898int close (int)
1899 /*@modifies internalState, errno@*/
1900 /*:errorcode -1:*/ ;
1901
1902size_t confstr(int, /*@null@*/ char *, size_t)
1903 /*@globals internalState@*/
1904 /*@modifies errno@*/
1905 /*:errorcode 0:*/ ;
1906
1907/*@dependent@*/ /*@null@*/ char *crypt(const char *, const char *)
1908 /*@modifies errno, internalState@*/ ;
1909
1910/*@dependent@*/ /*@null@*/ char *ctermid(/*@returned@*/ /*@null@*/ /*@out@*/ char *s)
1911 /*@modifies s@*/ ;
1912
1913/*@null@*/ /*@dependent@*/ char *cuserid (/*@null@*/ /*@returned@*/ char *s)
1914 /*@warn legacy "cuserid is obsolete"@*/
1915 /*@modifies s@*/ ;
1916
1917int dup(int)
1918 /*@modifies errno, internalState@*/
1919 /*:errorcode -1:*/ ;
1920
1921int dup2(int, int)
1922 /*@modifies errno, internalState@*/
1923 /*:errorcode -1:*/ ;
1924
1925void encrypt(char p_block[], int)
1926 /*@requires maxSet(p_block) == 63@*/
1927 /*@modifies p_block, errno@*/ ;
1928
1929extern char **environ;
1930
1931int execl (const char *, const char *, ...)
1932 /*@modifies errno, internalState@*/
1933 /*:errorcode -1:*/ ;
1934
1935int execle(const char *, const char *, ...)
1936 /*@modifies errno, internalState@*/
1937 /*:errorcode -1:*/ ;
1938
1939int execlp(const char *, const char *, ...)
1940 /*@modifies errno, internalState@*/
1941 /*:errorcode -1:*/ ;
1942
1943int execv(const char *, char *const [])
1944 /*@modifies errno, internalState@*/
1945 /*:errorcode -1:*/ ;
1946
1947int execve(const char *, char *const [], char *const [])
1948 /*@modifies errno, internalState@*/
1949 /*:errorcode -1:*/ ;
1950
1951int execvp(const char *, char *const [])
1952 /*@modifies errno, internalState@*/
1953 /*:errorcode -1:*/ ;
1954
1955/*@exits@*/ void _exit (int);
1956
1957int fchown (int, uid_t, gid_t)
1958 /*@modifies errno, fileSystem@*/
1959 /*:errorcode -1:*/ ;
1960
1961int fchdir (int)
1962 /*@modifies errno, fileSystem@*/
1963 /*:errorcode -1:*/ ;
1964
1965int fdatasync (int)
1966 /*@modifies errno, fileSystem@*/
1967 /*:errorcode -1:*/ ;
1968
1969pid_t fork (void)
1970 /*@modifies errno, internalState@*/
1971 /*:errorcode -1:*/ ;
1972
1973long int fpathconf(int, int)
1974 /*@modifies errno, internalState@*/
1975 /*:errorcode -1:*/ ;
1976
1977int fsync(int)
1978 /*@modifies errno, fileSystem@*/
1979 /*:errorcode -1:*/ ;
1980
1981int ftruncate(int, off_t)
1982 /*@modifies errno, fileSystem@*/
1983 /*:errorcode -1:*/ ;
1984
1985/*@null@*/ char *getcwd (/*@returned@*/ char *buf, size_t size)
1986 /*@requires maxSet(buf) >= size;@*/
1987 /*@modifies errno@*/ ;
1988
1989int getdtablesize (void)
1990 /*@warn legacy "getdtablesize is obsolete"@*/ ;
1991
1992gid_t getegid (void) /*@globals internalState*/ ;
1993uid_t geteuid (void) /*@globals internalState*/ ;
1994gid_t getgid (void) /*@globals internalState*/ ;
1995
1996int getgroups (int gidsetsize, gid_t grouplist[])
1997 /*@requires maxSet(grouplist) >= gidsetsize@*/
1998 /*@modifies errno@*/
1999 /*:errorcode -1:*/ ;
2000
2001long gethostid (void) /*@globals internalState@*/ ;
2002
2003/*@null@*/ /*@dependent@*/ char *getlogin (void)
2004 /*@modifies errno@*/ ;
2005
2006int getlogin_r (char *name, size_t namesize)
2007 /*@requires maxSet(name) >= namesize@*/
2008 /*:errorcode !0:*/ ;
2009
2010extern char *optarg;
2011extern int optind;
2012extern int opterr;
2013extern int optopt;
2014
2015int getopt(int, char * const [], const char *)
2016 /*@modifies optind, opterr, optopt, errno@*/
2017 /*:errorcode -1:*/ ;
2018
2019int getpagesize(void)
2020 /*@warn legacy "getpagesize is obsolete"@*/ ;
2021
2022/*@dependent@*/ /*@null@*/ char *getpass(/*@nullterminated@*/ const char *)
2023 /*@warn legacy "getpass is obsolete"@*/ ;
2024
2025pid_t getpgid(pid_t)
2026 /*@modifies errno@*/
2027 /*@globals internalState@*/
2028 /*:errorcode (pid_t)-1:*/ ;
2029
2030pid_t getpgrp(void) /*@globals internalState*/ ;
2031
2032pid_t getpid(void) /*@globals internalState*/ ;
2033pid_t getppid(void) /*@globals internalState*/ ;
2034
2035pid_t getsid(pid_t)
2036 /*@modifies errno@*/
2037 /*@globals internalState@*/
2038 /*:errorcode (pid_t)-1:*/ ;
2039
2040uid_t getuid(void) /*@globals internalState@*/ ;
2041
2042/*@null@*/ char *getwd (/*@returned@*/ char *path_name)
2043 /*@modifies path_name@*/ ;
2044
2045int isatty(int)
2046 /*@globals internalState@*/
2047 /*@modifies errno@*/
2048 /*:errorcode 0:*/ ;
2049
2050int lchown(const char *, uid_t, gid_t)
2051 /*@modifies errno, fileSystem@*/
2052 /*:errorcode -1:*/ ;
2053
2054int link(const char *, const char *)
2055 /*@modifies errno, fileSystem@*/
2056 /*:errorcode -1:*/ ;
2057
2058int lockf(int, int, off_t)
2059 /*@modifies errno, fileSystem@*/
2060 /*:errorcode -1:*/ ;
2061
2062off_t lseek(int, off_t, int)
2063 /*@modifies errno, fileSystem@*/
2064 /*:errorcode (off_t)-1:*/ ;
2065
2066int nice(int)
2067 /*@modifies errno, fileSystem@*/
2068 /*:errorcode -1:*/ ;
2069
2070long int pathconf(const char *, int)
2071 /*@modifies errno, internalState@*/
2072 /*:errorcode -1:*/ ;
2073
2074int pause(void)
2075 /*@modifies errno, internalState@*/
2076 /*:errorcode -1:*/ ;
2077
2078int pipe(int p[])
2079 /*@requires maxRead(p) == 1@*/
2080 /*@modifies errno, fileSystem@*/
2081 /*:errorcode -1:*/ ;
2082
2083ssize_t pread(int, /*@out@*/ void *buf, size_t nbyte, off_t offset)
2084 /*@modifies errno, fileSystem@*/
2085 /*@requires maxSet(buf) >= (nbyte - 1) @*/
2086 /*@ensures maxRead(buf) >= nbyte @*/
2087 /*:errorcode -1:*/ ;
2088
2089int pthread_atfork(void (*)(void), void (*)(void), void(*)(void))
2090 /*@modifies errno, fileSystem@*/
2091 /*:errorcode !0:*/ ;
2092
2093ssize_t pwrite(int, const void *buf, size_t nbyte, off_t)
2094 /*@requires maxRead(buf) >= nbyte@*/
2095 /*@modifies errno, fileSystem@*/
2096 /*:errorcode -1:*/ ;
2097
2098/* ssize_t read(int, void *, size_t); in posix.h */
2099
2100int readlink(const char *, char *buf, size_t bufsize)
2101 /*@requires maxSet(buf) >= (bufsize - 1)@*/
2102 /*@modifies errno, fileSystem, *buf@*/
2103 /*:errorcode -1:*/ ;
2104
2105/* int rmdir(const char *); in posix.h */
2106
2107void *sbrk(intptr_t)
2108 /*@modifies errno@*/
2109 /*:errorcode (void *)-1:*/
2110 /*@warn legacy "sbrk is obsolete"@*/ ;
2111
2112 /* int setgid(gid_t);
2113 int setpgid(pid_t, pid_t);
2114 */
2115
2116pid_t setpgrp(void) /*@modifies internalState@*/ ;
2117
2118int setregid(gid_t, gid_t)
2119 /*@modifies errno, internalState@*/
2120 /*:errorcode -1:*/ ;
2121
2122int setreuid(uid_t, uid_t)
2123 /*@modifies errno, internalState@*/
2124 /*:errorcode -1:*/ ;
2125
2126pid_t setsid(void)
2127 /*@modifies errno, internalState@*/
2128 /*:errorcode (pid_t) -1:*/ ;
2129
2130int setuid(uid_t)
2131 /*@modifies errno, internalState@*/
2132 /*:errorcode -1:*/ ;
2133
2134unsigned int sleep(unsigned int)
2135 /*@modifies systemState@*/ ;
2136
2137void swab(/*@unique@*/ const void *src, /*@unique@*/ void *dest, ssize_t nbytes)
2138 /*@requires maxSet(dest) >= (nbytes - 1)@*/ ;
2139
2140int symlink(const char *, const char *)
2141 /*@modifies errno, fileSystem@*/
2142 /*:errorcode -1:*/ ;
2143
2144void sync(void) /*@modifies systemState@*/ ;
2145
2146long int sysconf(int)
2147 /*@modifies errno, systemState@*/
2148 /*:errorcode -1:*/ ;
2149
2150pid_t tcgetpgrp(int)
2151 /*@globals systemState@*/
2152 /*@modifies errno@*/
2153 /*:errorcode -1:*/ ;
2154
2155int tcsetpgrp(int, pid_t)
2156 /*@modifies errno, systemState@*/
2157 /*:errorcode -1:*/ ;
2158
2159int truncate(const char *, off_t)
2160 /*@modifies errno, fileSystem@*/
2161 /*:errorcode -1:*/ ;
2162
2163/*@dependent@*/ /*@null@*/ char *ttyname(int)
2164 /*@globals systemState@*/
2165 /*@modifies errno@*/
2166 /*:errorcode -1:*/ ;
2167
2168int ttyname_r(int, char *name, size_t namesize)
2169 /*@requires maxSet(name) >= (namesize - 1)@*/ ;
2170 /*:errorcode !0:*/ ;
2171
2172useconds_t ualarm(useconds_t, useconds_t)
2173 /*@modifies systemState@*/ ;
2174
2175int unlink(const char *)
2176 /*@modifies fileSystem, errno@*/
2177 /*:errorcode -1:*/ ;
2178
2179int usleep(useconds_t)
2180 /*@modifies fileSystem, errno@*/
2181 /*:errorcode -1:*/ ;
2182
2183pid_t vfork(void)
2184 /*@modifies fileSystem, errno@*/
2185 /*:errorcode -1:*/ ;
2186
2187 /* in posix.h ssize_t write(int, const void *, size_t); */
2188
2189
7272a1c1 2190int chroot (/*@notnull@*/ /*@nullterminated@*/ const char *path)
b87215ab 2191 /*@modifies internalState, errno@*/
2192 /*:errorcode -1:*/
2193 /*@warn superuser "Only super-user processes may call chroot."@*/ ;
7272a1c1 2194
2195int fchroot (int fildes)
2196 /*:statusreturn@*/
2197 /*@warn superuser "Only super-user processes may call fchroot."@*/ ;
1d239d69 2198
b87215ab 2199
1d239d69 2200/*
2201** ctype.h
2202**
2203** evans 2001-08-26 - added from http://www.opengroup.org/onlinepubs/007908799/xsh/ctype.h.html
2204*/
2205
2206# ifdef STRICT
2207lltX_bool isascii(int) /*@*/ ;
2208lltX_bool toascii(int) /*@*/ ;
2209char _toupper(/*@sef@*/ int) /*@*/ ;
2210char _tolower(/*@sef@*/ int) /*@*/ ;
2211# else
2212lltX_bool /*@alt int@*/ isascii(int /*@alt unsigned char@*/) /*@*/ ;
2213lltX_bool /*@alt int@*/ toascii(int /*@alt unsigned char@*/);
2214char /*@alt int@*/ _toupper(/*@sef@*/ int /*@alt unsigned char@*/);
2215char /*@alt int@*/ _tolower(/*@sef@*/ int /*@alt unsigned char@*/);
2216# endif
2217
2218/* other ctype.h functions in ansi.h */
345671f3 2219
2220/*
2221** stdlib.h
2222**
2223** evans 2001-08-27 - added from http://www.opengroup.org/onlinepubs/007908799/xsh/drand48.html
2224*/
2225
2226double drand48 (void) /*@modifies internalState@*/ ;
8fe44445 2227double erand48 (unsigned short int /*@-fixedformalarray@*/ xsubi[3] /*@=fixedformalarray@*/ )
2228 /*@modifies internalState@*/ ;
2229
345671f3 2230void srand48 (long int seedval) /*@modifies internalState@*/ ;
2231
2232/*
2233** netinet/in.h
2234**
2235** evans 2001-08-27 - added from http://www.opengroup.org/onlinepubs/007908799/xns/netinetin.h.html
2236*/
2237
2238typedef /*@unsignedintegraltype@*/ in_port_t; /* An unsigned integral type of exactly 16 bits. */
2239typedef /*@unsignedintegraltype@*/ in_addr_t; /* An unsigned integral type of exactly 32 bits. */
2240
2241typedef /*@unsignedintegraltype@*/ sa_family_t;
2242
2243struct in_addr {
2244 in_addr_t s_addr;
2245} ;
2246
2247struct sockaddr_in {
2248 sa_family_t sin_family;
2249 in_port_t sin_port;
2250 struct in_addr sin_addr;
2251 unsigned char sin_zero[8];
2252} ;
2253
2254
2255/* The <netinet/in.h> header defines the following macros for use as values of the level argument of
2256 getsockopt() and setsockopt():
2257 */
2258
2259/*@constant int IPPROTO_IP@*/
2260/*@constant int IPPROTO_ICMP@*/
2261/*@constant int IPPROTO_TCP@*/
2262/*@constant int IPPROTO_UDP@*/
2263
2264/* The <netinet/in.h> header defines the following macros for use as destination addresses for connect(), sendmsg() and sendto():
2265 */
2266
2267/*@constant in_addr_t INADDR_ANY@*/
2268/*@constant in_addr_t INADDR_BROADCAST@*/
2269
8fe44445 2270/*
2271** arpa/inet.h
2272*/
2273
2274in_addr_t htonl (in_addr_t hostlong) /*@*/ ;
2275in_port_t htons (in_port_t hostshort) /*@*/ ;
2276in_addr_t ntohl (in_addr_t netlong) /*@*/ ;
2277in_port_t ntohs (in_port_t netshort) /*@*/ ;
2278
345671f3 2279/*
2280** dirent.h
2281**
2282** evans 2001-08-27 - added from http://www.opengroup.org/onlinepubs/007908799/xsh/dirent.h.html
2283*/
2284
8fe44445 2285/*@-redef@*/ /*@-matchfields@*/ /* Has d_ino field, not in posix (?) */
2286
345671f3 2287struct dirent
2288{
2289 ino_t d_ino;
2290 char d_name[];
8fe44445 2291} ;
2292
2293/*@=redef@*/ /*@=matchfields@*/
345671f3 2294
2295typedef /*@abstract@*/ DIR;
2296
8fe44445 2297/*:i32 need to check annotations on these */
2298
345671f3 2299int closedir (DIR *) /*:errorcode -1*/ ;
86d93ed3 2300/*@null@*/ /*@dependent@*/ DIR *opendir(const char *) /*@modifies errno, fileSystem@*/ ;
d5047b91 2301
2302/* in posix.h: struct dirent *readdir(DIR *); */
2303
2304int readdir_r (DIR *, struct dirent *, /*@out@*/ struct dirent **result)
2305 /*@modifies *result@*/
2306 /*:errorcode !0:*/ ;
2307
345671f3 2308void rewinddir(DIR *);
2309void seekdir(DIR *, long int);
2310long int telldir(DIR *);
2311
2312/*drl added these functions
2313 stpcpy and stpncpy are found on linux but
2314 don't seem to be present on other unixes
2315
2316 thanks to Jeff Johnson for pointing out that
2317 these functions were in the unix library
2318*/
2319
2320/* this function is like strcpy but it reutrns a pointer to the null terminated character in dest instead of the beginning of dest */
2321
2322extern char * stpcpy(/*@out@*/ /*@returned@*/ char * dest, const char * src)
2323 /*@modifies *dest @*/
2324 /*@requires maxSet(dest) >= maxRead(src) @*/
2325 /*@ensures MaxRead(dest) == MaxRead (src) /\ MaxRead(result) == 0 /\ MaxSet(result) == ( maxSet(dest) - MaxRead(src) ); @*/;
2326
2327
2328extern char * stpncpy(/*@out@*/ /*@returned@*/ char * dest,
2329 const char * src, size_t n)
2330 /*@modifies *dest @*/
2331 /*@requires MaxSet(dest) >= ( n - 1 ); @*/ /*@ensures MaxRead (src) >= MaxRead(dest) /\ MaxRead (dest) <= n; @*/
2332 ;
2333
ed309918 2334 /* drl added 09-25-001
2335 Alexander Ma pointed out these were missing
2336 */
2337
ccf415d0 2338int usleep (useconds_t useconds) /*@modifies systemState, errno@*/
2339 /*error -1 sucess 0 */
2340 /* warn opengroup unix specification recommends using setitimer(), timer_create(), timer_delete(), timer_getoverrun(), timer_gettime() or
2341 timer_settime() instead of this interface.
2342 */
2343 ;
2344
e5f31c00 2345
2346 /* drl added 10-27-001 */
86d93ed3 2347 /*not sure what the exact size of this is
e5f31c00 2348 also can IPv6 use this function?
2349 */
86d93ed3 2350 /*I'm going to assume that the address had the format:
2351 "###.###.###.###" which is 16 bytes*/
e5f31c00 2352
86d93ed3 2353 /*@kept@*/ char *inet_ntoa(struct in_addr in)
e5f31c00 2354 /*@ensures maxSet(result) <= 15 /\ maxRead(result) <= 15 @*/
2355 ;
2356
2357
ed309918 2358 extern double hypot(double x, double y) /*@modifies errno@*/ /*error errno only*/;
2359
2360
2361 extern double j0(double x) /*@modifies errno @*/ /*error 0 or NaN */;
2362 extern double j1(double x) /*@modifies errno @*/ /*error 0 or NaN */;
2363 extern double jn(int n, double x) /*@modifies errno @*/ /*error 0 or NaN */;
2364
2365 extern double y0(double x) /*@modifies errno @*/ /*error NaN -HUGE_VAL 0.0 */ ;
2366 extern double y1 (double x) /*@modifies errno @*/ /*error NaN -HUGE_VAL 0.0 */;
2367 extern double yn (int n, double x) /*@modifies errno @*/ /*error NaN -HUGE_VAL 0.0 */;
2368
2369 extern double acosh(double x) /*@modifies errno @*/ /*error errno and implementation-dependent(NaN if present) */ /*error NaN and may errno*/;
2370 extern double asinh(double x) /*@modifies errno @*/ /*error NaN and may errno */;
2371
2372 extern double atanh(double x) /*@modifies errno @*/ /*error errno and implementation-dependent(NaN if present) */ /*error NaN and may errno */ ;
2373
2374 extern double lgamma(double x) /*@modifies errno @*/ /*error NaN or HUGE_VAL may set errno */;
2375
2376 extern int signgam ;
2377
2378 extern double erf(double x) /*@modifies errno @*/ /*error NaN or 0 may set errno */;
2379
2380 extern double erfc (double x) /*@modifies errno @*/ /*error NaN or 0
2381 may set errno */;
2382
2383
2384
2385
2386
2387
This page took 0.37154 seconds and 5 git commands to generate.