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