]> 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
244int ttyname_r (int fg, /*@out@*/ char *buffer, int len) /*@modifies buffer@*/ ;
245int ioctl (int d, int /*@alt long@*/ request, /*@out@*/ void *arg)
246 /*@modifies *arg, errno@*/ ; /* depends on request! */
247
885824d3 248pid_t vfork (void) /*@modifies fileSystem@*/ ;
249
250
15b3d2b2 251struct iovec {
252 void *iov_base;
253 size_t iov_len;
885824d3 254};
255
256/*@constant int UIO_MAXIOV@*/ /* BSD */
257/*@constant int IOV_MAX@*/ /* supposedly SVR4 */
258
259 extern ssize_t
260readv (int fd, const struct iovec iov[], int iovcnt)
261 /*@modifies iov[].iov_base, fileSystem, errno@*/;
262
263 extern ssize_t
264writev (int fd, const struct iovec iov[], int iovcnt)
265 /*@modifies errno@*/;
266
267/*________________________________________________________________________
268 * poll.h
269 */
270
271 struct poll {
272 int fd;
273 short events;
274 short revents;
275};
276
277/*@constant short POLLIN@*/
278/*@constant short POLLRDNORM@*/
279/*@constant short POLLRDBAND@*/
280/*@constant short POLLPRI@*/
281/*@constant short POLLOUT@*/
282/*@constant short POLLWRNORM@*/
283/*@constant short POLLWRBAND@*/
284/*@constant short POLLERR@*/
285/*@constant short POLLHUP@*/
286/*@constant short POLLNVAL@*/
287
288extern int poll (struct poll pollfd[], unsigned long nfds, int timeout)
289 /*@modifies pollfd[].revents, errno@*/ ;
290
291/*
292** free does not take null
293*/
294
295/*@-incondefs@*/
296extern void free (/*@notnull@*/ /*@out@*/ /*@only@*/ void *p) /*@modifies *p@*/ ;
297/*@=incondefs@*/
298
299/*________________________________________________________________________
300 * sys/socket.h
301 */
302
303/*@constant int SOCK_STREAM@*/
304/*@constant int SOCK_DGRAM@*/
305/*@constant int SOCK_RAW@*/
306/*@constant int SOCK_RDM@*/
307/*@constant int SOCK_SEQPACKET@*/
308/*@constant int SO_DEBUG@*/
309/*@constant int SO_ACCEPTCONN@*/
310/*@constant int SO_REUSEADDR@*/
311/*@constant int SO_KEEPALIVE@*/
312/*@constant int SO_DONTROUTE@*/
313/*@constant int SO_BROADCAST@*/
314/*@constant int SO_USELOOPBACK@*/
315/*@constant int SO_LINGER@*/
316/*@constant int SO_OOBINLINE@*/
317/*@constant int SO_REUSEPORT@*/
318/*@constant int SO_SNDBUF@*/
319/*@constant int SO_RCVBUF@*/
320/*@constant int SO_SNDLOWAT@*/
321/*@constant int SO_RCVLOWAT@*/
322/*@constant int SO_SNDTIMEO@*/
323/*@constant int SO_RCVTIMEO@*/
324/*@constant int SO_ERROR@*/
325/*@constant int SO_TYPE@*/
326/*@constant int SOL_SOCKET@*/
327/*@constant int AF_UNSPEC@*/
328/*@constant int AF_LOCAL@*/
329/*@constant int AF_UNIX@*/
330/*@constant int AF_INET@*/
331/*@constant int AF_IMPLINK@*/
332/*@constant int AF_PUP@*/
333/*@constant int AF_CHAOS@*/
334/*@constant int AF_NS@*/
335/*@constant int AF_ISO@*/
336/*@constant int AF_OSI@*/
337/*@constant int AF_ECMA@*/
338/*@constant int AF_DATAKIT@*/
339/*@constant int AF_CCITT@*/
340/*@constant int AF_SNA@*/
341/*@constant int AF_DECnet@*/
342/*@constant int AF_DLI@*/
343/*@constant int AF_LAT@*/
344/*@constant int AF_HYLINK@*/
345/*@constant int AF_APPLETALK@*/
346/*@constant int AF_ROUTE@*/
347/*@constant int AF_LINK@*/
348/*@constant int pseudo_AF_XTP@*/
349/*@constant int AF_COIP@*/
350/*@constant int AF_CNT@*/
351/*@constant int pseudo_AF_RTIP@*/
352/*@constant int AF_IPX@*/
353/*@constant int AF_SIP@*/
354/*@constant int pseudo_AF_PIP@*/
355/*@constant int AF_ISDN@*/
356/*@constant int AF_E164@*/
357/*@constant int AF_MAX@*/
358/*@constant int MSG_OOB@*/
359/*@constant int MSG_PEEK@*/
360/*@constant int MSG_DONTROUTE@*/
361/*@constant int MSG_EOR@*/
362/*@constant int MSG_TRUNC@*/
363/*@constant int MSG_CTRUNC@*/
364/*@constant int MSG_WAITALL@*/
365/*@constant int MSG_DONTWAIT@*/
366/*@constant int MSG_EOF@*/
367/*@constant int MSG_COMPAT@*/
368/*@constant int PF_UNSPEC@*/
369/*@constant int PF_LOCAL@*/
370/*@constant int PF_UNIX@*/
371/*@constant int PF_INET@*/
372/*@constant int PF_IMPLINK@*/
373/*@constant int PF_PUP@*/
374/*@constant int PF_CHAOS@*/
375/*@constant int PF_NS@*/
376/*@constant int PF_ISO@*/
377/*@constant int PF_OSI@*/
378/*@constant int PF_ECMA@*/
379/*@constant int PF_DATAKIT@*/
380/*@constant int PF_CCITT@*/
381/*@constant int PF_SNA@*/
382/*@constant int PF_DECnet@*/
383/*@constant int PF_DLI@*/
384/*@constant int PF_LAT@*/
385/*@constant int PF_HYLINK@*/
386/*@constant int PF_APPLETALK@*/
387/*@constant int PF_ROUTE@*/
388/*@constant int PF_LINK@*/
389/*@constant int PF_XTP@*/
390/*@constant int PF_COIP@*/
391/*@constant int PF_CNT@*/
392/*@constant int PF_SIP@*/
393/*@constant int PF_IPX@*/
394/*@constant int PF_RTIP@*/
395/*@constant int PF_PIP@*/
396/*@constant int PF_ISDN@*/
397/*@constant int PF_MAX@*/
398/*@constant int NET_MAXID@*/
399/*@constant int NET_RT_DUMP@*/
400/*@constant int NET_RT_FLAGS@*/
401/*@constant int NET_RT_IFLIST@*/
402/*@constant int NET_RT_MAXID@*/
403/*@constant int SOMAXCONN@*/
404/*@constant int SCM_RIGHTS@*/
405
406 struct sockaddr {
407 u_char sa_len; /* total length */
408 u_char sa_family; /* address family */
409 char sa_data[14]; /* actually longer; address value */
410};
411
412 struct linger {
413 int l_onoff; /* option on/off */
414 int l_linger; /* linger time */
415};
416
417 struct sockproto {
418 u_short sp_family; /* address family */
419 u_short sp_protocol; /* protocol */
420};
421 struct msghdr {
422 caddr_t msg_name; /* optional address */
423 u_int msg_namelen; /* size of address */
424 struct iovec *msg_iov; /* scatter/gather array */
425 u_int msg_iovlen; /* # elements in msg_iov */
426 caddr_t msg_control; /* ancillary data, see below */
427 u_int msg_controllen; /* ancillary data buffer len */
428 int msg_flags; /* flags on received message */
429};
430
431 struct cmsghdr {
432 u_int cmsg_len; /* data byte count, including hdr */
433 int cmsg_level; /* originating protocol */
434 int cmsg_type; /* protocol-specific type */
435/* followed by u_char cmsg_data[]; */
436};
437
438 extern int
439accept (int s, struct sockaddr *addr, int *addrlen)
440 /*@modifies *addrlen, errno@*/;
441
442 extern int
443bind (int s, struct sockaddr *name, int namelen)
444 /*@modifies errno, fileSystem@*/;
445
446 extern int
447connect (int s, struct sockaddr *name, int namelen)
448 /*@modifies errno, internalState@*/;
449
7272a1c1 450int getpeername (int s, /*@out@*/ struct sockaddr *name, size_t *namelen)
885824d3 451 /*@modifies *name, *namelen, errno@*/;
452
7272a1c1 453int getsockname (int s, struct sockaddr *address, size_t *address_len)
454 /*?requires maxSet(address) > *address_len@*/
455 /*@modifies *address, *address_len, errno@*/;
885824d3 456
7272a1c1 457int getsockopt (int s, int level, int optname, /*@out@*/ void *optval, size_t *optlen)
885824d3 458 /*@modifies *optval, *optlen, errno@*/;
459
460 extern int
461listen (int s, int backlog)
462 /*@modifies errno, internalState@*/;
463
464 extern ssize_t
465recv (int s, /*@out@*/ void *buf, size_t len, int flags)
466 /*@modifies *buf, errno@*/;
467
468 extern ssize_t
469recvfrom (int s, void *buf, size_t len, int flags, /*@null@*/ struct sockaddr *from, int *fromlen)
470 /*@modifies *buf, *from, *fromlen, errno@*/;
471
472 extern ssize_t
473recvmsg (int s, struct msghdr *msg, int flags)
474 /*@modifies msg->msg_iov->iov_base[], errno@*/;
475
476 extern ssize_t
477send (int s, const void *msg, size_t len, int flags)
478 /*@modifies errno@*/;
479
480 extern ssize_t
481sendto (int s, const void *msg, size_t len, int flags, const struct sockaddr *to, int tolen)
482 /*@modifies errno@*/;
483
484 extern ssize_t
485sendmsg (int s, const struct msghdr *msg, int flags)
486 /*@modifies errno@*/;
487
488 extern int
489setsockopt (int s, int level, int optname, const void *optval, int optlen)
490 /*@modifies internalState, errno@*/;
491
492 extern int
493shutdown (int s, int how)
494 /*@modifies errno@*/;
495
496 extern int
497socket (int domain, int type, int protocol)
498 /*@modifies errno@*/;
499
500 extern int
501socketpair (int d, int type, int protocol, /*@out@*/ int *sv)
502 /*@modifies errno@*/;
503
504/*@constant int BADSIG@*/
505/*@constant int SA_ONSTACK@*/
506/*@constant int SA_RESTART@*/
507/*@constant int SA_DISABLE@*/
508/*@constant int SIGBUS@*/
509/*@constant int SIGEMT@*/
510/*@constant int SIGINFO@*/
511/*@constant int SIGIO@*/
512/*@constant int SIGIOT@*/
513/*@constant int SIGPOLL@*/
514/*@constant int SIGPROF@*/
515/*@constant int SIGPWR@*/
516/*@constant int SIGSYS@*/
517/*@constant int SIGTRAP@*/
518/*@constant int SIGURG@*/
519/*@constant int SIGVTALRM@*/
520/*@constant int SIGWINCH@*/
521/*@constant int SIGXCPU@*/
522/*@constant int SIGXFSZ@*/
523
524extern void psignal (int sig, const char *msg)
525 /*@modifies fileSystem@*/;
526
527/*@unchecked@*/ extern char *optarg;
528/*@unchecked@*/ extern int optind;
529/*@unchecked@*/ extern int optopt;
530/*@unchecked@*/ extern int opterr;
531/*@unchecked@*/ extern int optreset;
532
533 extern int
534getopt (int argc, char * const *argv, const char *optstring)
535 /*@globals optarg, optind, optopt, opterr, optreset@*/
536 /*@modifies optarg, optind, optopt@*/;
537
538 extern int
539setenv (const char *name, const char *value, int overwrite)
540 /*@globals environ@*/
541 /*@modifies *environ, errno@*/;
542
543 extern int
544putenv (const char *string)
545 /*@globals environ@*/
546 /*@modifies *environ, errno@*/;
547
548 extern void
549unsetenv (const char *name)
550 /*@globals environ@*/
551 /*@modifies *environ@*/;
552
553/*________________________________________________________________________
554 * sys/wait.h
555 */
556
557 extern int
558WCOREDUMP (int x)
559 /*@*/;
560
561 extern int
562W_EXITCODE (int ret, int sig)
563 /*@*/;
564
565 extern int
566W_STOPCODE (int sig)
567 /*@*/;
568
569/*@constant int WAIT_ANY@*/
570/*@constant int WAIT_MYPGRP@*/
571/*@constant int WSTOPPED@*/
572
573 extern pid_t
574wait3 (int *statloc, int options, /*@null@*/ /*@out@*/ struct rusage *rusage)
575 /*@modifies *statloc, *rusage, errno@*/;
576
577 extern pid_t
578wait4 (pid_t p, int *statloc, int opt, /*@null@*/ /*@out@*/ struct rusage *r)
579 /*@modifies *statloc, *r, errno@*/;
580
581struct timeval {
582 long tv_sec;
583 long tv_usec;
584} ;
585
586struct timespec {
587 long ts_sec;
588 long ts_nsec;
589} ;
590
591struct timezone {
592 int tz_minuteswest;
593 int tz_dsttime;
594} ;
595
596/*@constant int DST_NONE@*/
597/*@constant int DST_USA@*/
598/*@constant int DST_AUST@*/
599/*@constant int DST_WET@*/
600/*@constant int DST_MET@*/
601/*@constant int DST_EET@*/
602/*@constant int DST_CAN@*/
603
604/*@constant int ITIMER_PROF@*/
605/*@constant int ITIMER_REAL@*/
606/*@constant int ITIMER_VIRTUAL@*/
607
608 struct itimerval {
609 struct timeval it_interval;
610 struct timeval it_value;
611};
612
613 struct clockinfo {
614 int hz;
615 int tick;
616 int stathz;
617 int profhz;
618};
619
620 extern int
621adjtime (const struct timeval *delta, /*@null@*/ /*@out@*/ struct timeval *olddelta)
622 /*@modifies internalState, *olddelta, errno@*/;
623
624 extern int
625getitimer (int which, /*@out@*/ struct itimerval *value)
626 /*@modifies errno, *value*/;
627
628 extern int
629gettimeofday (/*@null@*/ /*@out@*/ struct timeval *tp, /*@null@*/ /*@out@*/ struct timezone *tzp)
630 /*@modifies *tp, *tzp, errno@*/;
631
632 extern int
633setitimer (int which, struct itimerval *val, /*@null@*/ /*@out@*/ struct itimerval *oval)
634 /*@modifies *oval, errno, internalState*/;
635
636 extern int
637settimeofday (const struct timeval *t, const struct timezone *z)
638 /*@modifies internalState, errno@*/;
639
640 extern int
641utimes (const char *file, /*@null@*/ const struct timeval *times)
642 /*@modifies fileSystem, errno*/;
643
644/*________________________________________________________________________
645 * sys/mman.h
646 */
647
648/*@constant int PROT_READ@*/
649/*@constant int PROT_WRITE@*/
650/*@constant int PROT_EXEC@*/
651/*@constant int MAP_SHARED@*/
652/*@constant int MAP_PRIVATE@*/
653/*@constant int MAP_COPY@*/
654/*@constant int MAP_FIXED@*/
655/*@constant int MAP_RENAME@*/
656/*@constant int MAP_NORESERVE@*/
657/*@constant int MAP_INHERIT@*/
658/*@constant int MAP_NOEXTEND@*/
659/*@constant int MAP_HASSEMAPHORE@*/
660/*@constant int MS_ASYNC@*/
661/*@constant int MS_INVALIDATE@*/
662/*@constant int MAP_FILE@*/
663/*@constant int MAP_ANON@*/
664/*@constant int MADV_NORMAL@*/
665/*@constant int MADV_RANDOM@*/
666/*@constant int MADV_SEQUENTIAL@*/
667/*@constant int MADV_WILLNEED@*/
668/*@constant int MADV_DONTNEED@*/
669
670 extern caddr_t
671mmap (/*@null@*/ /*@returned@*/ caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
672 /*@modifies addr@*/;
673
674 extern int
675madvise (caddr_t addr, int len, int behav)
676 /*@*/;
677
678 extern int
679mprotect (caddr_t addr, int len, int prot)
680 /*@*/;
681
682 extern int
683munmap (caddr_t addr, size_t len)
684 /*@*/;
685
686 extern int
687msync (caddr_t addr, int len, int flags)
688 /*@*/;
689
690 extern int
691mlock (caddr_t addr, size_t len)
692 /*@*/;
693
694 extern int
695munlock (caddr_t addr, size_t len)
696 /*@*/;
697
698
699/*________________________________________________________________________
700 * sys/ioctl.h
701 */
702
703 struct winsize {
704 unsigned short ws_row;
705 unsigned short ws_col;
706 unsigned short ws_xpixel;
707 unsigned short ws_ypixel;
708};
709
710/*@constant int TIOCMODG@*/
711/*@constant int TIOCMODS@*/
712/*@constant int TIOCM_LE@*/
713/*@constant int TIOCM_DTR@*/
714/*@constant int TIOCM_RTS@*/
715/*@constant int TIOCM_ST@*/
716/*@constant int TIOCM_SR@*/
717/*@constant int TIOCM_CTS@*/
718/*@constant int TIOCM_CAR@*/
719/*@constant int TIOCM_CD@*/
720/*@constant int TIOCM_RNG@*/
721/*@constant int TIOCM_RI@*/
722/*@constant int TIOCM_DSR@*/
723/*@constant int TIOCEXCL@*/
724/*@constant int TIOCNXCL@*/
725/*@constant int TIOCFLUSH@*/
726/*@constant int TIOCGETA@*/
727/*@constant int TIOCSETA@*/
728/*@constant int TIOCSETAW@*/
729/*@constant int TIOCSETAF@*/
730/*@constant int TIOCGETD@*/
731/*@constant int TIOCSETD@*/
732/*@constant int TIOCSBRK@*/
733/*@constant int TIOCCBRK@*/
734/*@constant int TIOCSDTR@*/
735/*@constant int TIOCCDTR@*/
736/*@constant int TIOCGPGRP@*/
737/*@constant int TIOCSPGRP@*/
738/*@constant int TIOCOUTQ@*/
739/*@constant int TIOCSTI@*/
740/*@constant int TIOCNOTTY@*/
741/*@constant int TIOCPKT@*/
742/*@constant int TIOCPKT_DATA@*/
743/*@constant int TIOCPKT_FLUSHREAD@*/
744/*@constant int TIOCPKT_FLUSHWRITE@*/
745/*@constant int TIOCPKT_STOP@*/
746/*@constant int TIOCPKT_START@*/
747/*@constant int TIOCPKT_NOSTOP@*/
748/*@constant int TIOCPKT_DOSTOP@*/
749/*@constant int TIOCPKT_IOCTL@*/
750/*@constant int TIOCSTOP@*/
751/*@constant int TIOCSTART@*/
752/*@constant int TIOCMSET@*/
753/*@constant int TIOCMBIS@*/
754/*@constant int TIOCMBIC@*/
755/*@constant int TIOCMGET@*/
756/*@constant int TIOCREMOTE@*/
757/*@constant int TIOCGWINSZ@*/
758/*@constant int TIOCSWINSZ@*/
759/*@constant int TIOCUCNTL@*/
760/*@constant int TIOCSTAT@*/
761/*@constant int TIOCCONS@*/
762/*@constant int TIOCSCTTY@*/
763/*@constant int TIOCEXT@*/
764/*@constant int TIOCSIG@*/
765/*@constant int TIOCDRAIN@*/
766/*@constant int TIOCMSDTRWAIT@*/
767/*@constant int TIOCMGDTRWAIT@*/
768/*@constant int TIOCTIMESTAMP@*/
769/*@constant int TIOCSDRAINWAIT@*/
770/*@constant int TIOCGDRAINWAIT@*/
771/*@constant int TTYDISC@*/
772/*@constant int TABLDISC@*/
773/*@constant int SLIPDISC@*/
774/*@constant int PPPDISC@*/
775
776/*@constant int MAXHOSTNAMELEN@*/
777
778 extern void
779FD_CLR (int n, fd_set *p)
780 /*@modifies *p@*/;
781
782 extern void
783FD_COPY (fd_set *f, /*@out@*/ fd_set *t)
784 /*@modifies *t@*/;
785
786 extern int /*@alt lltX_bool@*/
787FD_ISSET (int n, fd_set *p)
788 /*@*/;
789
790 extern void
791FD_SET (int n, fd_set *p)
792 /*@modifies *p@*/;
793
794 extern void
795FD_ZERO (fd_set /*@out@*/ *p)
796 /*@modifies *p@*/;
797
798 extern int
799fchdir (int fd)
800 /*@modifies internalState, errno@*/;
801
802 extern int
803fchown (int fd, uid_t owner, gid_t group)
804 /*@modifies errno, fileSystem@*/;
805
806 extern int
807fsync (int fd)
808 /*@modifies errno, fileSystem@*/;
809
810 extern int
811ftruncate (int fd, off_t length)
812 /*@modifies errno, fileSystem@*/;
813
b072092f 814int gethostname (/*@out@*/ char *address, size_t address_len)
815 /*:errorstatus@*/
816 /*@modifies address@*/ ;
885824d3 817
b072092f 818int initgroups (const char *name, int basegid)
819 /*@modifies internalState@*/;
885824d3 820
821 extern int
822lchown (const char *path, uid_t owner, gid_t group)
823 /*@modifies errno, fileSystem@*/;
824
825 extern int
826readlink (const char *path, /*@out@*/ char *buf, int size)
7bf96067 827 /*@modifies *buf, errno@*/ /*@ensures result <= size @*/;
885824d3 828
829 extern int
830select (int mfd, fd_set /*@null@*/ *r, fd_set /*@null@*/ *w, fd_set /*@null@*/ *e, struct timeval *t)
831 /*@modifies *r, *w, *e, *t, errno@*/;
832
833 extern int
834setegid (gid_t egid)
835 /*@modifies errno, internalState@*/;
836
837 extern int
838seteuid (uid_t euid)
839 /*@modifies errno, internalState@*/;
840
841 extern int
842setgroups (int ngroups, const gid_t *gidset)
843 /*@modifies errno, internalState@*/;
844
845 extern int
846setregid (gid_t rgid, gid_t egid)
847 /*@modifies errno, internalState@*/;
848
849 extern int
850setreuid (gid_t ruid, gid_t euid)
851 /*@modifies errno, internalState@*/;
852
853 extern void
854sync (void)
855 /*@modifies fileSystem@*/;
856
857 extern int
858symlink (const char *path, const char *path2)
859 /*@modifies fileSystem@*/;
860
861 extern int
862truncate (const char *name, off_t length)
863 /*@modifies errno, fileSystem@*/;
864
865/*@constant int EBADRPC@*/
866/*@constant int ERPCMISMATCH@*/
867/*@constant int EPROGUNAVAIL@*/
868/*@constant int EPROGMISMATCH@*/
869/*@constant int EPROCUNAVAIL@*/
870/*@constant int EFTYPE@*/
871/*@constant int EAUTH@*/
872/*@constant int ENEEDAUTH@*/
873/*@constant int ELAST@*/
874
875/*________________________________________________________________________
876 * tar.h
877 */
878
879/*@unchecked@*/ extern char *TMAGIC;
880/*@constant int TMAGLEN@*/
881/*@unchecked@*/ extern char *TVERSION;
882/*@constant int TVERSLEN@*/
883
884/*@constant int REGTYPE@*/
885/*@constant int AREGTYPE@*/
886/*@constant int LNKTYPE@*/
887/*@constant int SYMTYPE@*/
888/*@constant int CHRTYPE@*/
889/*@constant int BLKTYPE@*/
890/*@constant int DIRTYPE@*/
891/*@constant int FIFOTYPE@*/
892/*@constant int CONTTYPE@*/
893
894/*@constant int TSUID@*/
895/*@constant int TSGID@*/
896/*@constant int TSVTX@*/
897
898/*@constant int TUREAD@*/
899/*@constant int TUWRITE@*/
900/*@constant int TUEXEC@*/
901/*@constant int TGREAD@*/
902/*@constant int TGWRITE@*/
903/*@constant int TGEXEC@*/
904/*@constant int TOREAD@*/
905/*@constant int TOWRITE@*/
906/*@constant int TOEXEC@*/
907
908struct ipc_perm {
909 uid_t uid; /* user id */
910 gid_t gid; /* group id */
911 uid_t cuid; /* creator user id */
912 gid_t cgid; /* creator group id */
913 mode_t mode; /* r/w permission */
914 ulong seq; /* slot usage sequence number */
915 key_t key; /* user specified msg/sem/shm key */
916} ;
917
918/*@constant int IPC_R@*/
919/*@constant int IPC_W@*/
920/*@constant int IPC_M@*/
921/*@constant int IPC_CREAT@*/
922/*@constant int IPC_EXCL@*/
923/*@constant int IPC_NOWAIT@*/
924/*@constant key_t IPC_PRIVATE@*/
925/*@constant int IPC_RMID@*/
926/*@constant int IPC_SET@*/
927/*@constant int IPC_STAT@*/
928
929/*________________________________________________________________________
930 * sys/msg.h
931 */
932
933 struct msqid_ds {
934 struct ipc_perm msg_perm; /* msg queue permission bits */
935 struct msg *msg_first; /* first message in the queue */
936 struct msg *msg_last; /* last message in the queue */
937 u_long msg_cbytes; /* number of bytes in use on the queue */
938 u_long msg_qnum; /* number of msgs in the queue */
939 u_long msg_qbytes; /* max # of bytes on the queue */
940 pid_t msg_lspid; /* pid of last msgsnd() */
941 pid_t msg_lrpid; /* pid of last msgrcv() */
942 time_t msg_stime; /* time of last msgsnd() */
943 time_t msg_rtime; /* time of last msgrcv() */
944 time_t msg_ctime; /* time of last msgctl() */
945};
946
947 struct mymesg {
948 long mtype; /* message type (+ve integer) */
949 char mtext[]; /* message body */
950};
951
952/*@constant int MSG_NOERROR@*/
953/*@constant int MSGMAX@*/
954/*@constant int MSGMNB@*/
955/*@constant int MSGMNI@*/
956/*@constant int MSGTQL@*/
957
958 extern int
959msgctl (int id , int cmd, /*@out@*/ struct msqid_ds *buf)
960 /*@modifies errno, *buf@*/;
961
962 extern int
963msgget (key_t key, int flag)
964 /*@modifies errno@*/;
965
966 extern int
967msgrcv (int id, /*@out@*/ void *ptr, size_t nbytes, long type, int flags)
968 /*@modifies errno, *ptr@*/;
969
970 extern int
971msgsnd (int id, const void *ptr, size_t nbytes, int flag)
972 /*@modifies errno@*/;
973
974/*________________________________________________________________________
975 * sys/sem.h
976 */
977
978 struct semid_ds {
979 struct ipc_perm sem_perm;
980 struct sem *sem_base;
981 ushort sem_nsems;
982 time_t sem_otime;
983 time_t sem_ctime;
984};
985
986 struct sem {
987 ushort semval;
988 pid_t sempid;
989 ushort semncnt;
990 ushort semzcnt;
991};
992
993 union semun {
994 int val;
995 struct semid_ds *buf;
996 ushort *array;
997};
998
999 struct sembuf {
1000 ushort sem_num;
1001 short sem_op;
1002 short sem_flg;
1003};
1004
1005/*@constant int SEM_A@*/
1006/*@constant int SEMAEM@*/
1007/*@constant int SEMMNI@*/
1008/*@constant int SEMMNS@*/
1009/*@constant int SEMMNU@*/
1010/*@constant int SEMMSL@*/
1011/*@constant int SEMOPN@*/
1012/*@constant int SEM_R@*/
1013/*@constant int SEMUME@*/
1014/*@constant int SEM_UNDO@*/
1015/*@constant int SEMVMX@*/
1016/*@constant int GETVAL@*/
1017/*@constant int SETVAL@*/
1018/*@constant int GETPID@*/
1019/*@constant int GETNCNT@*/
1020/*@constant int GETZCNT@*/
1021/*@constant int GETALL@*/
1022/*@constant int SETALL@*/
1023
1024/*@constant int ERMID@*/
1025
1026 extern int
1027semctl (int id, int semnum, int cmd, union semun arg)
1028 /*@modifies errno@*/;
1029
1030 extern int
1031semget (key_t key, int nsems, int flag)
1032 /*@modifies errno@*/;
1033
1034 extern int
1035semop (int id, struct sembuf *semoparray, size_t nops)
1036 /*@modifies errno@*/;
1037
1038/*________________________________________________________________________
1039 * sys/shm.h
1040 */
1041
1042 struct shmid_ds {
1043 struct ipc_perm shm_perm;
1044 int shm_segsz;
1045 ushort shm_lkcnt;
1046 pid_t shm_lpid;
1047 pid_t shm_cpid;
1048 ulong shm_nattch;
1049 ulong shm_cnattch;
1050 time_t shm_atime;
1051 time_t shm_dtime;
1052 time_t shm_ctime;
1053};
1054
1055/*@constant int SHMLBA@*/
1056/*@constant int SHM_LOCK@*/
1057/*@constant int SHMMAX@*/
1058/*@constant int SHMMIN@*/
1059/*@constant int SHMMNI@*/
1060/*@constant int SHM_R@*/
1061/*@constant int SHM_RDONLY@*/
1062/*@constant int SHM_RND@*/
1063/*@constant int SHMSEG@*/
1064/*@constant int SHM_W@*/
1065/*@constant int SHM_UNLOCK@*/
1066
1067 void *
1068shmat (int id, /*@null@*/ void *addr, int flag)
1069 /*@modifies errno@*/;
1070
1071 extern int
1072shmctl (int id, int cmd, /*@out@*/ struct shmid_ds *buf)
1073 /*@modifies errno, *buf@*/;
1074
1075 extern int
1076shmdt (void *addr)
1077 /*@modifies errno@*/;
1078
1079 extern int
1080shmget (key_t key, int size, int flag)
1081 /*@modifies errno@*/;
1082
885824d3 1083/*________________________________________________________________________
1084 * syslog.h
1085 */
1086
1087/*@constant int LOG_EMERG@*/
1088/*@constant int LOG_ALERT@*/
1089/*@constant int LOG_CRIT@*/
1090/*@constant int LOG_ERR@*/
1091/*@constant int LOG_WARNING@*/
1092/*@constant int LOG_NOTICE@*/
1093/*@constant int LOG_INFO@*/
1094/*@constant int LOG_DEBUG@*/
1095
1096/*@constant int LOG_KERN@*/
1097/*@constant int LOG_USER@*/
1098/*@constant int LOG_MAIL@*/
1099/*@constant int LOG_DAEMON@*/
1100/*@constant int LOG_AUTH@*/
1101/*@constant int LOG_SYSLOG@*/
1102/*@constant int LOG_LPR@*/
1103/*@constant int LOG_NEWS@*/
1104/*@constant int LOG_UUCP@*/
1105/*@constant int LOG_CRON@*/
1106/*@constant int LOG_AUTHPRIV@*/
1107/*@constant int LOG_FTP@*/
1108/*@constant int LOG_LOCAL0@*/
1109/*@constant int LOG_LOCAL1@*/
1110/*@constant int LOG_LOCAL2@*/
1111/*@constant int LOG_LOCAL3@*/
1112/*@constant int LOG_LOCAL4@*/
1113/*@constant int LOG_LOCAL5@*/
1114/*@constant int LOG_LOCAL6@*/
1115/*@constant int LOG_LOCAL7@*/
1116
1117/*@constant int LOG_PID@*/
1118/*@constant int LOG_CONS@*/
1119/*@constant int LOG_ODELAY@*/
1120/*@constant int LOG_NDELAY@*/
1121/*@constant int LOG_NOWAIT@*/
1122/*@constant int LOG_PERROR@*/
1123
1124 extern int
1125LOG_MASK (int pri)
1126 /*@*/;
1127
1128 extern int
1129LOG_UPTO (int pri)
1130 /*@*/;
1131
1132 extern void
1133closelog (void)
1134 /*@modifies fileSystem@*/;
1135
1136 extern void
1137openlog (const char *ident, int logopt, int facility)
1138 /*@modifies fileSystem@*/;
1139
1140 extern int
1141setlogmask (int maskpri)
1142 /*@modifies internalState@*/;
1143
1144 extern void /*@printflike@*/
1145syslog (int priority, const char *message, ...)
1146 /*@modifies fileSystem@*/;
1147
1148 extern void
1149vsyslog (int priority, const char *message, va_list args)
1150 /*@modifies fileSystem@*/;
1151
1152/*________________________________________________________________________
1153 * pwd.h
1154 */
1155
1156 extern extern void
1157endpwent (void)
1158 /*@modifies internalState@*/;
1159
1160 extern /*@null@*/ struct passwd *
1161getpwent (void)
1162 /*@modifies internalState@*/;
1163
1164 extern int
1165setpassent (int stayopen)
1166 /*@modifies internalState@*/;
1167
1168 extern int
1169setpwent (void)
1170 /*@modifies internalState@*/;
1171
1172/*________________________________________________________________________
1173 * grp.h
1174 */
1175
1176 extern void
1177endgrent (void)
1178 /*@modifies internalState@*/;
1179
1180 extern /*@null@*/ struct group *
1181getgrent (void)
1182 /*@modifies internalState@*/;
1183
1184 extern int
1185setgrent (void)
1186 /*@modifies internalState@*/;
1187
1188 extern void
1189setgrfile (const char *name)
1190 /*@modifies internalState@*/;
1191
1192 extern int
1193setgroupent (int stayopen)
1194 /*@modifies internalState@*/;
1195
1196/*________________________________________________________________________
1197 * sys/stat.h
1198 */
1199
1200/*@constant int S_ISTXT@*/
1201/*@constant int S_IREAD@*/
1202/*@constant int S_IWRITE@*/
1203/*@constant int S_IEXEC@*/
1204/*@constant int S_IFMT@*/
1205/*@constant int S_IFIFO@*/
1206/*@constant int S_IFCHR@*/
1207/*@constant int S_IFDIR@*/
1208/*@constant int S_IFBLK@*/
1209/*@constant int S_IFREG@*/
1210/*@constant int S_IFLNK@*/
1211/*@constant int S_IFSOCK@*/
1212/*@constant int S_ISVTX@*/
1213/*@constant int S_ISVTX@*/
1214/*@constant int SF_SETTABLE@*/
1215/*@constant int SF_ARCHIVED@*/
1216/*@constant int ACCESSPERMS@*/
1217/*@constant int ALLPERMS@*/
1218/*@constant int DEFFILEMODE@*/
1219/*@constant int S_BLKSIZE@*/
1220/*@constant int SF_IMMUTABLE@*/
1221/*@constant int SF_APPEND@*/
1222/*@constant int UF_NODUMP@*/
1223/*@constant int UF_IMMUTABLE@*/
1224/*@constant int UF_APPEND@*/
1225
1226 extern int /*@alt lltX_bool@*/
1227S_ISLNK (/*@sef@*/ mode_t m)
1228 /*@*/;
1229
1230 extern int /*@alt lltX_bool@*/
1231S_ISSOCK (/*@sef@*/ mode_t m)
1232 /*@*/;
1233
1234 extern int
1235chflags (const char *path, u_long flags)
1236 /*@modifies fileSystem, errno@*/;
1237
1238 extern int
1239fchflags (int fd, u_long flags)
1240 /*@modifies fileSystem, errno@*/;
1241
1242 extern int
1243fchmod (int fd, mode_t mode)
1244 /*@modifies fileSystem, errno@*/;
1245
1246 extern int
1247lstat (const char *path, /*@out@*/ struct stat *buf)
1248 /*@modifies errno, *buf@*/;
1249
1250/*________________________________________________________________________
1251 * stropts.h
1252 */
1253
1254/*@constant int FMNAMESZ@*/
1255/*@constant int MSG_BAND@*/
1256/*@constant int MSG_HIPRI@*/
1257/*@constant int RS_HIPRI@*/
1258/*@constant int S_INPUT@*/
1259/*@constant int S_RDNORM@*/
1260/*@constant int S_RDBAND@*/
1261/*@constant int S_BANDURG@*/
1262/*@constant int S_HIPRI@*/
1263/*@constant int S_OUTPUT@*/
1264/*@constant int S_WRNORM@*/
1265/*@constant int S_WRBAND@*/
1266/*@constant int S_MSG@*/
1267/*@constant int S_ERROR@*/
1268/*@constant int S_HANGUP@*/
1269
1270 struct strbuf {
1271 int maxlen;
1272 int len;
1273 char *buf;
1274}
1275
1276 struct str_mlist {
1277 char l_name[];
1278}
1279
1280 struct str_list {
1281 int sl_nmods;
1282 struct str_mlist *sl_modlist;
1283}
1284
1285 extern int
1286getmsg (int fd, /*@out@*/ struct strbuf *c, /*@out@*/ struct strbuf *d, int *f)
1287 /*@modifies *c, *d, errno@*/;
1288
1289 extern int
1290getpmsg (int fd, /*@out@*/ struct strbuf *c, /*@out@*/ struct strbuf *d, int *b, int *f)
1291 /*@modifies *b, *c, *d, errno@*/;
1292
1293 extern int
1294putmsg (int fd, const struct strbuf *c, const struct strbuf *d, int *f)
1295 /*@modifies internalState, errno@*/;
1296
1297 extern int
1298putpmsg (int fd, const struct strbuf *c, const struct strbuf *d, int b, int *f)
1299 /*@modifies internalState, errno@*/;
1300
1301/*________________________________________________________________________
1302 * sys/resource.h
1303 */
1304
1305/*@constant int RLIMIT_CPU@*/
1306/*@constant int RLIMIT_FSIZE@*/
1307/*@constant int RLIMIT_DATA@*/
1308/*@constant int RLIMIT_STACK@*/
1309/*@constant int RLIMIT_CORE@*/
1310/*@constant int RLIMIT_RSS@*/
1311/*@constant int RLIMIT_MEMLOCK@*/
1312/*@constant int RLIMIT_NPROC@*/
1313/*@constant int RLIMIT_NOFILE@*/
1314/*@constant int RLIM_NLIMITS@*/
1315/*@constant int RLIM_INFINITY@*/
1316/*@constant int PRIO_MIN@*/
1317/*@constant int PRIO_MAX@*/
1318/*@constant int PRIO_PROCESS@*/
1319/*@constant int PRIO_PGRP@*/
1320/*@constant int PRIO_USER@*/
1321/*@constant int RUSAGE_SELF@*/
1322/*@constant int RUSAGE_CHILDREN@*/
1323
1324 struct rusage {
1325 struct timeval ru_utime; /* user time used */
1326 struct timeval ru_stime; /* system time used */
1327 long ru_maxrss; /* max resident set size */
1328 long ru_ixrss; /* integral shared memory size */
1329 long ru_idrss; /* integral unshared data " */
1330 long ru_isrss; /* integral unshared stack " */
1331 long ru_minflt; /* page reclaims */
1332 long ru_majflt; /* page faults */
1333 long ru_nswap; /* swaps */
1334 long ru_inblock; /* block input operations */
1335 long ru_oublock; /* block output operations */
1336 long ru_msgsnd; /* messages sent */
1337 long ru_msgrcv; /* messages received */
1338 long ru_nsignals; /* signals received */
1339 long ru_nvcsw; /* voluntary context switches */
1340 long ru_nivcsw; /* involuntary " */
1341};
1342
1343 struct rlimit {
1344 long rlim_cur;
1345 long rlim_max;
1346};
1347
1348 struct loadavg {
1349 unsigned long ldavg[3];
1350 long fscale;
1351};
1352
1353 extern int
1354getpriority (int which, int who)
1355 /*@modifies errno@*/;
1356
1357 extern int
1358getrlimit (int res, /*@out@*/ struct rlimit *rlp)
1359 /*@modifies *rlp, errno@*/;
1360
1361 extern int
1362getrusage (int who, /*@out@*/ struct rusage *rusage)
1363 /*@modifies *rusage, errno@*/;
1364
1365 extern int
1366setpriority (int which, int who, int prio)
1367 /*@modifies errno, internalState@*/;
1368
1369 extern int
1370setrlimit (int resource, const struct rlimit *rlp)
1371 /*@modifies errno, internalState@*/;
1372
7272a1c1 1373
1374/*
1375** in <netdb.h>
1376*/
1377
1378struct servent
1379{
1380 /*@observer@*/ char *s_name; /* Official service name. */
1381 /*@observer@*/ char **s_aliases; /* Alias list. */
1382 int s_port; /* Port number. */
1383 /*@observer@*/ char *s_proto; /* Protocol to use. */
1384} ;
1385
1386/*@observer@*/ /*@dependent@*/ /*@null@*/ struct servent *getservbyname (const char *name, /*@null@*/ const char *proto)
1387 /*@warn multithreaded "Unsafe in multithreaded applications, use getsrvbyname_r instead"@*/ ;
1388
1389struct servent *getservbyname_r (const char *name, /*@null@*/ const char *proto, /*@out@*/ /*@returned@*/ struct servent *result, /*@out@*/ char *buffer, int buflen)
1390 /*@requires maxSet (buffer) >= buflen@*/ ;
1391
1392
1393/*@observer@*/ /*@dependent@*/ struct servent *getservbyport (int port, /*@null@*/ const char *proto)
1394 /*@warn multithreaded "Unsafe in multithreaded applications, use getservbyport_r instead"@*/ ;
1395
1396struct servent *getservbyport_r (int port, /*@null@*/ const char *proto, /*@out@*/ /*@returned@*/ struct servent *result, /*@out@*/ char *buffer, int buflen)
1397 /*@requires maxSet (buffer) >= buflen@*/ ;
1398
1399/*@null@*/ struct servent *getservent (void);
1400
1401/*@null@*/ struct servent *getservent_r (struct servent *result, char *buffer, int buflen);
1402
1403int setservent (int stayopen);
1404
1405int endservent (void);
1406
1407
1408extern int h_errno;
1409
1410/*@null@*/ /*@observer@*/ struct hostent *gethostbyname (/*@nullterminated@*/ /*@notnull@*/ const char *name)
1411 /*@warn multithreaded "Unsafe in multithreaded applications, use gethostbyname_r instead"@*/
1412 /*@modifies h_errno@*/ ;
1413
1414struct hostent *gethostbyname_r (/*@nullterminated@*/ const char *name, /*@notnull@*/ /*@returned@*/ struct hostent *hent, /*@out@*/ /*@exposed@*/ char *buffer, int bufsize, /*@out@*/ int *h_errnop)
1415 /*@requires maxSet(buffer) >= bufsize@*/ ;
1416
1417/*@null@*/ /*@observer@*/ struct hostent *gethostbyaddr (/*@notnull@*/ const void *addr, size_t addrlen, int type)
1418 /*@requires maxRead(addr) == addrlen@*/ /*@i534 ??? is this right? */
1419 /*@warn multithreaded "Unsafe in multithreaded applications, use gethostbyaddr_r instead"@*/
1420 /*@modifies h_errno@*/ ;
1421
1422struct hostent *gethostbyaddr_r (/*@notnull@*/ const void *addr, size_t addrlen, int type,
1423 /*@returned@*/ /*@out@*/ struct hostent *hent,
1424 /*@exposed@*/ /*@out@*/ char *buffer, int bufsize, /*@out@*/ int *h_errnop)
1425 /*@requires maxRead(addr) == addrlen
1426 /\ maxSet(buffer) >= bufsize@*/ /*@i534 ??? is this right? */ ;
1427
1428/*@observer@*/ /*@null@*/ struct hostent *gethostent (void)
1429 /*@warn multithreaded "Unsafe in multithreaded applications, use gethostent_r instead"@*/ ;
1430
1431struct hostent *gethostent_r (/*@out@*/ /*@returned@*/ struct hostent *hent, /*@exposed@*/ /*@out@*/ char *buffer, int bufsize)
1432 /*@requires maxSet(buffer) >= bufsize@*/ ;
1433
1434 /*@i534 need to annotate these: */
1435struct hostent *fgethostent(FILE *f);
1436
1437struct hostent *fgethostent_r(FILE*f, struct hostent *hent, char buffer, int bufsize);
1438
1439void sethostent(int stayopen);
1440
1441void endhostent(void);
1442
1443void herror(const char *string);
1444
1445char *hstrerror(int err);
1446
1447struct hostent {
1448 /*@observer@*/ /*@nullterminated@*/ char *h_name; /* official name of host */
1449 /*@observer@*/ /*@nullterminated@*/ char * /*:observer@*/ /*:nullterminated@*/ *h_aliases; /* alias list */
1450 int h_addrtype; /* host address type*/
1451 int h_length; /* length ofaddress*/
1452 /*@observer@*/ /*@nullterminated@*/ char * /*:observer@*/ /*:nullterminated@*/ *h_addr_list; /* list of addressesfrom name server */
1453 /*@observer@*/ /*@nullterminated@*/ char *h_addr; /* first address in list (backward compatibility) */
1454} ;
1455
1456/*
1457** arpa/inet.h
1458*/
1459
1460typedef uint32_t in_addr_t;
1461
1462struct in_addr
1463{
1464 in_addr_t s_addr;
1465};
1466
1467typedef uint16_t in_port_t;
1468
1469in_addr_t htonl (in_addr_t hostlong) /*@*/ ;
1470in_port_t htons (in_port_t hostshort) /*@*/ ;
1471in_addr_t ntohl (in_addr_t netlong) /*@*/ ;
1472in_port_t ntohs (in_port_t netshort) /*@*/ ;
1473
1474/*
1475** unistd.h
1476*/
1477
1478int chroot (/*@notnull@*/ /*@nullterminated@*/ const char *path)
1479 /*:statusreturn@*/
1480 /*@warn superuser "Only super-user processes may call chroot."@*/
1481 /*: other wanings? */ ;
1482
1483int fchroot (int fildes)
1484 /*:statusreturn@*/
1485 /*@warn superuser "Only super-user processes may call fchroot."@*/ ;
This page took 0.240242 seconds and 5 git commands to generate.