]> andersk Git - splint.git/blame - lib/unix.h
Fixed problem with NULL being changed.
[splint.git] / lib / unix.h
CommitLineData
885824d3 1/*
2** unix.h
3*/
4
5/*@-nextlinemacros@*/
6
345671f3 7/*
8** sys/types.h
9**
10** evans - 2001-08-27: from http://www.opengroup.org/onlinepubs/007908799/xsh/systypes.h.html
11*/
12
13typedef /*@integraltype@*/ blkcnt_t;
14typedef /*@integraltype@*/ blksize_t;
8fe44445 15
16/*@-redef@*/ /* These are also defined by ansi.h: */
345671f3 17typedef /*@integraltype@*/ clock_t;
345671f3 18typedef /*@integraltype@*/ dev_t;
345671f3 19typedef /*@integraltype@*/ gid_t;
345671f3 20typedef /*@unsignedintegraltype@*/ ino_t;
345671f3 21typedef /*@integraltype@*/ mode_t;
22typedef /*@integraltype@*/ nlink_t;
23typedef /*@integraltype@*/ off_t;
24typedef /*@integraltype@*/ pid_t;
8fe44445 25typedef /*@integraltype@*/ time_t;
26typedef /*@integraltype@*/ uid_t;
27
28/*@=redef@*/
29
30typedef /*@integraltype@*/ clockid_t;
31typedef /*@unsignedintegraltype@*/ fsblkcnt_t;
32typedef /*@unsignedintegraltype@*/ fsfilcnt_t;
33typedef /*@integraltype@*/ id_t;
34
35typedef /*@integraltype@*/ key_t;
345671f3 36typedef /*@integraltype@*/ pthread_attr_t;
37typedef /*@integraltype@*/ pthread_cond_t;
38typedef /*@integraltype@*/ pthread_condattr_t;
39typedef /*@integraltype@*/ pthread_key_t;
40typedef /*@integraltype@*/ pthread_mutex_t;
41typedef /*@integraltype@*/ pthread_mutexattr_t;
42typedef /*@integraltype@*/ pthread_once_t;
43typedef /*@integraltype@*/ pthread_rwlock_t;
44typedef /*@integraltype@*/ pthread_rwlockattr_t;
45typedef /*@integraltype@*/ pthread_t;
46typedef /*@signedintegraltype@*/ suseconds_t;
345671f3 47typedef /*@integraltype@*/ timer_t;
345671f3 48typedef /*@unsignedintegraltype@*/ useconds_t;
49
885824d3 50/*
51** Extra stuff in some unixen, not in posix.
52*/
53
8fe44445 54extern /*@unchecked@*/ int signgam;
885824d3 55
8fe44445 56/*@-redef@*/ /* Defined by ansi: */
885824d3 57typedef /*@integraltype@*/ clockid_t;
8fe44445 58/*@=redef@*/
885824d3 59
60extern void bcopy (char *b1, /*@out@*/ char *b2, int length)
61 /*@modifies *b2@*/ ; /* Yes, the second parameter is the out param! */
62
0bd4c301 63extern int /*@alt _Bool@*/ bcmp (char *b1, char *b2, int length) /*@*/ ;
885824d3 64 /* Return value is NOT like strcmp! */
65
66extern void bzero (/*@out@*/ char *b1, int length) /*@modifies *b1@*/ ;
67extern int ffs (int i) /*@*/ ;
68extern int symlink (char *name1, char *name2) /*@modifies fileSystem@*/ ;
69
70extern int
71 setvbuf_unlocked (FILE *stream, /*@null@*/ /*@exposed@*/ char *buf,
72 int mode, size_t size)
73 /*@modifies internalState@*/ ;
74
75extern void
76 setbuffer (FILE *stream, /*@null@*/ /*@exposed@*/ char *buf, int size)
77 /*@modifies internalState@*/ ;
78
79extern void setlinebuf (FILE *stream) /*@modifies internalState@*/ ;
80
81extern int strerror_r (int errnum, /*@out@*/ char *strerrbuf, int buflen)
82 /*@modifies strerrbuf@*/ ;
83
84extern size_t
85 fread_unlocked (/*@out@*/ void *ptr, size_t size, size_t nitems,
86 FILE *stream)
87 /*@modifies *stream, *ptr;@*/ ;
88
89extern size_t
90 fwrite_unlocked (void *pointer, size_t size, size_t num_items, FILE *stream)
91 /*@modifies *stream;@*/ ;
92
885824d3 93extern void /*@alt void * @*/
94 memccpy (/*@returned@*/ /*@out@*/ void *s1,
95 /*@unique@*/ void *s2, int c, size_t n)
96 /*@modifies *s1@*/ ;
97
98extern int strcasecmp (char *s1, char *s2) /*@*/ ;
99extern int strncasecmp (char *s1, char *s2, int n) /*@*/ ;
1d239d69 100extern /*@null@*/ /*@only@*/ char *strdup (char *s) /*@*/ ;
885824d3 101
885824d3 102extern /*@null@*/ /*@dependent@*/ char *
103 index (/*@returned@*/ char *s, char c) /*@*/ ;
104
105extern /*@null@*/ /*@dependent@*/ char *
106 rindex (/*@returned@*/ char *s, char c) /*@*/ ;
107
ce7034f0 108# if 0
109These are in ISO C99. Moved to standard.h:
110 extern double cbrt (double x) /*@modifies errno@*/ ;
111 extern double rint (double x) /*@*/ ;
112 extern double trunc (double x) /*@*/ ;
113# endif
885824d3 114
885824d3 115
116/*@constant int ENOTBLK@*/
117/*@constant int ETXTBSY@*/
118/*@constant int EWOULDBLOCK@*/
119/*@constant int EINPROGRESS@*/
120/*@constant int EALREADY@*/
121/*@constant int ENOTSOCK@*/
122/*@constant int EDESTADDRREQ@*/
123/*@constant int EMSGSIZE@*/
124/*@constant int EPROTOTYPE@*/
125/*@constant int ENOPROTOOPT@*/
126/*@constant int EPROTONOSUPPORT@*/
127/*@constant int ESOCKTNOSUPPORT@*/
128/*@constant int EOPNOTSUPP@*/
129/*@constant int EPFNOSUPPORT@*/
130/*@constant int EAFNOSUPPORT@*/
131/*@constant int EADDRINUSE@*/
132/*@constant int EADDRNOTAVAIL@*/
133/*@constant int ENETDOWN@*/
134/*@constant int ENETUNREACH@*/
135/*@constant int ENETRESET@*/
136/*@constant int ECONNABORTED@*/
137/*@constant int ECONNRESET@*/
138/*@constant int ENOBUFS@*/
139/*@constant int EISCONN@*/
140/*@constant int ENOTCONN@*/
141/*@constant int ESHUTDOWN@*/
142/*@constant int ETOOMANYREFS@*/
143/*@constant int ETIMEDOUT@*/
144/*@constant int ECONNREFUSED@*/
145/*@constant int ENAMETOOLONG@*/
146/*@constant int EHOSTDOWN@*/
147/*@constant int EHOSTUNREACH@*/
148/*@constant int ENOTEMPTY@*/
149/*@constant int EPROCLIM@*/
150/*@constant int EUSERS@*/
151/*@constant int EDQUOT@*/
152/*@constant int ESTALE@*/
153/*@constant int EREMOTE@*/
154/*@constant int ENOMSG@*/
155/*@constant int EIDRM@*/
156/*@constant int EALIGN@*/
157/*@constant int EDEADLK@*/
158/*@constant int ENOLCK@*/
159/*@constant int ENOSYS@*/
160/*@constant int EACTIVE@*/
161/*@constant int ENOACTIVE@*/
162/*@constant int ENORESOURCES@*/
163/*@constant int ENOSYSTEM@*/
164/*@constant int ENODUST@*/
165/*@constant int EDUPNOCONN@*/
166/*@constant int EDUPNODISCONN@*/
167/*@constant int EDUPNOTCNTD@*/
168/*@constant int EDUPNOTIDLE@*/
169/*@constant int EDUPNOTWAIT@*/
170/*@constant int EDUPNOTRUN@*/
171/*@constant int EDUPBADOPCODE@*/
172/*@constant int EDUPINTRANSIT@*/
173/*@constant int EDUPTOOMANYCPUS@*/
174/*@constant int ELOOP@*/
175
176/*@constant int LOCK_MAX@*/
177/*@constant int FCHR_MAX@*/
178/*@constant int USI_MAX@*/
179/*@constant int WORD_BIT@*/
180/*@constant int LONG_BIT@*/
4aadc959 181
86d93ed3 182/*@-incondefs@*/ /* some constant are also declared in posix.h*/
183
184/*@constant long NAME_MAX@*/
185
885824d3 186/*@constant long NGROUPS_MAX@*/
4aadc959 187
885824d3 188/*@constant long MAX_CANON@*/
189/*@constant int MAX_CHAR@*/
190/*@constant long OPEN_MAX@*/
191/*@constant int PASS_MAX@*/
4aadc959 192
885824d3 193/*@constant int PID_MAX@*/
194/*@constant int SYSPID_MAX@*/
86d93ed3 195/*@constant long PIPE_BUF@*/
196/*@=incondefs@*/
885824d3 197/*@constant int PIPE_MAX@*/
198/*@constant int PROC_MAX@*/
199/*@constant int STD_BLK@*/
200/*@constant int SYS_NMLN@*/
201/*@constant int SYS_OPEN@*/
202/*@constant int NZERO@*/
203/*@constant int UID_MAX@*/
204/*@constant long MB_LEN_MAX@*/
205/*@constant int NL_ARGMAX@*/
206/*@constant int NL_MSGMAX@*/
207/*@constant int NL_NMAX@*/
208/*@constant int NL_SETMAX@*/
209/*@constant int NL_TEXTMAX@*/
210/*@constant int NL_LBLMAX@*/
211/*@constant int NL_LANGMAX @*/
212
213/*@constant double M_E@*/
214/*@constant double M_LOG2E@*/
215/*@constant double M_LOG10E@*/
216/*@constant double M_LN2@*/
217/*@constant double M_LN10@*/
218/*@constant double M_PI@*/
219/*@constant double M_PI_2@*/
220/*@constant double M_PI_4@*/
221/*@constant double M_1_PI@*/
222/*@constant double M_2_PI@*/
223/*@constant double M_2_SQRTPI@*/
224/*@constant double M_SQRT2@*/
225/*@constant double M_SQRT1_2@*/
226
227/*@constant double MAXFLOAT@*/
228/*@constant double HUGE@*/
229
230/*@constant int DOMAIN@*/
231/*@constant int SING@*/
232/*@constant int OVERFLOW@*/
233/*@constant int UNDERFLOW@*/
234/*@constant int TLOSS@*/
235/*@constant int PLOSS@*/
236
237extern /*@unchecked@*/ int daylight;
238extern /*@unchecked@*/ long timezone;
239extern /*@unchecked@*/ char *tzname[];
240
241/*@-incondefs@*/
242extern void tzset(void) /*@modifies daylight, timezone, tzname@*/ ;
243/*@=incondefs@*/
244
8fe44445 245/*@-redef@*/ /* Defined by ansi: */
246typedef /*@integraltype@*/ key_t;
247/*@-incondefs@*/ typedef long timer_t; /*@=incondefs@*/
248/*@=redef@*/
249
885824d3 250typedef unsigned char uchar_t;
251typedef unsigned short ushort_t;
252typedef unsigned int uint_t;
253typedef unsigned long ulong_t;
254typedef volatile unsigned char vuchar_t;
255typedef volatile unsigned short vushort_t;
256typedef volatile unsigned int vuint_t;
257typedef volatile unsigned long vulong_t;
258typedef long label_t;
259typedef int level_t;
260typedef /*@integraltype@*/ daddr_t;
261typedef char *caddr_t;
262typedef long *qaddr_t;
263typedef char *addr_t;
264typedef long physadr_t;
265typedef short cnt_t;
266typedef int chan_t;
885824d3 267typedef int paddr_t;
885824d3 268typedef void *mid_t;
269typedef char slab_t[12];
270typedef ulong_t shmatt_t;
271typedef ulong_t msgqnum_t;
272typedef ulong_t msglen_t;
885824d3 273typedef uchar_t uchar;
274typedef ushort_t ushort;
275typedef uint_t uint;
276typedef ulong_t ulong;
277typedef uchar_t u_char;
278typedef ushort_t u_short;
279typedef uint_t u_int;
280typedef ulong_t u_long;
281typedef vuchar_t vu_char;
282typedef vushort_t vu_short;
283typedef vuint_t vu_int;
284typedef vulong_t vu_long;
285typedef long swblk_t;
286typedef u_long fixpt_t;
287typedef long segsz_t;
288typedef /*@abstract@*/ fd_set;
289
885824d3 290int ioctl (int d, int /*@alt long@*/ request, /*@out@*/ void *arg)
291 /*@modifies *arg, errno@*/ ; /* depends on request! */
292
885824d3 293pid_t vfork (void) /*@modifies fileSystem@*/ ;
294
140c27a8 295/*
296** sys/uio.h
297*/
885824d3 298
15b3d2b2 299struct iovec {
2a3f24b8 300 /*@dependent@*/ void *iov_base;
140c27a8 301 size_t iov_len; /*: maxSet(iov_base) = iov_len */
885824d3 302};
303
140c27a8 304/* from limits.h */
885824d3 305/*@constant int UIO_MAXIOV@*/ /* BSD */
306/*@constant int IOV_MAX@*/ /* supposedly SVR4 */
307
140c27a8 308ssize_t readv (int fd, const struct iovec *iov, int iovcnt)
309 /*@modifies iov->iov_base, fileSystem, errno@*/;
885824d3 310
140c27a8 311ssize_t writev (int fd, const struct iovec *iov, int iovcnt)
312 /*@modifies errno@*/;
885824d3 313
314/*________________________________________________________________________
315 * poll.h
316 */
317
318 struct poll {
319 int fd;
320 short events;
321 short revents;
322};
323
324/*@constant short POLLIN@*/
325/*@constant short POLLRDNORM@*/
326/*@constant short POLLRDBAND@*/
327/*@constant short POLLPRI@*/
328/*@constant short POLLOUT@*/
329/*@constant short POLLWRNORM@*/
330/*@constant short POLLWRBAND@*/
331/*@constant short POLLERR@*/
332/*@constant short POLLHUP@*/
333/*@constant short POLLNVAL@*/
334
335extern int poll (struct poll pollfd[], unsigned long nfds, int timeout)
336 /*@modifies pollfd[].revents, errno@*/ ;
337
338/*
339** free does not take null
340*/
341
342/*@-incondefs@*/
343extern void free (/*@notnull@*/ /*@out@*/ /*@only@*/ void *p) /*@modifies *p@*/ ;
344/*@=incondefs@*/
345
346/*________________________________________________________________________
347 * sys/socket.h
348 */
349
140c27a8 350
351
352
885824d3 353/*@constant int SOCK_RDM@*/
140c27a8 354
355
356
357
358
359
360
885824d3 361/*@constant int SO_USELOOPBACK@*/
140c27a8 362
363
885824d3 364/*@constant int SO_REUSEPORT@*/
140c27a8 365
366
367
368
369
370
371
372
373
374
885824d3 375/*@constant int AF_LOCAL@*/
140c27a8 376
377
885824d3 378/*@constant int AF_IMPLINK@*/
379/*@constant int AF_PUP@*/
380/*@constant int AF_CHAOS@*/
381/*@constant int AF_NS@*/
382/*@constant int AF_ISO@*/
383/*@constant int AF_OSI@*/
384/*@constant int AF_ECMA@*/
385/*@constant int AF_DATAKIT@*/
386/*@constant int AF_CCITT@*/
387/*@constant int AF_SNA@*/
388/*@constant int AF_DECnet@*/
389/*@constant int AF_DLI@*/
390/*@constant int AF_LAT@*/
391/*@constant int AF_HYLINK@*/
392/*@constant int AF_APPLETALK@*/
393/*@constant int AF_ROUTE@*/
394/*@constant int AF_LINK@*/
395/*@constant int pseudo_AF_XTP@*/
396/*@constant int AF_COIP@*/
397/*@constant int AF_CNT@*/
398/*@constant int pseudo_AF_RTIP@*/
399/*@constant int AF_IPX@*/
400/*@constant int AF_SIP@*/
401/*@constant int pseudo_AF_PIP@*/
402/*@constant int AF_ISDN@*/
403/*@constant int AF_E164@*/
404/*@constant int AF_MAX@*/
140c27a8 405
406
407
408
409
410
885824d3 411/*@constant int MSG_DONTWAIT@*/
412/*@constant int MSG_EOF@*/
413/*@constant int MSG_COMPAT@*/
414/*@constant int PF_UNSPEC@*/
415/*@constant int PF_LOCAL@*/
416/*@constant int PF_UNIX@*/
417/*@constant int PF_INET@*/
418/*@constant int PF_IMPLINK@*/
419/*@constant int PF_PUP@*/
420/*@constant int PF_CHAOS@*/
421/*@constant int PF_NS@*/
422/*@constant int PF_ISO@*/
423/*@constant int PF_OSI@*/
424/*@constant int PF_ECMA@*/
425/*@constant int PF_DATAKIT@*/
426/*@constant int PF_CCITT@*/
427/*@constant int PF_SNA@*/
428/*@constant int PF_DECnet@*/
429/*@constant int PF_DLI@*/
430/*@constant int PF_LAT@*/
431/*@constant int PF_HYLINK@*/
432/*@constant int PF_APPLETALK@*/
433/*@constant int PF_ROUTE@*/
434/*@constant int PF_LINK@*/
435/*@constant int PF_XTP@*/
436/*@constant int PF_COIP@*/
437/*@constant int PF_CNT@*/
438/*@constant int PF_SIP@*/
439/*@constant int PF_IPX@*/
440/*@constant int PF_RTIP@*/
441/*@constant int PF_PIP@*/
442/*@constant int PF_ISDN@*/
443/*@constant int PF_MAX@*/
444/*@constant int NET_MAXID@*/
445/*@constant int NET_RT_DUMP@*/
446/*@constant int NET_RT_FLAGS@*/
447/*@constant int NET_RT_IFLIST@*/
448/*@constant int NET_RT_MAXID@*/
885824d3 449
eed3d8ac 450/*moved this to before socket.h to get splint to parse the header*/
451typedef /*@unsignedintegraltype@*/ sa_family_t;
452
140c27a8 453/*
454** sys/socket.h
455** (updated 26 May 2002)
456*/
457
35e8712d 458typedef /*@unsignedintegraltype@*/ __socklen_t; /* not in USB, but needed by linux */
140c27a8 459typedef /*@unsignedintegraltype@*/ socklen_t;
460
461struct sockaddr {
462 sa_family_t sa_family; /* address family */
463 char sa_data[]; /* variable length */
885824d3 464};
140c27a8 465
466struct sockaddr_storage {
467 sa_family_t ss_family;
468} ;
469
470struct msghdr {
2a3f24b8 471 /*@dependent@*/ void *msg_name;
140c27a8 472 socklen_t msg_namelen; /*: maxSet (msg_name) >= msg_namelen */
2a3f24b8 473 /*@dependent@*/ struct iovec *msg_iov; /* scatter/gather array */
140c27a8 474 int msg_iovlen; /* # elements in msg_iov */ /*: maxSet (msg_iov) >= msg_iovlen */
2a3f24b8 475 /*@dependent@*/ void *msg_control; /* ancillary data, see below */
140c27a8 476 socklen_t msg_controllen; /*: maxSet (msg_control) >= msg_controllen */
477 int msg_flags; /* flags on received message */
478} ;
479
480struct cmsghdr {
481 socklen_t cmsg_len; /* data byte count, including hdr */
482 int cmsg_level; /* originating protocol */
483 int cmsg_type; /* protocol-specific type */
484} ;
485
486/*@constant int SCM_RIGHTS@*/
487
488/*@exposed@*/ unsigned char *CMSG_DATA (/*@sef@*/ struct cmsghdr *) /*@*/ ;
489/*@null@*/ /*@exposed@*/ struct cmsghdr *CMSG_NXTHDR (struct msghdr *, struct cmsghdr *) /*@*/ ;
490/*@null@*/ /*@exposed@*/ struct cmsghdr *CMSG_FIRSTHDR (struct msghdr *) /*@*/ ;
491
492struct linger {
493 int l_onoff;
494 int l_linger;
885824d3 495};
496
140c27a8 497/*@constant int SOCK_DGRAM@*/
498/*@constant int SOCK_RAW@*/
499/*@constant int SOCK_SEQPACKET@*/
500/*@constant int SOCK_STREAM@*/
501
502/*@constant int SOL_SOCKET@*/
503
504/*@constant int SO_ACCEPTCONN@*/
505/*@constant int SO_BROADCAST@*/
506/*@constant int SO_DEBUG@*/
507/*@constant int SO_DONTROUTE@*/
508/*@constant int SO_ERROR@*/
509/*@constant int SO_KEEPALIVE@*/
510/*@constant int SO_LINGER@*/
511/*@constant int SO_OOBINLINE@*/
512/*@constant int SO_RCVBUF@*/
513/*@constant int SO_RCVLOWAT@*/
514/*@constant int SO_RCVTIMEO@*/
515/*@constant int SO_REUSEADDR@*/
516/*@constant int SO_SNDBUF@*/
517/*@constant int SO_SNDLOWAT@*/
518/*@constant int SO_SNDTIMEO@*/
519/*@constant int SO_TYPE@*/
520
521/*@constant int SOMAXCONN@*/
522
523/*@constant int MSG_CTRUNC@*/
524/*@constant int MSG_DONTROUTE@*/
525/*@constant int MSG_EOR@*/
526/*@constant int MSG_OOB@*/
527/*@constant int MSG_PEEK@*/
528/*@constant int MSG_TRUNC@*/
529/*@constant int MSG_WAITALL@*/
530
531/*@constant int AF_INET@*/
532/*@constant int AF_INET6@*/
533/*@constant int AF_UNIX@*/
534/*@constant int AF_UNSPEC@*/
535
536/*@constant int SHUT_RD@*/
537/*@constant int SHUT_RDWR@*/
538/*@constant int SHUT_WR@*/
539
540# if 0
541/*
542** These were in the old unix.h spec, but are not in SUS6
543*/
544
545struct sockproto {
546 u_short sp_family; /* address family */
547 u_short sp_protocol; /* protocol */
885824d3 548};
549
140c27a8 550# endif
885824d3 551
140c27a8 552int accept (int s, struct sockaddr *addr, int *addrlen)
553 /*@modifies *addrlen, errno@*/;
885824d3 554
140c27a8 555int bind (int s, const struct sockaddr *name, int namelen)
556 /*@modifies errno, fileSystem@*/;
885824d3 557
140c27a8 558int connect (int s, const struct sockaddr *name, int namelen)
559 /*@modifies errno, internalState@*/;
86d93ed3 560
2a3f24b8 561int getpeername (int s, /*@out@*/ struct sockaddr */*restrict*/ name, socklen_t */*restrict*/ namelen)
eed3d8ac 562 /*drl splint doesn't handle restrict yet*/
140c27a8 563 /*@modifies *name, *namelen, errno@*/;
564
86d93ed3 565#ifdef STRICT
885824d3 566
86d93ed3 567int getsockname (int s, /*@out@*/ struct sockaddr *address, socklen_t *address_len)
568 /*@i556@*/ /*: can't do this? requires maxSet(address) >= (*address_len) @*/
7272a1c1 569 /*@modifies *address, *address_len, errno@*/;
885824d3 570
86d93ed3 571#else
572int getsockname (int s, /*@out@*/ struct sockaddr *address, socklen_t /*@alt size_t@*/ *address_len)
155af98d 573 /*@i556@*/ /*: can't do this? requires maxSet(address) >= (*address_len) @*/
86d93ed3 574 /*@modifies *address, *address_len, errno@*/;
575
576#endif
577
7272a1c1 578int getsockopt (int s, int level, int optname, /*@out@*/ void *optval, size_t *optlen)
885824d3 579 /*@modifies *optval, *optlen, errno@*/;
580
581 extern int
582listen (int s, int backlog)
583 /*@modifies errno, internalState@*/;
584
585 extern ssize_t
586recv (int s, /*@out@*/ void *buf, size_t len, int flags)
587 /*@modifies *buf, errno@*/;
588
589 extern ssize_t
590recvfrom (int s, void *buf, size_t len, int flags, /*@null@*/ struct sockaddr *from, int *fromlen)
591 /*@modifies *buf, *from, *fromlen, errno@*/;
592
593 extern ssize_t
594recvmsg (int s, struct msghdr *msg, int flags)
595 /*@modifies msg->msg_iov->iov_base[], errno@*/;
596
597 extern ssize_t
598send (int s, const void *msg, size_t len, int flags)
599 /*@modifies errno@*/;
600
601 extern ssize_t
602sendto (int s, const void *msg, size_t len, int flags, const struct sockaddr *to, int tolen)
603 /*@modifies errno@*/;
604
605 extern ssize_t
606sendmsg (int s, const struct msghdr *msg, int flags)
607 /*@modifies errno@*/;
608
609 extern int
610setsockopt (int s, int level, int optname, const void *optval, int optlen)
611 /*@modifies internalState, errno@*/;
612
613 extern int
614shutdown (int s, int how)
615 /*@modifies errno@*/;
616
617 extern int
618socket (int domain, int type, int protocol)
619 /*@modifies errno@*/;
620
621 extern int
622socketpair (int d, int type, int protocol, /*@out@*/ int *sv)
623 /*@modifies errno@*/;
624
625/*@constant int BADSIG@*/
626/*@constant int SA_ONSTACK@*/
627/*@constant int SA_RESTART@*/
628/*@constant int SA_DISABLE@*/
629/*@constant int SIGBUS@*/
630/*@constant int SIGEMT@*/
631/*@constant int SIGINFO@*/
632/*@constant int SIGIO@*/
633/*@constant int SIGIOT@*/
634/*@constant int SIGPOLL@*/
635/*@constant int SIGPROF@*/
636/*@constant int SIGPWR@*/
637/*@constant int SIGSYS@*/
638/*@constant int SIGTRAP@*/
639/*@constant int SIGURG@*/
640/*@constant int SIGVTALRM@*/
641/*@constant int SIGWINCH@*/
642/*@constant int SIGXCPU@*/
643/*@constant int SIGXFSZ@*/
644
645extern void psignal (int sig, const char *msg)
646 /*@modifies fileSystem@*/;
647
885824d3 648 extern int
649setenv (const char *name, const char *value, int overwrite)
650 /*@globals environ@*/
651 /*@modifies *environ, errno@*/;
652
885824d3 653 extern void
654unsetenv (const char *name)
655 /*@globals environ@*/
656 /*@modifies *environ@*/;
657
658/*________________________________________________________________________
659 * sys/wait.h
660 */
661
662 extern int
663WCOREDUMP (int x)
664 /*@*/;
665
666 extern int
667W_EXITCODE (int ret, int sig)
668 /*@*/;
669
670 extern int
671W_STOPCODE (int sig)
672 /*@*/;
673
674/*@constant int WAIT_ANY@*/
675/*@constant int WAIT_MYPGRP@*/
676/*@constant int WSTOPPED@*/
677
678 extern pid_t
679wait3 (int *statloc, int options, /*@null@*/ /*@out@*/ struct rusage *rusage)
680 /*@modifies *statloc, *rusage, errno@*/;
681
682 extern pid_t
683wait4 (pid_t p, int *statloc, int opt, /*@null@*/ /*@out@*/ struct rusage *r)
684 /*@modifies *statloc, *r, errno@*/;
685
686struct timeval {
687 long tv_sec;
688 long tv_usec;
689} ;
690
691struct timespec {
692 long ts_sec;
693 long ts_nsec;
694} ;
695
696struct timezone {
697 int tz_minuteswest;
698 int tz_dsttime;
699} ;
700
701/*@constant int DST_NONE@*/
702/*@constant int DST_USA@*/
703/*@constant int DST_AUST@*/
704/*@constant int DST_WET@*/
705/*@constant int DST_MET@*/
706/*@constant int DST_EET@*/
707/*@constant int DST_CAN@*/
708
709/*@constant int ITIMER_PROF@*/
710/*@constant int ITIMER_REAL@*/
711/*@constant int ITIMER_VIRTUAL@*/
712
713 struct itimerval {
714 struct timeval it_interval;
715 struct timeval it_value;
716};
717
718 struct clockinfo {
719 int hz;
720 int tick;
721 int stathz;
722 int profhz;
723};
724
725 extern int
726adjtime (const struct timeval *delta, /*@null@*/ /*@out@*/ struct timeval *olddelta)
727 /*@modifies internalState, *olddelta, errno@*/;
728
729 extern int
730getitimer (int which, /*@out@*/ struct itimerval *value)
731 /*@modifies errno, *value*/;
732
733 extern int
734gettimeofday (/*@null@*/ /*@out@*/ struct timeval *tp, /*@null@*/ /*@out@*/ struct timezone *tzp)
735 /*@modifies *tp, *tzp, errno@*/;
736
737 extern int
738setitimer (int which, struct itimerval *val, /*@null@*/ /*@out@*/ struct itimerval *oval)
739 /*@modifies *oval, errno, internalState*/;
740
741 extern int
742settimeofday (const struct timeval *t, const struct timezone *z)
743 /*@modifies internalState, errno@*/;
744
745 extern int
746utimes (const char *file, /*@null@*/ const struct timeval *times)
747 /*@modifies fileSystem, errno*/;
748
749/*________________________________________________________________________
750 * sys/mman.h
751 */
752
753/*@constant int PROT_READ@*/
754/*@constant int PROT_WRITE@*/
755/*@constant int PROT_EXEC@*/
756/*@constant int MAP_SHARED@*/
757/*@constant int MAP_PRIVATE@*/
758/*@constant int MAP_COPY@*/
759/*@constant int MAP_FIXED@*/
760/*@constant int MAP_RENAME@*/
761/*@constant int MAP_NORESERVE@*/
762/*@constant int MAP_INHERIT@*/
763/*@constant int MAP_NOEXTEND@*/
764/*@constant int MAP_HASSEMAPHORE@*/
765/*@constant int MS_ASYNC@*/
766/*@constant int MS_INVALIDATE@*/
767/*@constant int MAP_FILE@*/
768/*@constant int MAP_ANON@*/
769/*@constant int MADV_NORMAL@*/
770/*@constant int MADV_RANDOM@*/
771/*@constant int MADV_SEQUENTIAL@*/
772/*@constant int MADV_WILLNEED@*/
773/*@constant int MADV_DONTNEED@*/
774
775 extern caddr_t
776mmap (/*@null@*/ /*@returned@*/ caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
777 /*@modifies addr@*/;
778
779 extern int
780madvise (caddr_t addr, int len, int behav)
781 /*@*/;
782
783 extern int
784mprotect (caddr_t addr, int len, int prot)
785 /*@*/;
786
787 extern int
345671f3 788 int munmap (/*@only@*/ caddr_t addr, size_t len)
789 /*@modifies fileSystem, *addr, errno @*/;
790
885824d3 791 extern int
792msync (caddr_t addr, int len, int flags)
793 /*@*/;
794
795 extern int
796mlock (caddr_t addr, size_t len)
797 /*@*/;
798
799 extern int
800munlock (caddr_t addr, size_t len)
801 /*@*/;
802
803
804/*________________________________________________________________________
805 * sys/ioctl.h
806 */
807
808 struct winsize {
809 unsigned short ws_row;
810 unsigned short ws_col;
811 unsigned short ws_xpixel;
812 unsigned short ws_ypixel;
813};
814
815/*@constant int TIOCMODG@*/
816/*@constant int TIOCMODS@*/
817/*@constant int TIOCM_LE@*/
818/*@constant int TIOCM_DTR@*/
819/*@constant int TIOCM_RTS@*/
820/*@constant int TIOCM_ST@*/
821/*@constant int TIOCM_SR@*/
822/*@constant int TIOCM_CTS@*/
823/*@constant int TIOCM_CAR@*/
824/*@constant int TIOCM_CD@*/
825/*@constant int TIOCM_RNG@*/
826/*@constant int TIOCM_RI@*/
827/*@constant int TIOCM_DSR@*/
828/*@constant int TIOCEXCL@*/
829/*@constant int TIOCNXCL@*/
830/*@constant int TIOCFLUSH@*/
831/*@constant int TIOCGETA@*/
832/*@constant int TIOCSETA@*/
833/*@constant int TIOCSETAW@*/
834/*@constant int TIOCSETAF@*/
835/*@constant int TIOCGETD@*/
836/*@constant int TIOCSETD@*/
837/*@constant int TIOCSBRK@*/
838/*@constant int TIOCCBRK@*/
839/*@constant int TIOCSDTR@*/
840/*@constant int TIOCCDTR@*/
841/*@constant int TIOCGPGRP@*/
842/*@constant int TIOCSPGRP@*/
843/*@constant int TIOCOUTQ@*/
844/*@constant int TIOCSTI@*/
845/*@constant int TIOCNOTTY@*/
846/*@constant int TIOCPKT@*/
847/*@constant int TIOCPKT_DATA@*/
848/*@constant int TIOCPKT_FLUSHREAD@*/
849/*@constant int TIOCPKT_FLUSHWRITE@*/
850/*@constant int TIOCPKT_STOP@*/
851/*@constant int TIOCPKT_START@*/
852/*@constant int TIOCPKT_NOSTOP@*/
853/*@constant int TIOCPKT_DOSTOP@*/
854/*@constant int TIOCPKT_IOCTL@*/
855/*@constant int TIOCSTOP@*/
856/*@constant int TIOCSTART@*/
857/*@constant int TIOCMSET@*/
858/*@constant int TIOCMBIS@*/
859/*@constant int TIOCMBIC@*/
860/*@constant int TIOCMGET@*/
861/*@constant int TIOCREMOTE@*/
862/*@constant int TIOCGWINSZ@*/
863/*@constant int TIOCSWINSZ@*/
864/*@constant int TIOCUCNTL@*/
865/*@constant int TIOCSTAT@*/
866/*@constant int TIOCCONS@*/
867/*@constant int TIOCSCTTY@*/
868/*@constant int TIOCEXT@*/
869/*@constant int TIOCSIG@*/
870/*@constant int TIOCDRAIN@*/
871/*@constant int TIOCMSDTRWAIT@*/
872/*@constant int TIOCMGDTRWAIT@*/
873/*@constant int TIOCTIMESTAMP@*/
874/*@constant int TIOCSDRAINWAIT@*/
875/*@constant int TIOCGDRAINWAIT@*/
876/*@constant int TTYDISC@*/
877/*@constant int TABLDISC@*/
878/*@constant int SLIPDISC@*/
879/*@constant int PPPDISC@*/
880
881/*@constant int MAXHOSTNAMELEN@*/
882
0bd4c301 883extern void FD_CLR (/*@sef@*/ int n, /*@sef@*/ fd_set *p) /*@modifies *p@*/ ;
884extern void FD_COPY (/*@sef@*/ fd_set *f, /*@out@*/ fd_set *t) /*@modifies *t@*/ ;
885extern int /*@alt _Bool@*/ FD_ISSET (/*@sef@*/ int n, /*@sef@*/ fd_set *p) /*@*/ ;
886extern void FD_SET (/*@sef@*/ int n, /*@sef@*/ fd_set *p) /*@modifies *p@*/ ;
887extern void FD_ZERO (/*@sef@*/ fd_set /*@out@*/ *p) /*@modifies *p@*/;
885824d3 888
0bd4c301 889extern int fchdir (int fd) /*@modifies internalState, errno@*/;
890extern int fchown (int fd, uid_t owner, gid_t group) /*@modifies errno, fileSystem@*/;
891extern int fsync (int fd) /*@modifies errno, fileSystem@*/;
885824d3 892
0bd4c301 893extern int ftruncate (int fd, off_t length) /*@modifies errno, fileSystem@*/;
885824d3 894
b072092f 895int gethostname (/*@out@*/ char *address, size_t address_len)
896 /*:errorstatus@*/
897 /*@modifies address@*/ ;
885824d3 898
b072092f 899int initgroups (const char *name, int basegid)
900 /*@modifies internalState@*/;
885824d3 901
140c27a8 902int lchown (const char *path, uid_t owner, gid_t group)
903 /*@modifies errno, fileSystem@*/;
904
0bd4c301 905int select (int mfd, fd_set /*@null@*/ *r, fd_set /*@null@*/ *w,
906 fd_set /*@null@*/ *e, /*@null@*/ struct timeval *t)
907 /*@modifies *r, *w, *e, *t, errno@*/;
908 /* evans - 2002-05-26: added null for t, bug reported by Enrico Scholz */
140c27a8 909
910int setegid (gid_t egid)
0bd4c301 911 /*@modifies errno, internalState@*/;
140c27a8 912
913int seteuid (uid_t euid)
0bd4c301 914 /*@modifies errno, internalState@*/;
140c27a8 915
916int setgroups (int ngroups, const gid_t *gidset)
0bd4c301 917 /*@modifies errno, internalState@*/;
140c27a8 918
919int setregid (gid_t rgid, gid_t egid)
0bd4c301 920 /*@modifies errno, internalState@*/;
140c27a8 921
922int setreuid (gid_t ruid, gid_t euid)
0bd4c301 923 /*@modifies errno, internalState@*/;
140c27a8 924
925void sync (void)
0bd4c301 926 /*@modifies fileSystem@*/;
140c27a8 927
928int symlink (const char *path, const char *path2)
0bd4c301 929 /*@modifies fileSystem@*/;
140c27a8 930
931int truncate (const char *name, off_t length)
0bd4c301 932 /*@modifies errno, fileSystem@*/;
140c27a8 933
885824d3 934/*@constant int EBADRPC@*/
935/*@constant int ERPCMISMATCH@*/
936/*@constant int EPROGUNAVAIL@*/
937/*@constant int EPROGMISMATCH@*/
938/*@constant int EPROCUNAVAIL@*/
939/*@constant int EFTYPE@*/
940/*@constant int EAUTH@*/
941/*@constant int ENEEDAUTH@*/
942/*@constant int ELAST@*/
943
79127b5d 944/*
945** tar.h
946*/
885824d3 947
948/*@unchecked@*/ extern char *TMAGIC;
949/*@constant int TMAGLEN@*/
950/*@unchecked@*/ extern char *TVERSION;
951/*@constant int TVERSLEN@*/
952
953/*@constant int REGTYPE@*/
954/*@constant int AREGTYPE@*/
955/*@constant int LNKTYPE@*/
956/*@constant int SYMTYPE@*/
957/*@constant int CHRTYPE@*/
958/*@constant int BLKTYPE@*/
959/*@constant int DIRTYPE@*/
960/*@constant int FIFOTYPE@*/
961/*@constant int CONTTYPE@*/
962
963/*@constant int TSUID@*/
964/*@constant int TSGID@*/
965/*@constant int TSVTX@*/
966
967/*@constant int TUREAD@*/
968/*@constant int TUWRITE@*/
969/*@constant int TUEXEC@*/
970/*@constant int TGREAD@*/
971/*@constant int TGWRITE@*/
972/*@constant int TGEXEC@*/
973/*@constant int TOREAD@*/
974/*@constant int TOWRITE@*/
975/*@constant int TOEXEC@*/
976
977struct ipc_perm {
978 uid_t uid; /* user id */
979 gid_t gid; /* group id */
980 uid_t cuid; /* creator user id */
981 gid_t cgid; /* creator group id */
982 mode_t mode; /* r/w permission */
983 ulong seq; /* slot usage sequence number */
984 key_t key; /* user specified msg/sem/shm key */
985} ;
986
987/*@constant int IPC_R@*/
988/*@constant int IPC_W@*/
989/*@constant int IPC_M@*/
990/*@constant int IPC_CREAT@*/
991/*@constant int IPC_EXCL@*/
992/*@constant int IPC_NOWAIT@*/
993/*@constant key_t IPC_PRIVATE@*/
994/*@constant int IPC_RMID@*/
995/*@constant int IPC_SET@*/
996/*@constant int IPC_STAT@*/
997
79127b5d 998/*
999** sys/msg.h
1000*/
885824d3 1001
1002 struct msqid_ds {
1003 struct ipc_perm msg_perm; /* msg queue permission bits */
1004 struct msg *msg_first; /* first message in the queue */
1005 struct msg *msg_last; /* last message in the queue */
1006 u_long msg_cbytes; /* number of bytes in use on the queue */
1007 u_long msg_qnum; /* number of msgs in the queue */
1008 u_long msg_qbytes; /* max # of bytes on the queue */
1009 pid_t msg_lspid; /* pid of last msgsnd() */
1010 pid_t msg_lrpid; /* pid of last msgrcv() */
1011 time_t msg_stime; /* time of last msgsnd() */
1012 time_t msg_rtime; /* time of last msgrcv() */
1013 time_t msg_ctime; /* time of last msgctl() */
1014};
1015
1016 struct mymesg {
1017 long mtype; /* message type (+ve integer) */
1018 char mtext[]; /* message body */
1019};
1020
1021/*@constant int MSG_NOERROR@*/
1022/*@constant int MSGMAX@*/
1023/*@constant int MSGMNB@*/
1024/*@constant int MSGMNI@*/
1025/*@constant int MSGTQL@*/
1026
1027 extern int
1028msgctl (int id , int cmd, /*@out@*/ struct msqid_ds *buf)
1029 /*@modifies errno, *buf@*/;
1030
1031 extern int
1032msgget (key_t key, int flag)
1033 /*@modifies errno@*/;
1034
1035 extern int
1036msgrcv (int id, /*@out@*/ void *ptr, size_t nbytes, long type, int flags)
1037 /*@modifies errno, *ptr@*/;
1038
1039 extern int
1040msgsnd (int id, const void *ptr, size_t nbytes, int flag)
1041 /*@modifies errno@*/;
1042
79127b5d 1043/*
1044** sys/sem.h
1045*/
885824d3 1046
1047 struct semid_ds {
1048 struct ipc_perm sem_perm;
1049 struct sem *sem_base;
1050 ushort sem_nsems;
1051 time_t sem_otime;
1052 time_t sem_ctime;
1053};
1054
1055 struct sem {
1056 ushort semval;
1057 pid_t sempid;
1058 ushort semncnt;
1059 ushort semzcnt;
1060};
1061
1062 union semun {
1063 int val;
1064 struct semid_ds *buf;
1065 ushort *array;
1066};
1067
1068 struct sembuf {
1069 ushort sem_num;
1070 short sem_op;
1071 short sem_flg;
1072};
1073
1074/*@constant int SEM_A@*/
1075/*@constant int SEMAEM@*/
1076/*@constant int SEMMNI@*/
1077/*@constant int SEMMNS@*/
1078/*@constant int SEMMNU@*/
1079/*@constant int SEMMSL@*/
1080/*@constant int SEMOPN@*/
1081/*@constant int SEM_R@*/
1082/*@constant int SEMUME@*/
1083/*@constant int SEM_UNDO@*/
1084/*@constant int SEMVMX@*/
1085/*@constant int GETVAL@*/
1086/*@constant int SETVAL@*/
1087/*@constant int GETPID@*/
1088/*@constant int GETNCNT@*/
1089/*@constant int GETZCNT@*/
1090/*@constant int GETALL@*/
1091/*@constant int SETALL@*/
1092
1093/*@constant int ERMID@*/
1094
1095 extern int
1096semctl (int id, int semnum, int cmd, union semun arg)
1097 /*@modifies errno@*/;
1098
1099 extern int
1100semget (key_t key, int nsems, int flag)
1101 /*@modifies errno@*/;
1102
1103 extern int
1104semop (int id, struct sembuf *semoparray, size_t nops)
1105 /*@modifies errno@*/;
1106
79127b5d 1107/*
1108** sys/shm.h
1109*/
885824d3 1110
1111 struct shmid_ds {
1112 struct ipc_perm shm_perm;
1113 int shm_segsz;
1114 ushort shm_lkcnt;
1115 pid_t shm_lpid;
1116 pid_t shm_cpid;
1117 ulong shm_nattch;
1118 ulong shm_cnattch;
1119 time_t shm_atime;
1120 time_t shm_dtime;
1121 time_t shm_ctime;
1122};
1123
1124/*@constant int SHMLBA@*/
1125/*@constant int SHM_LOCK@*/
1126/*@constant int SHMMAX@*/
1127/*@constant int SHMMIN@*/
1128/*@constant int SHMMNI@*/
1129/*@constant int SHM_R@*/
1130/*@constant int SHM_RDONLY@*/
1131/*@constant int SHM_RND@*/
1132/*@constant int SHMSEG@*/
1133/*@constant int SHM_W@*/
1134/*@constant int SHM_UNLOCK@*/
1135
79127b5d 1136void * shmat (int id, /*@null@*/ void *addr, int flag)
1137 /*@modifies errno@*/ ;
1138
1139extern int shmctl (int id, int cmd, /*@out@*/ struct shmid_ds *buf)
1140 /*@modifies errno, *buf@*/ ;
885824d3 1141
79127b5d 1142extern int shmdt (void *addr)
1143 /*@modifies errno@*/ ;
885824d3 1144
79127b5d 1145extern int shmget (key_t key, int size, int flag)
1146 /*@modifies errno@*/ ;
885824d3 1147
885824d3 1148
79127b5d 1149/*
f9264521 1150** stdio.h - in separte file stdio.h
79127b5d 1151*/
1152
79127b5d 1153/*
1154** syslog.h
1155*/
885824d3 1156
1157/*@constant int LOG_EMERG@*/
1158/*@constant int LOG_ALERT@*/
1159/*@constant int LOG_CRIT@*/
1160/*@constant int LOG_ERR@*/
1161/*@constant int LOG_WARNING@*/
1162/*@constant int LOG_NOTICE@*/
1163/*@constant int LOG_INFO@*/
1164/*@constant int LOG_DEBUG@*/
1165
1166/*@constant int LOG_KERN@*/
1167/*@constant int LOG_USER@*/
1168/*@constant int LOG_MAIL@*/
1169/*@constant int LOG_DAEMON@*/
1170/*@constant int LOG_AUTH@*/
1171/*@constant int LOG_SYSLOG@*/
1172/*@constant int LOG_LPR@*/
1173/*@constant int LOG_NEWS@*/
1174/*@constant int LOG_UUCP@*/
1175/*@constant int LOG_CRON@*/
1176/*@constant int LOG_AUTHPRIV@*/
1177/*@constant int LOG_FTP@*/
1178/*@constant int LOG_LOCAL0@*/
1179/*@constant int LOG_LOCAL1@*/
1180/*@constant int LOG_LOCAL2@*/
1181/*@constant int LOG_LOCAL3@*/
1182/*@constant int LOG_LOCAL4@*/
1183/*@constant int LOG_LOCAL5@*/
1184/*@constant int LOG_LOCAL6@*/
1185/*@constant int LOG_LOCAL7@*/
1186
1187/*@constant int LOG_PID@*/
1188/*@constant int LOG_CONS@*/
1189/*@constant int LOG_ODELAY@*/
1190/*@constant int LOG_NDELAY@*/
1191/*@constant int LOG_NOWAIT@*/
1192/*@constant int LOG_PERROR@*/
1193
d5047b91 1194int LOG_MASK (int pri)
1195 /*@*/;
1196
1197int LOG_UPTO (int pri)
1198 /*@*/;
1199
1200void closelog (void)
1201 /*@modifies fileSystem@*/;
1202
1203void openlog (const char *ident, int logopt, int facility)
1204 /*@modifies fileSystem@*/;
1205
1206int setlogmask (int maskpri)
1207 /*@modifies internalState@*/;
1208
1209void /*@printflike@*/ syslog (int priority, const char *message, ...)
1210 /*@modifies fileSystem@*/;
1211
1212void vsyslog (int priority, const char *message, va_list args)
1213 /*@modifies fileSystem@*/;
885824d3 1214
1215/*________________________________________________________________________
1216 * pwd.h
1217 */
1218
1219 extern extern void
1220endpwent (void)
1221 /*@modifies internalState@*/;
1222
1223 extern /*@null@*/ struct passwd *
1224getpwent (void)
1225 /*@modifies internalState@*/;
1226
1227 extern int
1228setpassent (int stayopen)
1229 /*@modifies internalState@*/;
1230
1231 extern int
1232setpwent (void)
1233 /*@modifies internalState@*/;
1234
f9264521 1235/*
1236** grp.h
1237*/
885824d3 1238
f9264521 1239void endgrent (void) /*@modifies internalState@*/;
885824d3 1240
f9264521 1241/*@null@*/ /*@observer@*/ struct group *getgrent (void)
1242 /*@modifies internalState@*/;
885824d3 1243
f9264521 1244int setgrent (void) /*@modifies internalState@*/;
885824d3 1245
f9264521 1246void setgrfile (const char *name) /*@modifies internalState@*/;
885824d3 1247
f9264521 1248int setgroupent (int stayopen) /*@modifies internalState@*/;
885824d3 1249
1d239d69 1250/*
1251** sys/stat.h
1252**
1253** evans 2001-08-26 - updated from http://www.opengroup.org/onlinepubs/007908799/xsh/sysstat.h.html
1254*/
1255
1256/*
1257** struct stat replaces POSIX version - more required fields in Unix
1258*/
1259
8fe44445 1260/*@-redef@*/ /*@-matchfields@*/
1d239d69 1261struct stat {
1262 dev_t st_dev; /* ID of device containing file */
1263 ino_t st_ino; /* file serial number */
1264 mode_t st_mode; /* mode of file (see below) */
1265 nlink_t st_nlink; /* number of links to the file */
1266 uid_t st_uid; /* user ID of file */
1267 gid_t st_gid; /* group ID of file */
1268 dev_t st_rdev; /* device ID (if file is character or block special) */
1269 off_t st_size; /* file size in bytes (if file is a regular file) */
1270 time_t st_atime; /* time of last access */
1271 time_t st_mtime; /* time of last data modification */
1272 time_t st_ctime; /* time of last status change */
1273 blksize_t st_blksize; /* a filesystem-specific preferred I/O block size for
1274 this object. In some filesystem types, this may
1275 vary from file to file */
1276 blkcnt_t st_blocks; /* number of blocks allocated for this object */
8fe44445 1277} ;
1278/*@=redef@*/ /*@=matchfields@*/
885824d3 1279
1d239d69 1280/*@constant mode_t S_IWUSR@*/
1281/*@constant mode_t S_IXUSR@*/
1282/*@constant mode_t S_IRWXG@*/
1283/*@constant mode_t S_IRGRP@*/
1284/*@constant mode_t S_IWGRP@*/
1285/*@constant mode_t S_IXGRP@*/
1286/*@constant mode_t S_IRWXO@*/
1287/*@constant mode_t S_IROTH@*/
1288/*@constant mode_t S_IWOTH@*/
1289/*@constant mode_t S_IXOTH@*/
1290/*@constant mode_t S_ISUID@*/
1291/*@constant mode_t S_ISGID@*/
1292/*@constant mode_t S_ISVTX@*/
1293
1294# if 0
345671f3 1295/*These are the old definitions - they don't appear to be in the Single UNIX Specification */
1296
885824d3 1297/*@constant int S_ISTXT@*/
1298/*@constant int S_IREAD@*/
1299/*@constant int S_IWRITE@*/
1300/*@constant int S_IEXEC@*/
1301/*@constant int S_IFMT@*/
1302/*@constant int S_IFIFO@*/
1303/*@constant int S_IFCHR@*/
1304/*@constant int S_IFDIR@*/
1305/*@constant int S_IFBLK@*/
1306/*@constant int S_IFREG@*/
1307/*@constant int S_IFLNK@*/
1308/*@constant int S_IFSOCK@*/
1309/*@constant int S_ISVTX@*/
1310/*@constant int S_ISVTX@*/
1311/*@constant int SF_SETTABLE@*/
1312/*@constant int SF_ARCHIVED@*/
1313/*@constant int ACCESSPERMS@*/
1314/*@constant int ALLPERMS@*/
1315/*@constant int DEFFILEMODE@*/
1316/*@constant int S_BLKSIZE@*/
1317/*@constant int SF_IMMUTABLE@*/
1318/*@constant int SF_APPEND@*/
1319/*@constant int UF_NODUMP@*/
1320/*@constant int UF_IMMUTABLE@*/
1321/*@constant int UF_APPEND@*/
1d239d69 1322# endif
885824d3 1323
210066f9 1324int /*@alt _Bool@*/ S_ISBLK (/*@sef@*/ __mode_t m) /*@*/;
1325int /*@alt _Bool@*/ S_ISCHR (/*@sef@*/ __mode_t m) /*@*/;
1326int /*@alt _Bool@*/ S_ISDIR (/*@sef@*/ __mode_t m) /*@*/;
1327int /*@alt _Bool@*/ S_ISFIFO (/*@sef@*/ __mode_t m) /*@*/;
1328int /*@alt _Bool@*/ S_ISREG (/*@sef@*/ __mode_t m) /*@*/;
1329int /*@alt _Bool@*/ S_ISLNK (/*@sef@*/ __mode_t m) /*@*/;
885824d3 1330
0bd4c301 1331int /*@alt _Bool@*/ S_TYPEISMQ (/*@sef@*/ struct stat *buf) /*@*/ ;
1332int /*@alt _Bool@*/ S_TYPEISSEM (/*@sef@*/ struct stat *buf) /*@*/ ;
1333int /*@alt _Bool@*/ S_TYPEISSHM (/*@sef@*/ struct stat *buf) /*@*/ ;
885824d3 1334
1d239d69 1335/* in POSIX: chmod, fstat, mkdir, mkfifo, stat, umask */
885824d3 1336
1d239d69 1337int lstat(const char *, /*@out@*/ struct stat *)
b87215ab 1338 /*:errorcode -1:*/
1339 /*@modifies errno@*/ ;
1340
1d239d69 1341int mknod (const char *, mode_t, dev_t)
1342 /*@warn portability "The only portable use of mknod is to create FIFO-special file. If mode is not S_IFIFO or dev is not 0, the behaviour of mknod() is unspecified."@*/
1343 /*:errorcode -1:*/
1344 /*@modifies errno@*/ ;
885824d3 1345
1d239d69 1346int chflags (const char *path, u_long flags)
1347 /*@warn unixstandard "Not in Single UNIX Specification Version 2"@*/
1348 /*@modifies fileSystem, errno@*/;
1349
1350int fchflags (int fd, u_long flags)
1351 /*@warn unixstandard "Not in Single UNIX Specification Version 2"@*/
1352 /*@modifies fileSystem, errno@*/;
885824d3 1353
b87215ab 1354/* evans 2002-03-17: this was missing, reported by Ralf Wildenhues */
1355int fchmod(int fildes, mode_t mode)
1356 /*@modifies fileSystem, errno@*/ ;
1357
1358/*
1359** sys/statvfs.h
1360** from http://www.opengroup.org/onlinepubs/007908799/xsh/sysstatvfs.h.html
1361*/
1362
1363struct statvfs {
1364 unsigned long f_bsize;
1365 unsigned long f_frsize;
1366 fsblkcnt_t f_blocks;
1367 fsblkcnt_t f_bfree;
1368 fsblkcnt_t f_bavail;
1369 fsfilcnt_t f_files;
1370 fsfilcnt_t f_ffree;
1371 fsfilcnt_t f_favail;
1372 unsigned long f_fsid;
1373 unsigned long f_flag;
1374 unsigned long f_namemax;
1375} ;
1376
1377/*@constant unsigned long ST_RDONLY; @*/
1378/*@constant unsigned long ST_NOSUID; @*/
1379
1380int fstatvfs (int fildes, /*@out@*/ struct statvfs *buf)
1381 /*@modifies buf@*/ ;
1382
1383int statvfs (const char *path, /*@out@*/ struct statvfs *buf)
1384 /*@modifies buf@*/ ;
1385
1386
885824d3 1387/*________________________________________________________________________
1388 * stropts.h
1389 */
1390
1391/*@constant int FMNAMESZ@*/
1392/*@constant int MSG_BAND@*/
1393/*@constant int MSG_HIPRI@*/
1394/*@constant int RS_HIPRI@*/
1395/*@constant int S_INPUT@*/
1396/*@constant int S_RDNORM@*/
1397/*@constant int S_RDBAND@*/
1398/*@constant int S_BANDURG@*/
1399/*@constant int S_HIPRI@*/
1400/*@constant int S_OUTPUT@*/
1401/*@constant int S_WRNORM@*/
1402/*@constant int S_WRBAND@*/
1403/*@constant int S_MSG@*/
1404/*@constant int S_ERROR@*/
1405/*@constant int S_HANGUP@*/
1406
1407 struct strbuf {
1408 int maxlen;
1409 int len;
1410 char *buf;
1411}
1412
1413 struct str_mlist {
1414 char l_name[];
1415}
1416
1417 struct str_list {
1418 int sl_nmods;
1419 struct str_mlist *sl_modlist;
1420}
1421
1422 extern int
1423getmsg (int fd, /*@out@*/ struct strbuf *c, /*@out@*/ struct strbuf *d, int *f)
1424 /*@modifies *c, *d, errno@*/;
1425
1426 extern int
1427getpmsg (int fd, /*@out@*/ struct strbuf *c, /*@out@*/ struct strbuf *d, int *b, int *f)
1428 /*@modifies *b, *c, *d, errno@*/;
1429
1430 extern int
1431putmsg (int fd, const struct strbuf *c, const struct strbuf *d, int *f)
1432 /*@modifies internalState, errno@*/;
1433
dfd82dce 1434extern int putpmsg (int fd, const struct strbuf *c, const struct strbuf *d, int b, int *f)
1435 /*@modifies internalState, errno@*/;
885824d3 1436
f9264521 1437/*
1438** sys/resource.h
1439**
1440** Update 2002-07-09 from
1441** http://www.opengroup.org/onlinepubs/007904975/basedefs/sys/resource.h.html
1442*/
885824d3 1443
885824d3 1444/*@constant int PRIO_PROCESS@*/
1445/*@constant int PRIO_PGRP@*/
1446/*@constant int PRIO_USER@*/
f9264521 1447
1448typedef /*@unsignedintegraltype@*/ rlim_t;
1449
1450/*@constant rlim_t RLIM_INFINITY@*/
1451/*@constant rlim_t RLIM_SAVED_MAX@*/
1452/*@constant rlim_t RLIM_SAVED_CUR@*/
1453
885824d3 1454/*@constant int RUSAGE_SELF@*/
1455/*@constant int RUSAGE_CHILDREN@*/
1456
f9264521 1457struct rlimit {
1458 rlim_t rlim_cur;
1459 rlim_t rlim_max;
885824d3 1460};
1461
f9264521 1462struct rusage {
1463 struct timeval ru_utime; /* user time used */
1464 struct timeval ru_stime; /* system time used */
1465 /* other members optional */
885824d3 1466};
1467
f9264521 1468/*@constant int RLIMIT_CORE@*/
1469/*@constant int RLIMIT_CPU@*/
1470/*@constant int RLIMIT_DATA@*/
1471/*@constant int RLIMIT_FSIZE@*/
1472/*@constant int RLIMIT_NOFILE@*/
1473/*@constant int RLIMIT_STACK@*/
1474/*@constant int RLIMIT_AS@*/
885824d3 1475
f9264521 1476int getpriority (int which, id_t who)
1477 /*@modifies errno@*/;
885824d3 1478
f9264521 1479int getrlimit (int res, /*@out@*/ struct rlimit *rlp)
1480 /*@modifies *rlp, errno@*/;
885824d3 1481
f9264521 1482int getrusage (int who, /*@out@*/ struct rusage *rusage)
1483 /*@modifies *rusage, errno@*/;
885824d3 1484
f9264521 1485int setpriority (int which, id_t who, int prio)
1486 /*@modifies errno, internalState@*/;
885824d3 1487
f9264521 1488int setrlimit (int resource, const struct rlimit *rlp)
1489 /*@modifies errno, internalState@*/;
7272a1c1 1490
1491/*
1492** in <netdb.h>
1493*/
1494
1495struct servent
1496{
1497 /*@observer@*/ char *s_name; /* Official service name. */
1498 /*@observer@*/ char **s_aliases; /* Alias list. */
1499 int s_port; /* Port number. */
1500 /*@observer@*/ char *s_proto; /* Protocol to use. */
1501} ;
1502
1503/*@observer@*/ /*@dependent@*/ /*@null@*/ struct servent *getservbyname (const char *name, /*@null@*/ const char *proto)
1504 /*@warn multithreaded "Unsafe in multithreaded applications, use getsrvbyname_r instead"@*/ ;
1505
1506struct servent *getservbyname_r (const char *name, /*@null@*/ const char *proto, /*@out@*/ /*@returned@*/ struct servent *result, /*@out@*/ char *buffer, int buflen)
1507 /*@requires maxSet (buffer) >= buflen@*/ ;
1508
1509
1510/*@observer@*/ /*@dependent@*/ struct servent *getservbyport (int port, /*@null@*/ const char *proto)
1511 /*@warn multithreaded "Unsafe in multithreaded applications, use getservbyport_r instead"@*/ ;
1512
1513struct servent *getservbyport_r (int port, /*@null@*/ const char *proto, /*@out@*/ /*@returned@*/ struct servent *result, /*@out@*/ char *buffer, int buflen)
1514 /*@requires maxSet (buffer) >= buflen@*/ ;
1515
1516/*@null@*/ struct servent *getservent (void);
1517
1518/*@null@*/ struct servent *getservent_r (struct servent *result, char *buffer, int buflen);
1519
1520int setservent (int stayopen);
7272a1c1 1521int endservent (void);
1522
7272a1c1 1523extern int h_errno;
1524
1525/*@null@*/ /*@observer@*/ struct hostent *gethostbyname (/*@nullterminated@*/ /*@notnull@*/ const char *name)
1526 /*@warn multithreaded "Unsafe in multithreaded applications, use gethostbyname_r instead"@*/
1527 /*@modifies h_errno@*/ ;
1528
1529struct hostent *gethostbyname_r (/*@nullterminated@*/ const char *name, /*@notnull@*/ /*@returned@*/ struct hostent *hent, /*@out@*/ /*@exposed@*/ char *buffer, int bufsize, /*@out@*/ int *h_errnop)
1530 /*@requires maxSet(buffer) >= bufsize@*/ ;
1531
1532/*@null@*/ /*@observer@*/ struct hostent *gethostbyaddr (/*@notnull@*/ const void *addr, size_t addrlen, int type)
8fe44445 1533 /*@requires maxRead(addr) == addrlen@*/ /*:i534 ??? is this right? */
7272a1c1 1534 /*@warn multithreaded "Unsafe in multithreaded applications, use gethostbyaddr_r instead"@*/
1535 /*@modifies h_errno@*/ ;
1536
1537struct hostent *gethostbyaddr_r (/*@notnull@*/ const void *addr, size_t addrlen, int type,
1538 /*@returned@*/ /*@out@*/ struct hostent *hent,
1539 /*@exposed@*/ /*@out@*/ char *buffer, int bufsize, /*@out@*/ int *h_errnop)
8fe44445 1540 /*@requires maxRead(addr) == addrlen /\ maxSet(buffer) >= bufsize@*/
1541 /*:i534 ??? is this right? */ ;
7272a1c1 1542
1543/*@observer@*/ /*@null@*/ struct hostent *gethostent (void)
1544 /*@warn multithreaded "Unsafe in multithreaded applications, use gethostent_r instead"@*/ ;
1545
1546struct hostent *gethostent_r (/*@out@*/ /*@returned@*/ struct hostent *hent, /*@exposed@*/ /*@out@*/ char *buffer, int bufsize)
1547 /*@requires maxSet(buffer) >= bufsize@*/ ;
1548
8fe44445 1549/*:i534 need to annotate these: */
7272a1c1 1550
8fe44445 1551struct hostent *fgethostent(FILE *f);
7272a1c1 1552struct hostent *fgethostent_r(FILE*f, struct hostent *hent, char buffer, int bufsize);
7272a1c1 1553void sethostent(int stayopen);
7272a1c1 1554void endhostent(void);
7272a1c1 1555void herror(const char *string);
7272a1c1 1556char *hstrerror(int err);
1557
1558struct hostent {
1559 /*@observer@*/ /*@nullterminated@*/ char *h_name; /* official name of host */
1560 /*@observer@*/ /*@nullterminated@*/ char * /*:observer@*/ /*:nullterminated@*/ *h_aliases; /* alias list */
1561 int h_addrtype; /* host address type*/
1562 int h_length; /* length ofaddress*/
1563 /*@observer@*/ /*@nullterminated@*/ char * /*:observer@*/ /*:nullterminated@*/ *h_addr_list; /* list of addressesfrom name server */
1564 /*@observer@*/ /*@nullterminated@*/ char *h_addr; /* first address in list (backward compatibility) */
1565} ;
1566
7272a1c1 1567/*
1568** unistd.h
b87215ab 1569** from http://www.opengroup.org/onlinepubs/007908799/xsh/unistd.h.html
7272a1c1 1570*/
1571
b87215ab 1572/*@constant int _POSIX_VERSION@*/
1573/*@constant int _POSIX2_VERSION@*/
1574/*@constant int _POSIX2_C_VERSION@*/
1575/*@constant int _XOPEN_VERSION@*/
1576/*@constant int _XOPEN_XCU_VERSION@*/
1577
1578/* for access: */
1579
1580/*@constant int R_OK@*/
1581/*@constant int W_OK@*/
1582/*@constant int X_OK@*/
1583/*@constant int F_OK@*/
1584
1585/* for confstr: */
1586/*@constant int _CS_PATH@*/
1587/*@constant int _CS_XBS5_ILP32_OFF32_CFLAGS@*/
1588/*@constant int _CS_XBS5_ILP32_OFF32_LDFLAGS@*/
1589/*@constant int _CS_XBS5_ILP32_OFF32_LIBS@*/
1590/*@constant int _CS_XBS5_ILP32_OFF32_LINTFLAGS@*/
1591/*@constant int _CS_XBS5_ILP32_OFFBIG_CFLAGS@*/
1592/*@constant int _CS_XBS5_ILP32_OFFBIG_LDFLAGS@*/
1593/*@constant int _CS_XBS5_ILP32_OFFBIG_LIBS@*/
1594/*@constant int _CS_XBS5_ILP32_OFFBIG_LINTFLAGS@*/
1595/*@constant int _CS_XBS5_LP64_OFF64_CFLAGS@*/
1596/*@constant int _CS_XBS5_LP64_OFF64_LDFLAGS@*/
1597/*@constant int _CS_XBS5_LP64_OFF64_LIBS@*/
1598/*@constant int _CS_XBS5_LP64_OFF64_LINTFLAGS@*/
1599/*@constant int _CS_XBS5_LPBIG_OFFBIG_CFLAGS@*/
1600/*@constant int _CS_XBS5_LPBIG_OFFBIG_LDFLAGS@*/
1601/*@constant int _CS_XBS5_LPBIG_OFFBIG_LIBS@*/
1602/*@constant int _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS@*/
1603
1604/* name parameters to sysconf: */
1605
1606/*@constant int _SC_2_C_BIND@*/
1607/*@constant int _SC_2_C_DEV@*/
1608/*@constant int _SC_2_C_VERSION@*/
1609/*@constant int _SC_2_FORT_DEV@*/
1610/*@constant int _SC_2_FORT_RUN@*/
1611/*@constant int _SC_2_LOCALEDEF@*/
1612/*@constant int _SC_2_SW_DEV@*/
1613/*@constant int _SC_2_UPE@*/
1614/*@constant int _SC_2_VERSION@*/
1615/*@constant int _SC_ARG_MAX@*/
1616/*@constant int _SC_AIO_LISTIO_MAX@*/
1617/*@constant int _SC_AIO_MAX@*/
1618/*@constant int _SC_AIO_PRIO_DELTA_MAX@*/
1619/*@constant int _SC_ASYNCHRONOUS_IO@*/
1620/*@constant int _SC_ATEXIT_MAX@*/
1621/*@constant int _SC_BC_BASE_MAX@*/
1622/*@constant int _SC_BC_DIM_MAX@*/
1623/*@constant int _SC_BC_SCALE_MAX@*/
1624/*@constant int _SC_BC_STRING_MAX@*/
1625/*@constant int _SC_CHILD_MAX@*/
1626/*@constant int _SC_CLK_TCK@*/
1627/*@constant int _SC_COLL_WEIGHTS_MAX@*/
1628/*@constant int _SC_DELAYTIMER_MAX@*/
1629/*@constant int _SC_EXPR_NEST_MAX@*/
1630/*@constant int _SC_FSYNC@*/
1631/*@constant int _SC_GETGR_R_SIZE_MAX@*/
1632/*@constant int _SC_GETPW_R_SIZE_MAX@*/
1633/*@constant int _SC_IOV_MAX@*/
1634/*@constant int _SC_JOB_CONTROL@*/
1635/*@constant int _SC_LINE_MAX@*/
1636/*@constant int _SC_LOGIN_NAME_MAX@*/
1637/*@constant int _SC_MAPPED_FILES@*/
1638/*@constant int _SC_MEMLOCK@*/
1639/*@constant int _SC_MEMLOCK_RANGE@*/
1640/*@constant int _SC_MEMORY_PROTECTION@*/
1641/*@constant int _SC_MESSAGE_PASSING@*/
1642/*@constant int _SC_MQ_OPEN_MAX@*/
1643/*@constant int _SC_MQ_PRIO_MAX@*/
1644/*@constant int _SC_NGROUPS_MAX@*/
1645/*@constant int _SC_OPEN_MAX@*/
1646/*@constant int _SC_PAGESIZE@*/
1647/*@constant int _SC_PAGE_SIZE@*/
1648/*@constant int _SC_PASS_MAX@*/
1649/*@constant int _SC_PRIORITIZED_IO@*/
1650/*@constant int _SC_PRIORITY_SCHEDULING@*/
1651/*@constant int _SC_RE_DUP_MAX@*/
1652/*@constant int _SC_REALTIME_SIGNALS@*/
1653/*@constant int _SC_RTSIG_MAX@*/
1654/*@constant int _SC_SAVED_IDS@*/
1655/*@constant int _SC_SEMAPHORES@*/
1656/*@constant int _SC_SEM_NSEMS_MAX@*/
1657/*@constant int _SC_SEM_VALUE_MAX@*/
1658/*@constant int _SC_SHARED_MEMORY_OBJECTS@*/
1659/*@constant int _SC_SIGQUEUE_MAX@*/
1660/*@constant int _SC_STREAM_MAX@*/
1661/*@constant int _SC_SYNCHRONIZED_IO@*/
1662/*@constant int _SC_THREADS@*/
1663/*@constant int _SC_THREAD_ATTR_STACKADDR@*/
1664/*@constant int _SC_THREAD_ATTR_STACKSIZE@*/
1665/*@constant int _SC_THREAD_DESTRUCTOR_ITERATIONS@*/
1666/*@constant int _SC_THREAD_KEYS_MAX@*/
1667/*@constant int _SC_THREAD_PRIORITY_SCHEDULING@*/
1668/*@constant int _SC_THREAD_PRIO_INHERIT@*/
1669/*@constant int _SC_THREAD_PRIO_PROTECT@*/
1670/*@constant int _SC_THREAD_PROCESS_SHARED@*/
1671/*@constant int _SC_THREAD_SAFE_FUNCTIONS@*/
1672/*@constant int _SC_THREAD_STACK_MIN@*/
1673/*@constant int _SC_THREAD_THREADS_MAX@*/
1674/*@constant int _SC_TIMERS@*/
1675/*@constant int _SC_TIMER_MAX@*/
1676/*@constant int _SC_TTY_NAME_MAX@*/
1677/*@constant int _SC_TZNAME_MAX@*/
1678/*@constant int _SC_VERSION@*/
1679/*@constant int _SC_XOPEN_VERSION@*/
1680/*@constant int _SC_XOPEN_CRYPT@*/
1681/*@constant int _SC_XOPEN_ENH_I18N@*/
1682/*@constant int _SC_XOPEN_SHM@*/
1683/*@constant int _SC_XOPEN_UNIX@*/
1684/*@constant int _SC_XOPEN_XCU_VERSION@*/
1685/*@constant int _SC_XOPEN_LEGACY@*/
1686/*@constant int _SC_XOPEN_REALTIME@*/
1687/*@constant int _SC_XOPEN_REALTIME_THREADS@*/
1688/*@constant int _SC_XBS5_ILP32_OFF32@*/
1689/*@constant int _SC_XBS5_ILP32_OFFBIG@*/
1690/*@constant int _SC_XBS5_LP64_OFF64@*/
1691/*@constant int _SC_XBS5_LPBIG_OFFBIG@*/
1692
1693
1694int access(const char *, int) /*@modifies errno@*/ /*:errorcode -1:*/ ;
1695unsigned int alarm (unsigned int) /*@modifies internalState@*/ ;
1696
1697int brk(void *)
1698 /*@modifies errno@*/
1699 /*:errorcode -1:*/
1700 /*@warn legacy "brk is obsolete"@*/ ;
1701
1702int chdir (const char *)
1703 /*@modifies internalState, errno@*/
1704 /*:errorcode -1:*/ ;
1705
1706int chown (const char *, uid_t, gid_t)
1707 /*@modifies internalState, errno@*/
1708 /*:errorcode -1:*/ ;
1709
1710int close (int)
1711 /*@modifies internalState, errno@*/
1712 /*:errorcode -1:*/ ;
1713
1714size_t confstr(int, /*@null@*/ char *, size_t)
1715 /*@globals internalState@*/
1716 /*@modifies errno@*/
1717 /*:errorcode 0:*/ ;
1718
1719/*@dependent@*/ /*@null@*/ char *crypt(const char *, const char *)
1720 /*@modifies errno, internalState@*/ ;
1721
1722/*@dependent@*/ /*@null@*/ char *ctermid(/*@returned@*/ /*@null@*/ /*@out@*/ char *s)
1723 /*@modifies s@*/ ;
1724
1725/*@null@*/ /*@dependent@*/ char *cuserid (/*@null@*/ /*@returned@*/ char *s)
1726 /*@warn legacy "cuserid is obsolete"@*/
1727 /*@modifies s@*/ ;
1728
1729int dup(int)
1730 /*@modifies errno, internalState@*/
1731 /*:errorcode -1:*/ ;
1732
1733int dup2(int, int)
1734 /*@modifies errno, internalState@*/
1735 /*:errorcode -1:*/ ;
1736
1737void encrypt(char p_block[], int)
1738 /*@requires maxSet(p_block) == 63@*/
1739 /*@modifies p_block, errno@*/ ;
1740
1741extern char **environ;
1742
1743int execl (const char *, const char *, ...)
1744 /*@modifies errno, internalState@*/
1745 /*:errorcode -1:*/ ;
1746
1747int execle(const char *, const char *, ...)
1748 /*@modifies errno, internalState@*/
1749 /*:errorcode -1:*/ ;
1750
1751int execlp(const char *, const char *, ...)
1752 /*@modifies errno, internalState@*/
1753 /*:errorcode -1:*/ ;
1754
1755int execv(const char *, char *const [])
1756 /*@modifies errno, internalState@*/
1757 /*:errorcode -1:*/ ;
1758
1759int execve(const char *, char *const [], char *const [])
1760 /*@modifies errno, internalState@*/
1761 /*:errorcode -1:*/ ;
1762
1763int execvp(const char *, char *const [])
1764 /*@modifies errno, internalState@*/
1765 /*:errorcode -1:*/ ;
1766
1767/*@exits@*/ void _exit (int);
1768
1769int fchown (int, uid_t, gid_t)
1770 /*@modifies errno, fileSystem@*/
1771 /*:errorcode -1:*/ ;
1772
1773int fchdir (int)
1774 /*@modifies errno, fileSystem@*/
1775 /*:errorcode -1:*/ ;
1776
1777int fdatasync (int)
1778 /*@modifies errno, fileSystem@*/
1779 /*:errorcode -1:*/ ;
1780
1781pid_t fork (void)
1782 /*@modifies errno, internalState@*/
1783 /*:errorcode -1:*/ ;
1784
1785long int fpathconf(int, int)
1786 /*@modifies errno, internalState@*/
1787 /*:errorcode -1:*/ ;
1788
1789int fsync(int)
1790 /*@modifies errno, fileSystem@*/
1791 /*:errorcode -1:*/ ;
1792
1793int ftruncate(int, off_t)
1794 /*@modifies errno, fileSystem@*/
1795 /*:errorcode -1:*/ ;
1796
1797/*@null@*/ char *getcwd (/*@returned@*/ char *buf, size_t size)
1798 /*@requires maxSet(buf) >= size;@*/
1799 /*@modifies errno@*/ ;
1800
1801int getdtablesize (void)
1802 /*@warn legacy "getdtablesize is obsolete"@*/ ;
1803
1804gid_t getegid (void) /*@globals internalState*/ ;
1805uid_t geteuid (void) /*@globals internalState*/ ;
1806gid_t getgid (void) /*@globals internalState*/ ;
1807
1808int getgroups (int gidsetsize, gid_t grouplist[])
1809 /*@requires maxSet(grouplist) >= gidsetsize@*/
1810 /*@modifies errno@*/
1811 /*:errorcode -1:*/ ;
1812
1813long gethostid (void) /*@globals internalState@*/ ;
1814
1815/*@null@*/ /*@dependent@*/ char *getlogin (void)
1816 /*@modifies errno@*/ ;
1817
1818int getlogin_r (char *name, size_t namesize)
1819 /*@requires maxSet(name) >= namesize@*/
1820 /*:errorcode !0:*/ ;
1821
1822extern char *optarg;
1823extern int optind;
1824extern int opterr;
1825extern int optopt;
1826
1827int getopt(int, char * const [], const char *)
1828 /*@modifies optind, opterr, optopt, errno@*/
1829 /*:errorcode -1:*/ ;
1830
1831int getpagesize(void)
1832 /*@warn legacy "getpagesize is obsolete"@*/ ;
1833
1834/*@dependent@*/ /*@null@*/ char *getpass(/*@nullterminated@*/ const char *)
1835 /*@warn legacy "getpass is obsolete"@*/ ;
1836
1837pid_t getpgid(pid_t)
1838 /*@modifies errno@*/
1839 /*@globals internalState@*/
1840 /*:errorcode (pid_t)-1:*/ ;
1841
1842pid_t getpgrp(void) /*@globals internalState*/ ;
1843
1844pid_t getpid(void) /*@globals internalState*/ ;
1845pid_t getppid(void) /*@globals internalState*/ ;
1846
1847pid_t getsid(pid_t)
1848 /*@modifies errno@*/
1849 /*@globals internalState@*/
1850 /*:errorcode (pid_t)-1:*/ ;
1851
1852uid_t getuid(void) /*@globals internalState@*/ ;
1853
1854/*@null@*/ char *getwd (/*@returned@*/ char *path_name)
1855 /*@modifies path_name@*/ ;
1856
1857int isatty(int)
1858 /*@globals internalState@*/
1859 /*@modifies errno@*/
1860 /*:errorcode 0:*/ ;
1861
1862int lchown(const char *, uid_t, gid_t)
1863 /*@modifies errno, fileSystem@*/
1864 /*:errorcode -1:*/ ;
1865
1866int link(const char *, const char *)
1867 /*@modifies errno, fileSystem@*/
1868 /*:errorcode -1:*/ ;
1869
1870int lockf(int, int, off_t)
1871 /*@modifies errno, fileSystem@*/
1872 /*:errorcode -1:*/ ;
1873
1874off_t lseek(int, off_t, int)
1875 /*@modifies errno, fileSystem@*/
1876 /*:errorcode (off_t)-1:*/ ;
1877
1878int nice(int)
1879 /*@modifies errno, fileSystem@*/
1880 /*:errorcode -1:*/ ;
1881
1882long int pathconf(const char *, int)
1883 /*@modifies errno, internalState@*/
1884 /*:errorcode -1:*/ ;
1885
1886int pause(void)
1887 /*@modifies errno, internalState@*/
1888 /*:errorcode -1:*/ ;
1889
1890int pipe(int p[])
1891 /*@requires maxRead(p) == 1@*/
1892 /*@modifies errno, fileSystem@*/
1893 /*:errorcode -1:*/ ;
1894
1895ssize_t pread(int, /*@out@*/ void *buf, size_t nbyte, off_t offset)
1896 /*@modifies errno, fileSystem@*/
1897 /*@requires maxSet(buf) >= (nbyte - 1) @*/
1898 /*@ensures maxRead(buf) >= nbyte @*/
1899 /*:errorcode -1:*/ ;
1900
1901int pthread_atfork(void (*)(void), void (*)(void), void(*)(void))
1902 /*@modifies errno, fileSystem@*/
1903 /*:errorcode !0:*/ ;
1904
1905ssize_t pwrite(int, const void *buf, size_t nbyte, off_t)
1906 /*@requires maxRead(buf) >= nbyte@*/
1907 /*@modifies errno, fileSystem@*/
1908 /*:errorcode -1:*/ ;
1909
1910/* ssize_t read(int, void *, size_t); in posix.h */
1911
1912int readlink(const char *, char *buf, size_t bufsize)
1913 /*@requires maxSet(buf) >= (bufsize - 1)@*/
1914 /*@modifies errno, fileSystem, *buf@*/
1915 /*:errorcode -1:*/ ;
1916
1917/* int rmdir(const char *); in posix.h */
1918
1919void *sbrk(intptr_t)
1920 /*@modifies errno@*/
1921 /*:errorcode (void *)-1:*/
1922 /*@warn legacy "sbrk is obsolete"@*/ ;
1923
1924 /* int setgid(gid_t);
1925 int setpgid(pid_t, pid_t);
1926 */
1927
1928pid_t setpgrp(void) /*@modifies internalState@*/ ;
1929
1930int setregid(gid_t, gid_t)
1931 /*@modifies errno, internalState@*/
1932 /*:errorcode -1:*/ ;
1933
1934int setreuid(uid_t, uid_t)
1935 /*@modifies errno, internalState@*/
1936 /*:errorcode -1:*/ ;
1937
1938pid_t setsid(void)
1939 /*@modifies errno, internalState@*/
1940 /*:errorcode (pid_t) -1:*/ ;
1941
1942int setuid(uid_t)
1943 /*@modifies errno, internalState@*/
1944 /*:errorcode -1:*/ ;
1945
1946unsigned int sleep(unsigned int)
1947 /*@modifies systemState@*/ ;
1948
1949void swab(/*@unique@*/ const void *src, /*@unique@*/ void *dest, ssize_t nbytes)
1950 /*@requires maxSet(dest) >= (nbytes - 1)@*/ ;
1951
1952int symlink(const char *, const char *)
1953 /*@modifies errno, fileSystem@*/
1954 /*:errorcode -1:*/ ;
1955
1956void sync(void) /*@modifies systemState@*/ ;
1957
1958long int sysconf(int)
1959 /*@modifies errno, systemState@*/
1960 /*:errorcode -1:*/ ;
1961
1962pid_t tcgetpgrp(int)
1963 /*@globals systemState@*/
1964 /*@modifies errno@*/
1965 /*:errorcode -1:*/ ;
1966
1967int tcsetpgrp(int, pid_t)
1968 /*@modifies errno, systemState@*/
1969 /*:errorcode -1:*/ ;
1970
1971int truncate(const char *, off_t)
1972 /*@modifies errno, fileSystem@*/
1973 /*:errorcode -1:*/ ;
1974
1975/*@dependent@*/ /*@null@*/ char *ttyname(int)
1976 /*@globals systemState@*/
1977 /*@modifies errno@*/
1978 /*:errorcode -1:*/ ;
1979
1980int ttyname_r(int, char *name, size_t namesize)
1981 /*@requires maxSet(name) >= (namesize - 1)@*/ ;
1982 /*:errorcode !0:*/ ;
1983
1984useconds_t ualarm(useconds_t, useconds_t)
1985 /*@modifies systemState@*/ ;
1986
1987int unlink(const char *)
1988 /*@modifies fileSystem, errno@*/
1989 /*:errorcode -1:*/ ;
1990
1991int usleep(useconds_t)
1992 /*@modifies fileSystem, errno@*/
1993 /*:errorcode -1:*/ ;
1994
1995pid_t vfork(void)
1996 /*@modifies fileSystem, errno@*/
1997 /*:errorcode -1:*/ ;
1998
1999 /* in posix.h ssize_t write(int, const void *, size_t); */
2000
2001
7272a1c1 2002int chroot (/*@notnull@*/ /*@nullterminated@*/ const char *path)
b87215ab 2003 /*@modifies internalState, errno@*/
2004 /*:errorcode -1:*/
2005 /*@warn superuser "Only super-user processes may call chroot."@*/ ;
7272a1c1 2006
2007int fchroot (int fildes)
2008 /*:statusreturn@*/
2009 /*@warn superuser "Only super-user processes may call fchroot."@*/ ;
1d239d69 2010
b87215ab 2011
1d239d69 2012/*
2013** ctype.h
2014**
2015** evans 2001-08-26 - added from http://www.opengroup.org/onlinepubs/007908799/xsh/ctype.h.html
2016*/
2017
2018# ifdef STRICT
0bd4c301 2019_Bool isascii(int) /*@*/ ;
2020_Bool toascii(int) /*@*/ ;
1d239d69 2021char _toupper(/*@sef@*/ int) /*@*/ ;
2022char _tolower(/*@sef@*/ int) /*@*/ ;
2023# else
0bd4c301 2024_Bool /*@alt int@*/ isascii(int /*@alt unsigned char@*/) /*@*/ ;
2025_Bool /*@alt int@*/ toascii(int /*@alt unsigned char@*/);
1d239d69 2026char /*@alt int@*/ _toupper(/*@sef@*/ int /*@alt unsigned char@*/);
2027char /*@alt int@*/ _tolower(/*@sef@*/ int /*@alt unsigned char@*/);
2028# endif
2029
2030/* other ctype.h functions in ansi.h */
345671f3 2031
2032/*
2033** stdlib.h
2034**
2035** evans 2001-08-27 - added from http://www.opengroup.org/onlinepubs/007908799/xsh/drand48.html
2036*/
2037
2038double drand48 (void) /*@modifies internalState@*/ ;
8fe44445 2039double erand48 (unsigned short int /*@-fixedformalarray@*/ xsubi[3] /*@=fixedformalarray@*/ )
2040 /*@modifies internalState@*/ ;
2041
345671f3 2042void srand48 (long int seedval) /*@modifies internalState@*/ ;
2043
2044/*
2045** netinet/in.h
2046**
2047** evans 2001-08-27 - added from http://www.opengroup.org/onlinepubs/007908799/xns/netinetin.h.html
2048*/
2049
2050typedef /*@unsignedintegraltype@*/ in_port_t; /* An unsigned integral type of exactly 16 bits. */
2051typedef /*@unsignedintegraltype@*/ in_addr_t; /* An unsigned integral type of exactly 32 bits. */
2052
2a3f24b8 2053/* sa_family_t moved earlier */
345671f3 2054
2055struct in_addr {
2056 in_addr_t s_addr;
2057} ;
2058
2059struct sockaddr_in {
2060 sa_family_t sin_family;
2061 in_port_t sin_port;
2062 struct in_addr sin_addr;
2063 unsigned char sin_zero[8];
2064} ;
2065
2066
2067/* The <netinet/in.h> header defines the following macros for use as values of the level argument of
2068 getsockopt() and setsockopt():
2069 */
2070
2071/*@constant int IPPROTO_IP@*/
2072/*@constant int IPPROTO_ICMP@*/
2073/*@constant int IPPROTO_TCP@*/
2074/*@constant int IPPROTO_UDP@*/
2075
2076/* The <netinet/in.h> header defines the following macros for use as destination addresses for connect(), sendmsg() and sendto():
2077 */
2078
2079/*@constant in_addr_t INADDR_ANY@*/
2080/*@constant in_addr_t INADDR_BROADCAST@*/
2081
8fe44445 2082/*
2083** arpa/inet.h
2084*/
2085
2086in_addr_t htonl (in_addr_t hostlong) /*@*/ ;
2087in_port_t htons (in_port_t hostshort) /*@*/ ;
2088in_addr_t ntohl (in_addr_t netlong) /*@*/ ;
2089in_port_t ntohs (in_port_t netshort) /*@*/ ;
2090
345671f3 2091/*
2092** dirent.h
2093**
2094** evans 2001-08-27 - added from http://www.opengroup.org/onlinepubs/007908799/xsh/dirent.h.html
2095*/
2096
8fe44445 2097/*@-redef@*/ /*@-matchfields@*/ /* Has d_ino field, not in posix (?) */
2098
345671f3 2099struct dirent
2100{
2101 ino_t d_ino;
2102 char d_name[];
8fe44445 2103} ;
2104
2105/*@=redef@*/ /*@=matchfields@*/
345671f3 2106
2107typedef /*@abstract@*/ DIR;
2108
8fe44445 2109/*:i32 need to check annotations on these */
2110
345671f3 2111int closedir (DIR *) /*:errorcode -1*/ ;
86d93ed3 2112/*@null@*/ /*@dependent@*/ DIR *opendir(const char *) /*@modifies errno, fileSystem@*/ ;
d5047b91 2113
2114/* in posix.h: struct dirent *readdir(DIR *); */
2115
2116int readdir_r (DIR *, struct dirent *, /*@out@*/ struct dirent **result)
2117 /*@modifies *result@*/
2118 /*:errorcode !0:*/ ;
2119
345671f3 2120void rewinddir(DIR *);
2121void seekdir(DIR *, long int);
2122long int telldir(DIR *);
2123
2124/*drl added these functions
2125 stpcpy and stpncpy are found on linux but
2126 don't seem to be present on other unixes
2127
2128 thanks to Jeff Johnson for pointing out that
2129 these functions were in the unix library
2130*/
2131
2132/* this function is like strcpy but it reutrns a pointer to the null terminated character in dest instead of the beginning of dest */
2133
2134extern char * stpcpy(/*@out@*/ /*@returned@*/ char * dest, const char * src)
2135 /*@modifies *dest @*/
2136 /*@requires maxSet(dest) >= maxRead(src) @*/
2137 /*@ensures MaxRead(dest) == MaxRead (src) /\ MaxRead(result) == 0 /\ MaxSet(result) == ( maxSet(dest) - MaxRead(src) ); @*/;
2138
2139
2140extern char * stpncpy(/*@out@*/ /*@returned@*/ char * dest,
2141 const char * src, size_t n)
2142 /*@modifies *dest @*/
2143 /*@requires MaxSet(dest) >= ( n - 1 ); @*/ /*@ensures MaxRead (src) >= MaxRead(dest) /\ MaxRead (dest) <= n; @*/
2144 ;
2145
ed309918 2146 /* drl added 09-25-001
2147 Alexander Ma pointed out these were missing
2148 */
2149
ccf415d0 2150int usleep (useconds_t useconds) /*@modifies systemState, errno@*/
2151 /*error -1 sucess 0 */
2152 /* warn opengroup unix specification recommends using setitimer(), timer_create(), timer_delete(), timer_getoverrun(), timer_gettime() or
2153 timer_settime() instead of this interface.
2154 */
2155 ;
2156
e5f31c00 2157
2158 /* drl added 10-27-001 */
86d93ed3 2159 /*not sure what the exact size of this is
e5f31c00 2160 also can IPv6 use this function?
2161 */
86d93ed3 2162 /*I'm going to assume that the address had the format:
2163 "###.###.###.###" which is 16 bytes*/
e5f31c00 2164
86d93ed3 2165 /*@kept@*/ char *inet_ntoa(struct in_addr in)
e5f31c00 2166 /*@ensures maxSet(result) <= 15 /\ maxRead(result) <= 15 @*/
2167 ;
2168
2169
ed309918 2170 extern double hypot(double x, double y) /*@modifies errno@*/ /*error errno only*/;
2171
2172
2173 extern double j0(double x) /*@modifies errno @*/ /*error 0 or NaN */;
2174 extern double j1(double x) /*@modifies errno @*/ /*error 0 or NaN */;
2175 extern double jn(int n, double x) /*@modifies errno @*/ /*error 0 or NaN */;
2176
2177 extern double y0(double x) /*@modifies errno @*/ /*error NaN -HUGE_VAL 0.0 */ ;
2178 extern double y1 (double x) /*@modifies errno @*/ /*error NaN -HUGE_VAL 0.0 */;
2179 extern double yn (int n, double x) /*@modifies errno @*/ /*error NaN -HUGE_VAL 0.0 */;
2180
2181 extern double acosh(double x) /*@modifies errno @*/ /*error errno and implementation-dependent(NaN if present) */ /*error NaN and may errno*/;
2182 extern double asinh(double x) /*@modifies errno @*/ /*error NaN and may errno */;
2183
2184 extern double atanh(double x) /*@modifies errno @*/ /*error errno and implementation-dependent(NaN if present) */ /*error NaN and may errno */ ;
2185
2186 extern double lgamma(double x) /*@modifies errno @*/ /*error NaN or HUGE_VAL may set errno */;
2187
2188 extern int signgam ;
2189
2190 extern double erf(double x) /*@modifies errno @*/ /*error NaN or 0 may set errno */;
2191
2192 extern double erfc (double x) /*@modifies errno @*/ /*error NaN or 0
2193 may set errno */;
2194
2195
2196
2197
2198
2199
This page took 0.365163 seconds and 5 git commands to generate.