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