]> andersk Git - splint.git/blame - lib/unix.h
*** empty log message ***
[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
50 /*-------------------------------------------------------------
51 -------------------------------------------------------------
52 */
53
54
885824d3 55/*
56** Extra stuff in some unixen, not in posix.
57*/
58
8fe44445 59extern /*@unchecked@*/ int signgam;
885824d3 60
8fe44445 61/*@-redef@*/ /* Defined by ansi: */
885824d3 62typedef /*@integraltype@*/ clockid_t;
8fe44445 63/*@=redef@*/
885824d3 64
65extern void bcopy (char *b1, /*@out@*/ char *b2, int length)
66 /*@modifies *b2@*/ ; /* Yes, the second parameter is the out param! */
67
68extern int /*@alt lltX_bool@*/ bcmp (char *b1, char *b2, int length) /*@*/ ;
69 /* Return value is NOT like strcmp! */
70
71extern void bzero (/*@out@*/ char *b1, int length) /*@modifies *b1@*/ ;
72extern int ffs (int i) /*@*/ ;
73extern int symlink (char *name1, char *name2) /*@modifies fileSystem@*/ ;
74
75extern int
76 setvbuf_unlocked (FILE *stream, /*@null@*/ /*@exposed@*/ char *buf,
77 int mode, size_t size)
78 /*@modifies internalState@*/ ;
79
80extern void
81 setbuffer (FILE *stream, /*@null@*/ /*@exposed@*/ char *buf, int size)
82 /*@modifies internalState@*/ ;
83
84extern void setlinebuf (FILE *stream) /*@modifies internalState@*/ ;
85
86extern int strerror_r (int errnum, /*@out@*/ char *strerrbuf, int buflen)
87 /*@modifies strerrbuf@*/ ;
88
89extern size_t
90 fread_unlocked (/*@out@*/ void *ptr, size_t size, size_t nitems,
91 FILE *stream)
92 /*@modifies *stream, *ptr;@*/ ;
93
94extern size_t
95 fwrite_unlocked (void *pointer, size_t size, size_t num_items, FILE *stream)
96 /*@modifies *stream;@*/ ;
97
885824d3 98extern void /*@alt void * @*/
99 memccpy (/*@returned@*/ /*@out@*/ void *s1,
100 /*@unique@*/ void *s2, int c, size_t n)
101 /*@modifies *s1@*/ ;
102
103extern int strcasecmp (char *s1, char *s2) /*@*/ ;
104extern int strncasecmp (char *s1, char *s2, int n) /*@*/ ;
1d239d69 105extern /*@null@*/ /*@only@*/ char *strdup (char *s) /*@*/ ;
885824d3 106
885824d3 107extern /*@null@*/ /*@dependent@*/ char *
108 index (/*@returned@*/ char *s, char c) /*@*/ ;
109
110extern /*@null@*/ /*@dependent@*/ char *
111 rindex (/*@returned@*/ char *s, char c) /*@*/ ;
112
885824d3 113
114extern double cbrt (double x) /*@modifies errno@*/ ;
115extern double rint (double x) /*@*/ ;
116extern 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
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
288int ttyname_r (int fg, /*@out@*/ char *buffer, int len) /*@modifies buffer@*/ ;
289int ioctl (int d, int /*@alt long@*/ request, /*@out@*/ void *arg)
290 /*@modifies *arg, errno@*/ ; /* depends on request! */
291
885824d3 292pid_t vfork (void) /*@modifies fileSystem@*/ ;
293
294
15b3d2b2 295struct iovec {
296 void *iov_base;
297 size_t iov_len;
885824d3 298};
299
300/*@constant int UIO_MAXIOV@*/ /* BSD */
301/*@constant int IOV_MAX@*/ /* supposedly SVR4 */
302
303 extern ssize_t
304readv (int fd, const struct iovec iov[], int iovcnt)
305 /*@modifies iov[].iov_base, fileSystem, errno@*/;
306
307 extern ssize_t
308writev (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
332extern 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@*/
340extern 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
483accept (int s, struct sockaddr *addr, int *addrlen)
484 /*@modifies *addrlen, errno@*/;
485
486 extern int
487bind (int s, struct sockaddr *name, int namelen)
488 /*@modifies errno, fileSystem@*/;
489
490 extern int
491connect (int s, struct sockaddr *name, int namelen)
492 /*@modifies errno, internalState@*/;
493
7272a1c1 494int getpeername (int s, /*@out@*/ struct sockaddr *name, size_t *namelen)
885824d3 495 /*@modifies *name, *namelen, errno@*/;
496
7272a1c1 497int getsockname (int s, struct sockaddr *address, size_t *address_len)
8fe44445 498 /*: can't do this? requires maxSet(address) >= (*address_len) @*/
7272a1c1 499 /*@modifies *address, *address_len, errno@*/;
885824d3 500
7272a1c1 501int getsockopt (int s, int level, int optname, /*@out@*/ void *optval, size_t *optlen)
885824d3 502 /*@modifies *optval, *optlen, errno@*/;
503
504 extern int
505listen (int s, int backlog)
506 /*@modifies errno, internalState@*/;
507
508 extern ssize_t
509recv (int s, /*@out@*/ void *buf, size_t len, int flags)
510 /*@modifies *buf, errno@*/;
511
512 extern ssize_t
513recvfrom (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
517recvmsg (int s, struct msghdr *msg, int flags)
518 /*@modifies msg->msg_iov->iov_base[], errno@*/;
519
520 extern ssize_t
521send (int s, const void *msg, size_t len, int flags)
522 /*@modifies errno@*/;
523
524 extern ssize_t
525sendto (int s, const void *msg, size_t len, int flags, const struct sockaddr *to, int tolen)
526 /*@modifies errno@*/;
527
528 extern ssize_t
529sendmsg (int s, const struct msghdr *msg, int flags)
530 /*@modifies errno@*/;
531
532 extern int
533setsockopt (int s, int level, int optname, const void *optval, int optlen)
534 /*@modifies internalState, errno@*/;
535
536 extern int
537shutdown (int s, int how)
538 /*@modifies errno@*/;
539
540 extern int
541socket (int domain, int type, int protocol)
542 /*@modifies errno@*/;
543
544 extern int
545socketpair (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
568extern void psignal (int sig, const char *msg)
569 /*@modifies fileSystem@*/;
570
885824d3 571 extern int
572setenv (const char *name, const char *value, int overwrite)
573 /*@globals environ@*/
574 /*@modifies *environ, errno@*/;
575
885824d3 576 extern void
577unsetenv (const char *name)
578 /*@globals environ@*/
579 /*@modifies *environ@*/;
580
581/*________________________________________________________________________
582 * sys/wait.h
583 */
584
585 extern int
586WCOREDUMP (int x)
587 /*@*/;
588
589 extern int
590W_EXITCODE (int ret, int sig)
591 /*@*/;
592
593 extern int
594W_STOPCODE (int sig)
595 /*@*/;
596
597/*@constant int WAIT_ANY@*/
598/*@constant int WAIT_MYPGRP@*/
599/*@constant int WSTOPPED@*/
600
601 extern pid_t
602wait3 (int *statloc, int options, /*@null@*/ /*@out@*/ struct rusage *rusage)
603 /*@modifies *statloc, *rusage, errno@*/;
604
605 extern pid_t
606wait4 (pid_t p, int *statloc, int opt, /*@null@*/ /*@out@*/ struct rusage *r)
607 /*@modifies *statloc, *r, errno@*/;
608
609struct timeval {
610 long tv_sec;
611 long tv_usec;
612} ;
613
614struct timespec {
615 long ts_sec;
616 long ts_nsec;
617} ;
618
619struct 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
649adjtime (const struct timeval *delta, /*@null@*/ /*@out@*/ struct timeval *olddelta)
650 /*@modifies internalState, *olddelta, errno@*/;
651
652 extern int
653getitimer (int which, /*@out@*/ struct itimerval *value)
654 /*@modifies errno, *value*/;
655
656 extern int
657gettimeofday (/*@null@*/ /*@out@*/ struct timeval *tp, /*@null@*/ /*@out@*/ struct timezone *tzp)
658 /*@modifies *tp, *tzp, errno@*/;
659
660 extern int
661setitimer (int which, struct itimerval *val, /*@null@*/ /*@out@*/ struct itimerval *oval)
662 /*@modifies *oval, errno, internalState*/;
663
664 extern int
665settimeofday (const struct timeval *t, const struct timezone *z)
666 /*@modifies internalState, errno@*/;
667
668 extern int
669utimes (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
699mmap (/*@null@*/ /*@returned@*/ caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
700 /*@modifies addr@*/;
701
702 extern int
703madvise (caddr_t addr, int len, int behav)
704 /*@*/;
705
706 extern int
707mprotect (caddr_t addr, int len, int prot)
708 /*@*/;
709
710 extern int
345671f3 711 int munmap (/*@only@*/ caddr_t addr, size_t len)
712 /*@modifies fileSystem, *addr, errno @*/;
713
885824d3 714 extern int
715msync (caddr_t addr, int len, int flags)
716 /*@*/;
717
718 extern int
719mlock (caddr_t addr, size_t len)
720 /*@*/;
721
722 extern int
723munlock (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
807FD_CLR (int n, fd_set *p)
808 /*@modifies *p@*/;
809
810 extern void
811FD_COPY (fd_set *f, /*@out@*/ fd_set *t)
812 /*@modifies *t@*/;
813
814 extern int /*@alt lltX_bool@*/
815FD_ISSET (int n, fd_set *p)
816 /*@*/;
817
818 extern void
819FD_SET (int n, fd_set *p)
820 /*@modifies *p@*/;
821
822 extern void
823FD_ZERO (fd_set /*@out@*/ *p)
824 /*@modifies *p@*/;
825
826 extern int
827fchdir (int fd)
828 /*@modifies internalState, errno@*/;
829
830 extern int
831fchown (int fd, uid_t owner, gid_t group)
832 /*@modifies errno, fileSystem@*/;
833
834 extern int
835fsync (int fd)
836 /*@modifies errno, fileSystem@*/;
837
838 extern int
839ftruncate (int fd, off_t length)
840 /*@modifies errno, fileSystem@*/;
841
b072092f 842int gethostname (/*@out@*/ char *address, size_t address_len)
843 /*:errorstatus@*/
844 /*@modifies address@*/ ;
885824d3 845
b072092f 846int initgroups (const char *name, int basegid)
847 /*@modifies internalState@*/;
885824d3 848
849 extern int
850lchown (const char *path, uid_t owner, gid_t group)
851 /*@modifies errno, fileSystem@*/;
852
853 extern int
854readlink (const char *path, /*@out@*/ char *buf, int size)
e5f31c00 855 /*@modifies *buf, errno@*/
856 /*drl 10/27/001*/
857 /*@requires maxSet(buf) >= (size - 1) @*/
858 /*@ensures result <= size @*/;
885824d3 859
860 extern int
861select (int mfd, fd_set /*@null@*/ *r, fd_set /*@null@*/ *w, fd_set /*@null@*/ *e, struct timeval *t)
862 /*@modifies *r, *w, *e, *t, errno@*/;
863
864 extern int
865setegid (gid_t egid)
866 /*@modifies errno, internalState@*/;
867
868 extern int
869seteuid (uid_t euid)
870 /*@modifies errno, internalState@*/;
871
872 extern int
873setgroups (int ngroups, const gid_t *gidset)
874 /*@modifies errno, internalState@*/;
875
876 extern int
877setregid (gid_t rgid, gid_t egid)
878 /*@modifies errno, internalState@*/;
879
880 extern int
881setreuid (gid_t ruid, gid_t euid)
882 /*@modifies errno, internalState@*/;
883
884 extern void
885sync (void)
886 /*@modifies fileSystem@*/;
887
888 extern int
889symlink (const char *path, const char *path2)
890 /*@modifies fileSystem@*/;
891
892 extern int
893truncate (const char *name, off_t length)
894 /*@modifies errno, fileSystem@*/;
895
896/*@constant int EBADRPC@*/
897/*@constant int ERPCMISMATCH@*/
898/*@constant int EPROGUNAVAIL@*/
899/*@constant int EPROGMISMATCH@*/
900/*@constant int EPROCUNAVAIL@*/
901/*@constant int EFTYPE@*/
902/*@constant int EAUTH@*/
903/*@constant int ENEEDAUTH@*/
904/*@constant int ELAST@*/
905
906/*________________________________________________________________________
907 * tar.h
908 */
909
910/*@unchecked@*/ extern char *TMAGIC;
911/*@constant int TMAGLEN@*/
912/*@unchecked@*/ extern char *TVERSION;
913/*@constant int TVERSLEN@*/
914
915/*@constant int REGTYPE@*/
916/*@constant int AREGTYPE@*/
917/*@constant int LNKTYPE@*/
918/*@constant int SYMTYPE@*/
919/*@constant int CHRTYPE@*/
920/*@constant int BLKTYPE@*/
921/*@constant int DIRTYPE@*/
922/*@constant int FIFOTYPE@*/
923/*@constant int CONTTYPE@*/
924
925/*@constant int TSUID@*/
926/*@constant int TSGID@*/
927/*@constant int TSVTX@*/
928
929/*@constant int TUREAD@*/
930/*@constant int TUWRITE@*/
931/*@constant int TUEXEC@*/
932/*@constant int TGREAD@*/
933/*@constant int TGWRITE@*/
934/*@constant int TGEXEC@*/
935/*@constant int TOREAD@*/
936/*@constant int TOWRITE@*/
937/*@constant int TOEXEC@*/
938
939struct ipc_perm {
940 uid_t uid; /* user id */
941 gid_t gid; /* group id */
942 uid_t cuid; /* creator user id */
943 gid_t cgid; /* creator group id */
944 mode_t mode; /* r/w permission */
945 ulong seq; /* slot usage sequence number */
946 key_t key; /* user specified msg/sem/shm key */
947} ;
948
949/*@constant int IPC_R@*/
950/*@constant int IPC_W@*/
951/*@constant int IPC_M@*/
952/*@constant int IPC_CREAT@*/
953/*@constant int IPC_EXCL@*/
954/*@constant int IPC_NOWAIT@*/
955/*@constant key_t IPC_PRIVATE@*/
956/*@constant int IPC_RMID@*/
957/*@constant int IPC_SET@*/
958/*@constant int IPC_STAT@*/
959
960/*________________________________________________________________________
961 * sys/msg.h
962 */
963
964 struct msqid_ds {
965 struct ipc_perm msg_perm; /* msg queue permission bits */
966 struct msg *msg_first; /* first message in the queue */
967 struct msg *msg_last; /* last message in the queue */
968 u_long msg_cbytes; /* number of bytes in use on the queue */
969 u_long msg_qnum; /* number of msgs in the queue */
970 u_long msg_qbytes; /* max # of bytes on the queue */
971 pid_t msg_lspid; /* pid of last msgsnd() */
972 pid_t msg_lrpid; /* pid of last msgrcv() */
973 time_t msg_stime; /* time of last msgsnd() */
974 time_t msg_rtime; /* time of last msgrcv() */
975 time_t msg_ctime; /* time of last msgctl() */
976};
977
978 struct mymesg {
979 long mtype; /* message type (+ve integer) */
980 char mtext[]; /* message body */
981};
982
983/*@constant int MSG_NOERROR@*/
984/*@constant int MSGMAX@*/
985/*@constant int MSGMNB@*/
986/*@constant int MSGMNI@*/
987/*@constant int MSGTQL@*/
988
989 extern int
990msgctl (int id , int cmd, /*@out@*/ struct msqid_ds *buf)
991 /*@modifies errno, *buf@*/;
992
993 extern int
994msgget (key_t key, int flag)
995 /*@modifies errno@*/;
996
997 extern int
998msgrcv (int id, /*@out@*/ void *ptr, size_t nbytes, long type, int flags)
999 /*@modifies errno, *ptr@*/;
1000
1001 extern int
1002msgsnd (int id, const void *ptr, size_t nbytes, int flag)
1003 /*@modifies errno@*/;
1004
1005/*________________________________________________________________________
1006 * sys/sem.h
1007 */
1008
1009 struct semid_ds {
1010 struct ipc_perm sem_perm;
1011 struct sem *sem_base;
1012 ushort sem_nsems;
1013 time_t sem_otime;
1014 time_t sem_ctime;
1015};
1016
1017 struct sem {
1018 ushort semval;
1019 pid_t sempid;
1020 ushort semncnt;
1021 ushort semzcnt;
1022};
1023
1024 union semun {
1025 int val;
1026 struct semid_ds *buf;
1027 ushort *array;
1028};
1029
1030 struct sembuf {
1031 ushort sem_num;
1032 short sem_op;
1033 short sem_flg;
1034};
1035
1036/*@constant int SEM_A@*/
1037/*@constant int SEMAEM@*/
1038/*@constant int SEMMNI@*/
1039/*@constant int SEMMNS@*/
1040/*@constant int SEMMNU@*/
1041/*@constant int SEMMSL@*/
1042/*@constant int SEMOPN@*/
1043/*@constant int SEM_R@*/
1044/*@constant int SEMUME@*/
1045/*@constant int SEM_UNDO@*/
1046/*@constant int SEMVMX@*/
1047/*@constant int GETVAL@*/
1048/*@constant int SETVAL@*/
1049/*@constant int GETPID@*/
1050/*@constant int GETNCNT@*/
1051/*@constant int GETZCNT@*/
1052/*@constant int GETALL@*/
1053/*@constant int SETALL@*/
1054
1055/*@constant int ERMID@*/
1056
1057 extern int
1058semctl (int id, int semnum, int cmd, union semun arg)
1059 /*@modifies errno@*/;
1060
1061 extern int
1062semget (key_t key, int nsems, int flag)
1063 /*@modifies errno@*/;
1064
1065 extern int
1066semop (int id, struct sembuf *semoparray, size_t nops)
1067 /*@modifies errno@*/;
1068
1069/*________________________________________________________________________
1070 * sys/shm.h
1071 */
1072
1073 struct shmid_ds {
1074 struct ipc_perm shm_perm;
1075 int shm_segsz;
1076 ushort shm_lkcnt;
1077 pid_t shm_lpid;
1078 pid_t shm_cpid;
1079 ulong shm_nattch;
1080 ulong shm_cnattch;
1081 time_t shm_atime;
1082 time_t shm_dtime;
1083 time_t shm_ctime;
1084};
1085
1086/*@constant int SHMLBA@*/
1087/*@constant int SHM_LOCK@*/
1088/*@constant int SHMMAX@*/
1089/*@constant int SHMMIN@*/
1090/*@constant int SHMMNI@*/
1091/*@constant int SHM_R@*/
1092/*@constant int SHM_RDONLY@*/
1093/*@constant int SHM_RND@*/
1094/*@constant int SHMSEG@*/
1095/*@constant int SHM_W@*/
1096/*@constant int SHM_UNLOCK@*/
1097
1098 void *
1099shmat (int id, /*@null@*/ void *addr, int flag)
1100 /*@modifies errno@*/;
1101
1102 extern int
1103shmctl (int id, int cmd, /*@out@*/ struct shmid_ds *buf)
1104 /*@modifies errno, *buf@*/;
1105
1106 extern int
1107shmdt (void *addr)
1108 /*@modifies errno@*/;
1109
1110 extern int
1111shmget (key_t key, int size, int flag)
1112 /*@modifies errno@*/;
1113
885824d3 1114/*________________________________________________________________________
1115 * syslog.h
1116 */
1117
1118/*@constant int LOG_EMERG@*/
1119/*@constant int LOG_ALERT@*/
1120/*@constant int LOG_CRIT@*/
1121/*@constant int LOG_ERR@*/
1122/*@constant int LOG_WARNING@*/
1123/*@constant int LOG_NOTICE@*/
1124/*@constant int LOG_INFO@*/
1125/*@constant int LOG_DEBUG@*/
1126
1127/*@constant int LOG_KERN@*/
1128/*@constant int LOG_USER@*/
1129/*@constant int LOG_MAIL@*/
1130/*@constant int LOG_DAEMON@*/
1131/*@constant int LOG_AUTH@*/
1132/*@constant int LOG_SYSLOG@*/
1133/*@constant int LOG_LPR@*/
1134/*@constant int LOG_NEWS@*/
1135/*@constant int LOG_UUCP@*/
1136/*@constant int LOG_CRON@*/
1137/*@constant int LOG_AUTHPRIV@*/
1138/*@constant int LOG_FTP@*/
1139/*@constant int LOG_LOCAL0@*/
1140/*@constant int LOG_LOCAL1@*/
1141/*@constant int LOG_LOCAL2@*/
1142/*@constant int LOG_LOCAL3@*/
1143/*@constant int LOG_LOCAL4@*/
1144/*@constant int LOG_LOCAL5@*/
1145/*@constant int LOG_LOCAL6@*/
1146/*@constant int LOG_LOCAL7@*/
1147
1148/*@constant int LOG_PID@*/
1149/*@constant int LOG_CONS@*/
1150/*@constant int LOG_ODELAY@*/
1151/*@constant int LOG_NDELAY@*/
1152/*@constant int LOG_NOWAIT@*/
1153/*@constant int LOG_PERROR@*/
1154
1155 extern int
1156LOG_MASK (int pri)
1157 /*@*/;
1158
1159 extern int
1160LOG_UPTO (int pri)
1161 /*@*/;
1162
1163 extern void
1164closelog (void)
1165 /*@modifies fileSystem@*/;
1166
1167 extern void
1168openlog (const char *ident, int logopt, int facility)
1169 /*@modifies fileSystem@*/;
1170
1171 extern int
1172setlogmask (int maskpri)
1173 /*@modifies internalState@*/;
1174
1175 extern void /*@printflike@*/
1176syslog (int priority, const char *message, ...)
1177 /*@modifies fileSystem@*/;
1178
1179 extern void
1180vsyslog (int priority, const char *message, va_list args)
1181 /*@modifies fileSystem@*/;
1182
1183/*________________________________________________________________________
1184 * pwd.h
1185 */
1186
1187 extern extern void
1188endpwent (void)
1189 /*@modifies internalState@*/;
1190
1191 extern /*@null@*/ struct passwd *
1192getpwent (void)
1193 /*@modifies internalState@*/;
1194
1195 extern int
1196setpassent (int stayopen)
1197 /*@modifies internalState@*/;
1198
1199 extern int
1200setpwent (void)
1201 /*@modifies internalState@*/;
1202
1203/*________________________________________________________________________
1204 * grp.h
1205 */
1206
1207 extern void
1208endgrent (void)
1209 /*@modifies internalState@*/;
1210
1211 extern /*@null@*/ struct group *
1212getgrent (void)
1213 /*@modifies internalState@*/;
1214
1215 extern int
1216setgrent (void)
1217 /*@modifies internalState@*/;
1218
1219 extern void
1220setgrfile (const char *name)
1221 /*@modifies internalState@*/;
1222
1223 extern int
1224setgroupent (int stayopen)
1225 /*@modifies internalState@*/;
1226
1d239d69 1227/*
1228** sys/stat.h
1229**
1230** evans 2001-08-26 - updated from http://www.opengroup.org/onlinepubs/007908799/xsh/sysstat.h.html
1231*/
1232
1233/*
1234** struct stat replaces POSIX version - more required fields in Unix
1235*/
1236
8fe44445 1237/*@-redef@*/ /*@-matchfields@*/
1d239d69 1238struct stat {
1239 dev_t st_dev; /* ID of device containing file */
1240 ino_t st_ino; /* file serial number */
1241 mode_t st_mode; /* mode of file (see below) */
1242 nlink_t st_nlink; /* number of links to the file */
1243 uid_t st_uid; /* user ID of file */
1244 gid_t st_gid; /* group ID of file */
1245 dev_t st_rdev; /* device ID (if file is character or block special) */
1246 off_t st_size; /* file size in bytes (if file is a regular file) */
1247 time_t st_atime; /* time of last access */
1248 time_t st_mtime; /* time of last data modification */
1249 time_t st_ctime; /* time of last status change */
1250 blksize_t st_blksize; /* a filesystem-specific preferred I/O block size for
1251 this object. In some filesystem types, this may
1252 vary from file to file */
1253 blkcnt_t st_blocks; /* number of blocks allocated for this object */
8fe44445 1254} ;
1255/*@=redef@*/ /*@=matchfields@*/
885824d3 1256
1d239d69 1257/*@constant mode_t S_IFMT@*/
1258/*@constant mode_t S_IFBLK@*/
1259/*@constant mode_t S_IFCHR@*/
1260/*@constant mode_t S_IFIFO@*/
1261/*@constant mode_t S_IFREG@*/
1262/*@constant mode_t S_IFDIR@*/
1263/*@constant mode_t S_IFLNK@*/
1264
1265/*@constant mode_t S_IRWXU@*/
1266/*@constant mode_t S_IRUSR@*/
8fe44445 1267
1268/*@-incondefs@*/ /*: probably wrong in posix.h? */
1d239d69 1269/*@constant mode_t S_IWUSR@*/
1270/*@constant mode_t S_IXUSR@*/
1271/*@constant mode_t S_IRWXG@*/
1272/*@constant mode_t S_IRGRP@*/
1273/*@constant mode_t S_IWGRP@*/
1274/*@constant mode_t S_IXGRP@*/
1275/*@constant mode_t S_IRWXO@*/
1276/*@constant mode_t S_IROTH@*/
1277/*@constant mode_t S_IWOTH@*/
1278/*@constant mode_t S_IXOTH@*/
1279/*@constant mode_t S_ISUID@*/
1280/*@constant mode_t S_ISGID@*/
1281/*@constant mode_t S_ISVTX@*/
1282
8fe44445 1283/*@=incondefs@*/
1284
1d239d69 1285# if 0
345671f3 1286/*These are the old definitions - they don't appear to be in the Single UNIX Specification */
1287
885824d3 1288/*@constant int S_ISTXT@*/
1289/*@constant int S_IREAD@*/
1290/*@constant int S_IWRITE@*/
1291/*@constant int S_IEXEC@*/
1292/*@constant int S_IFMT@*/
1293/*@constant int S_IFIFO@*/
1294/*@constant int S_IFCHR@*/
1295/*@constant int S_IFDIR@*/
1296/*@constant int S_IFBLK@*/
1297/*@constant int S_IFREG@*/
1298/*@constant int S_IFLNK@*/
1299/*@constant int S_IFSOCK@*/
1300/*@constant int S_ISVTX@*/
1301/*@constant int S_ISVTX@*/
1302/*@constant int SF_SETTABLE@*/
1303/*@constant int SF_ARCHIVED@*/
1304/*@constant int ACCESSPERMS@*/
1305/*@constant int ALLPERMS@*/
1306/*@constant int DEFFILEMODE@*/
1307/*@constant int S_BLKSIZE@*/
1308/*@constant int SF_IMMUTABLE@*/
1309/*@constant int SF_APPEND@*/
1310/*@constant int UF_NODUMP@*/
1311/*@constant int UF_IMMUTABLE@*/
1312/*@constant int UF_APPEND@*/
1d239d69 1313# endif
885824d3 1314
1d239d69 1315int /*@alt lltX_bool@*/ S_ISBLK (/*@sef@*/ mode_t m) /*@*/;
1316int /*@alt lltX_bool@*/ S_ISCHR (/*@sef@*/ mode_t m) /*@*/;
1317int /*@alt lltX_bool@*/ S_ISDIR (/*@sef@*/ mode_t m) /*@*/;
1318int /*@alt lltX_bool@*/ S_ISFIFO (/*@sef@*/ mode_t m) /*@*/;
1319int /*@alt lltX_bool@*/ S_ISREG (/*@sef@*/ mode_t m) /*@*/;
1320int /*@alt lltX_bool@*/ S_ISLNK (/*@sef@*/ mode_t m) /*@*/;
885824d3 1321
1d239d69 1322int /*@alt lltX_bool@*/ S_TYPEISMQ (/*@sef@*/ struct stat *buf) /*@*/ ;
1323int /*@alt lltX_bool@*/ S_TYPEISSEM (/*@sef@*/ struct stat *buf) /*@*/ ;
1324int /*@alt lltX_bool@*/ S_TYPEISSHM (/*@sef@*/ struct stat *buf) /*@*/ ;
885824d3 1325
1d239d69 1326/* in POSIX: chmod, fstat, mkdir, mkfifo, stat, umask */
885824d3 1327
1d239d69 1328int lstat(const char *, /*@out@*/ struct stat *)
1329 /*:errorcode -1:*/
1330 /*@modifies errno@*/ ;
885824d3 1331
1d239d69 1332int mknod (const char *, mode_t, dev_t)
1333 /*@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."@*/
1334 /*:errorcode -1:*/
1335 /*@modifies errno@*/ ;
885824d3 1336
1d239d69 1337int chflags (const char *path, u_long flags)
1338 /*@warn unixstandard "Not in Single UNIX Specification Version 2"@*/
1339 /*@modifies fileSystem, errno@*/;
1340
1341int fchflags (int fd, u_long flags)
1342 /*@warn unixstandard "Not in Single UNIX Specification Version 2"@*/
1343 /*@modifies fileSystem, errno@*/;
885824d3 1344
1345/*________________________________________________________________________
1346 * stropts.h
1347 */
1348
1349/*@constant int FMNAMESZ@*/
1350/*@constant int MSG_BAND@*/
1351/*@constant int MSG_HIPRI@*/
1352/*@constant int RS_HIPRI@*/
1353/*@constant int S_INPUT@*/
1354/*@constant int S_RDNORM@*/
1355/*@constant int S_RDBAND@*/
1356/*@constant int S_BANDURG@*/
1357/*@constant int S_HIPRI@*/
1358/*@constant int S_OUTPUT@*/
1359/*@constant int S_WRNORM@*/
1360/*@constant int S_WRBAND@*/
1361/*@constant int S_MSG@*/
1362/*@constant int S_ERROR@*/
1363/*@constant int S_HANGUP@*/
1364
1365 struct strbuf {
1366 int maxlen;
1367 int len;
1368 char *buf;
1369}
1370
1371 struct str_mlist {
1372 char l_name[];
1373}
1374
1375 struct str_list {
1376 int sl_nmods;
1377 struct str_mlist *sl_modlist;
1378}
1379
1380 extern int
1381getmsg (int fd, /*@out@*/ struct strbuf *c, /*@out@*/ struct strbuf *d, int *f)
1382 /*@modifies *c, *d, errno@*/;
1383
1384 extern int
1385getpmsg (int fd, /*@out@*/ struct strbuf *c, /*@out@*/ struct strbuf *d, int *b, int *f)
1386 /*@modifies *b, *c, *d, errno@*/;
1387
1388 extern int
1389putmsg (int fd, const struct strbuf *c, const struct strbuf *d, int *f)
1390 /*@modifies internalState, errno@*/;
1391
dfd82dce 1392extern int putpmsg (int fd, const struct strbuf *c, const struct strbuf *d, int b, int *f)
1393 /*@modifies internalState, errno@*/;
885824d3 1394
1395/*________________________________________________________________________
1396 * sys/resource.h
1397 */
1398
1399/*@constant int RLIMIT_CPU@*/
1400/*@constant int RLIMIT_FSIZE@*/
1401/*@constant int RLIMIT_DATA@*/
1402/*@constant int RLIMIT_STACK@*/
1403/*@constant int RLIMIT_CORE@*/
1404/*@constant int RLIMIT_RSS@*/
1405/*@constant int RLIMIT_MEMLOCK@*/
1406/*@constant int RLIMIT_NPROC@*/
1407/*@constant int RLIMIT_NOFILE@*/
1408/*@constant int RLIM_NLIMITS@*/
1409/*@constant int RLIM_INFINITY@*/
1410/*@constant int PRIO_MIN@*/
1411/*@constant int PRIO_MAX@*/
1412/*@constant int PRIO_PROCESS@*/
1413/*@constant int PRIO_PGRP@*/
1414/*@constant int PRIO_USER@*/
1415/*@constant int RUSAGE_SELF@*/
1416/*@constant int RUSAGE_CHILDREN@*/
1417
1418 struct rusage {
1419 struct timeval ru_utime; /* user time used */
1420 struct timeval ru_stime; /* system time used */
1421 long ru_maxrss; /* max resident set size */
1422 long ru_ixrss; /* integral shared memory size */
1423 long ru_idrss; /* integral unshared data " */
1424 long ru_isrss; /* integral unshared stack " */
1425 long ru_minflt; /* page reclaims */
1426 long ru_majflt; /* page faults */
1427 long ru_nswap; /* swaps */
1428 long ru_inblock; /* block input operations */
1429 long ru_oublock; /* block output operations */
1430 long ru_msgsnd; /* messages sent */
1431 long ru_msgrcv; /* messages received */
1432 long ru_nsignals; /* signals received */
1433 long ru_nvcsw; /* voluntary context switches */
1434 long ru_nivcsw; /* involuntary " */
1435};
1436
1437 struct rlimit {
1438 long rlim_cur;
1439 long rlim_max;
1440};
1441
1442 struct loadavg {
1443 unsigned long ldavg[3];
1444 long fscale;
1445};
1446
1447 extern int
1448getpriority (int which, int who)
1449 /*@modifies errno@*/;
1450
1451 extern int
1452getrlimit (int res, /*@out@*/ struct rlimit *rlp)
1453 /*@modifies *rlp, errno@*/;
1454
1455 extern int
1456getrusage (int who, /*@out@*/ struct rusage *rusage)
1457 /*@modifies *rusage, errno@*/;
1458
1459 extern int
1460setpriority (int which, int who, int prio)
1461 /*@modifies errno, internalState@*/;
1462
1463 extern int
1464setrlimit (int resource, const struct rlimit *rlp)
1465 /*@modifies errno, internalState@*/;
1466
7272a1c1 1467
1468/*
1469** in <netdb.h>
1470*/
1471
1472struct servent
1473{
1474 /*@observer@*/ char *s_name; /* Official service name. */
1475 /*@observer@*/ char **s_aliases; /* Alias list. */
1476 int s_port; /* Port number. */
1477 /*@observer@*/ char *s_proto; /* Protocol to use. */
1478} ;
1479
1480/*@observer@*/ /*@dependent@*/ /*@null@*/ struct servent *getservbyname (const char *name, /*@null@*/ const char *proto)
1481 /*@warn multithreaded "Unsafe in multithreaded applications, use getsrvbyname_r instead"@*/ ;
1482
1483struct servent *getservbyname_r (const char *name, /*@null@*/ const char *proto, /*@out@*/ /*@returned@*/ struct servent *result, /*@out@*/ char *buffer, int buflen)
1484 /*@requires maxSet (buffer) >= buflen@*/ ;
1485
1486
1487/*@observer@*/ /*@dependent@*/ struct servent *getservbyport (int port, /*@null@*/ const char *proto)
1488 /*@warn multithreaded "Unsafe in multithreaded applications, use getservbyport_r instead"@*/ ;
1489
1490struct servent *getservbyport_r (int port, /*@null@*/ const char *proto, /*@out@*/ /*@returned@*/ struct servent *result, /*@out@*/ char *buffer, int buflen)
1491 /*@requires maxSet (buffer) >= buflen@*/ ;
1492
1493/*@null@*/ struct servent *getservent (void);
1494
1495/*@null@*/ struct servent *getservent_r (struct servent *result, char *buffer, int buflen);
1496
1497int setservent (int stayopen);
7272a1c1 1498int endservent (void);
1499
7272a1c1 1500extern int h_errno;
1501
1502/*@null@*/ /*@observer@*/ struct hostent *gethostbyname (/*@nullterminated@*/ /*@notnull@*/ const char *name)
1503 /*@warn multithreaded "Unsafe in multithreaded applications, use gethostbyname_r instead"@*/
1504 /*@modifies h_errno@*/ ;
1505
1506struct hostent *gethostbyname_r (/*@nullterminated@*/ const char *name, /*@notnull@*/ /*@returned@*/ struct hostent *hent, /*@out@*/ /*@exposed@*/ char *buffer, int bufsize, /*@out@*/ int *h_errnop)
1507 /*@requires maxSet(buffer) >= bufsize@*/ ;
1508
1509/*@null@*/ /*@observer@*/ struct hostent *gethostbyaddr (/*@notnull@*/ const void *addr, size_t addrlen, int type)
8fe44445 1510 /*@requires maxRead(addr) == addrlen@*/ /*:i534 ??? is this right? */
7272a1c1 1511 /*@warn multithreaded "Unsafe in multithreaded applications, use gethostbyaddr_r instead"@*/
1512 /*@modifies h_errno@*/ ;
1513
1514struct hostent *gethostbyaddr_r (/*@notnull@*/ const void *addr, size_t addrlen, int type,
1515 /*@returned@*/ /*@out@*/ struct hostent *hent,
1516 /*@exposed@*/ /*@out@*/ char *buffer, int bufsize, /*@out@*/ int *h_errnop)
8fe44445 1517 /*@requires maxRead(addr) == addrlen /\ maxSet(buffer) >= bufsize@*/
1518 /*:i534 ??? is this right? */ ;
7272a1c1 1519
1520/*@observer@*/ /*@null@*/ struct hostent *gethostent (void)
1521 /*@warn multithreaded "Unsafe in multithreaded applications, use gethostent_r instead"@*/ ;
1522
1523struct hostent *gethostent_r (/*@out@*/ /*@returned@*/ struct hostent *hent, /*@exposed@*/ /*@out@*/ char *buffer, int bufsize)
1524 /*@requires maxSet(buffer) >= bufsize@*/ ;
1525
8fe44445 1526/*:i534 need to annotate these: */
7272a1c1 1527
8fe44445 1528struct hostent *fgethostent(FILE *f);
7272a1c1 1529struct hostent *fgethostent_r(FILE*f, struct hostent *hent, char buffer, int bufsize);
7272a1c1 1530void sethostent(int stayopen);
7272a1c1 1531void endhostent(void);
7272a1c1 1532void herror(const char *string);
7272a1c1 1533char *hstrerror(int err);
1534
1535struct hostent {
1536 /*@observer@*/ /*@nullterminated@*/ char *h_name; /* official name of host */
1537 /*@observer@*/ /*@nullterminated@*/ char * /*:observer@*/ /*:nullterminated@*/ *h_aliases; /* alias list */
1538 int h_addrtype; /* host address type*/
1539 int h_length; /* length ofaddress*/
1540 /*@observer@*/ /*@nullterminated@*/ char * /*:observer@*/ /*:nullterminated@*/ *h_addr_list; /* list of addressesfrom name server */
1541 /*@observer@*/ /*@nullterminated@*/ char *h_addr; /* first address in list (backward compatibility) */
1542} ;
1543
7272a1c1 1544/*
1545** unistd.h
1546*/
1547
1548int chroot (/*@notnull@*/ /*@nullterminated@*/ const char *path)
1549 /*:statusreturn@*/
1550 /*@warn superuser "Only super-user processes may call chroot."@*/
1551 /*: other wanings? */ ;
1552
1553int fchroot (int fildes)
1554 /*:statusreturn@*/
1555 /*@warn superuser "Only super-user processes may call fchroot."@*/ ;
1d239d69 1556
1557/*
1558** ctype.h
1559**
1560** evans 2001-08-26 - added from http://www.opengroup.org/onlinepubs/007908799/xsh/ctype.h.html
1561*/
1562
1563# ifdef STRICT
1564lltX_bool isascii(int) /*@*/ ;
1565lltX_bool toascii(int) /*@*/ ;
1566char _toupper(/*@sef@*/ int) /*@*/ ;
1567char _tolower(/*@sef@*/ int) /*@*/ ;
1568# else
1569lltX_bool /*@alt int@*/ isascii(int /*@alt unsigned char@*/) /*@*/ ;
1570lltX_bool /*@alt int@*/ toascii(int /*@alt unsigned char@*/);
1571char /*@alt int@*/ _toupper(/*@sef@*/ int /*@alt unsigned char@*/);
1572char /*@alt int@*/ _tolower(/*@sef@*/ int /*@alt unsigned char@*/);
1573# endif
1574
1575/* other ctype.h functions in ansi.h */
345671f3 1576
1577/*
1578** stdlib.h
1579**
1580** evans 2001-08-27 - added from http://www.opengroup.org/onlinepubs/007908799/xsh/drand48.html
1581*/
1582
1583double drand48 (void) /*@modifies internalState@*/ ;
8fe44445 1584double erand48 (unsigned short int /*@-fixedformalarray@*/ xsubi[3] /*@=fixedformalarray@*/ )
1585 /*@modifies internalState@*/ ;
1586
345671f3 1587void srand48 (long int seedval) /*@modifies internalState@*/ ;
1588
1589/*
1590** netinet/in.h
1591**
1592** evans 2001-08-27 - added from http://www.opengroup.org/onlinepubs/007908799/xns/netinetin.h.html
1593*/
1594
1595typedef /*@unsignedintegraltype@*/ in_port_t; /* An unsigned integral type of exactly 16 bits. */
1596typedef /*@unsignedintegraltype@*/ in_addr_t; /* An unsigned integral type of exactly 32 bits. */
1597
1598typedef /*@unsignedintegraltype@*/ sa_family_t;
1599
1600struct in_addr {
1601 in_addr_t s_addr;
1602} ;
1603
1604struct sockaddr_in {
1605 sa_family_t sin_family;
1606 in_port_t sin_port;
1607 struct in_addr sin_addr;
1608 unsigned char sin_zero[8];
1609} ;
1610
1611
1612/* The <netinet/in.h> header defines the following macros for use as values of the level argument of
1613 getsockopt() and setsockopt():
1614 */
1615
1616/*@constant int IPPROTO_IP@*/
1617/*@constant int IPPROTO_ICMP@*/
1618/*@constant int IPPROTO_TCP@*/
1619/*@constant int IPPROTO_UDP@*/
1620
1621/* The <netinet/in.h> header defines the following macros for use as destination addresses for connect(), sendmsg() and sendto():
1622 */
1623
1624/*@constant in_addr_t INADDR_ANY@*/
1625/*@constant in_addr_t INADDR_BROADCAST@*/
1626
8fe44445 1627/*
1628** arpa/inet.h
1629*/
1630
1631in_addr_t htonl (in_addr_t hostlong) /*@*/ ;
1632in_port_t htons (in_port_t hostshort) /*@*/ ;
1633in_addr_t ntohl (in_addr_t netlong) /*@*/ ;
1634in_port_t ntohs (in_port_t netshort) /*@*/ ;
1635
345671f3 1636/*
1637** dirent.h
1638**
1639** evans 2001-08-27 - added from http://www.opengroup.org/onlinepubs/007908799/xsh/dirent.h.html
1640*/
1641
8fe44445 1642/*@-redef@*/ /*@-matchfields@*/ /* Has d_ino field, not in posix (?) */
1643
345671f3 1644struct dirent
1645{
1646 ino_t d_ino;
1647 char d_name[];
8fe44445 1648} ;
1649
1650/*@=redef@*/ /*@=matchfields@*/
345671f3 1651
1652typedef /*@abstract@*/ DIR;
1653
8fe44445 1654/*:i32 need to check annotations on these */
1655
345671f3 1656int closedir (DIR *) /*:errorcode -1*/ ;
1657/*@null@*/ DIR *opendir(const char *) ;
1658struct dirent *readdir(DIR *);
1659int readdir_r(DIR *, struct dirent *, struct dirent **);
1660void rewinddir(DIR *);
1661void seekdir(DIR *, long int);
1662long int telldir(DIR *);
1663
1664/*drl added these functions
1665 stpcpy and stpncpy are found on linux but
1666 don't seem to be present on other unixes
1667
1668 thanks to Jeff Johnson for pointing out that
1669 these functions were in the unix library
1670*/
1671
1672/* this function is like strcpy but it reutrns a pointer to the null terminated character in dest instead of the beginning of dest */
1673
1674extern char * stpcpy(/*@out@*/ /*@returned@*/ char * dest, const char * src)
1675 /*@modifies *dest @*/
1676 /*@requires maxSet(dest) >= maxRead(src) @*/
1677 /*@ensures MaxRead(dest) == MaxRead (src) /\ MaxRead(result) == 0 /\ MaxSet(result) == ( maxSet(dest) - MaxRead(src) ); @*/;
1678
1679
1680extern char * stpncpy(/*@out@*/ /*@returned@*/ char * dest,
1681 const char * src, size_t n)
1682 /*@modifies *dest @*/
1683 /*@requires MaxSet(dest) >= ( n - 1 ); @*/ /*@ensures MaxRead (src) >= MaxRead(dest) /\ MaxRead (dest) <= n; @*/
1684 ;
1685
ed309918 1686 /* drl added 09-25-001
1687 Alexander Ma pointed out these were missing
1688 */
1689
ccf415d0 1690int usleep (useconds_t useconds) /*@modifies systemState, errno@*/
1691 /*error -1 sucess 0 */
1692 /* warn opengroup unix specification recommends using setitimer(), timer_create(), timer_delete(), timer_getoverrun(), timer_gettime() or
1693 timer_settime() instead of this interface.
1694 */
1695 ;
1696
e5f31c00 1697
1698 /* drl added 10-27-001 */
1699 /*@i23*/
1700
1701 /*not sure what the exact size of this is
1702 also can IPv6 use this function?
1703 */
1704
1705 char *inet_ntoa(struct in_addr in)
1706 /*@ensures maxSet(result) <= 15 /\ maxRead(result) <= 15 @*/
1707 ;
1708
1709
ed309918 1710 extern double hypot(double x, double y) /*@modifies errno@*/ /*error errno only*/;
1711
1712
1713 extern double j0(double x) /*@modifies errno @*/ /*error 0 or NaN */;
1714 extern double j1(double x) /*@modifies errno @*/ /*error 0 or NaN */;
1715 extern double jn(int n, double x) /*@modifies errno @*/ /*error 0 or NaN */;
1716
1717 extern double y0(double x) /*@modifies errno @*/ /*error NaN -HUGE_VAL 0.0 */ ;
1718 extern double y1 (double x) /*@modifies errno @*/ /*error NaN -HUGE_VAL 0.0 */;
1719 extern double yn (int n, double x) /*@modifies errno @*/ /*error NaN -HUGE_VAL 0.0 */;
1720
1721 extern double acosh(double x) /*@modifies errno @*/ /*error errno and implementation-dependent(NaN if present) */ /*error NaN and may errno*/;
1722 extern double asinh(double x) /*@modifies errno @*/ /*error NaN and may errno */;
1723
1724 extern double atanh(double x) /*@modifies errno @*/ /*error errno and implementation-dependent(NaN if present) */ /*error NaN and may errno */ ;
1725
1726 extern double lgamma(double x) /*@modifies errno @*/ /*error NaN or HUGE_VAL may set errno */;
1727
1728 extern int signgam ;
1729
1730 extern double erf(double x) /*@modifies errno @*/ /*error NaN or 0 may set errno */;
1731
1732 extern double erfc (double x) /*@modifies errno @*/ /*error NaN or 0
1733 may set errno */;
1734
1735
1736
1737
1738
1739
This page took 0.312737 seconds and 5 git commands to generate.