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