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