]>
Commit | Line | Data |
---|---|---|
885824d3 | 1 | /* |
2 | ** posix.h | |
3 | ** | |
4 | ** This file should be processed with one of the standard libraries | |
5 | ** (standard.h or strict.h) to produce posix.lcd or posixstrict.lcd. | |
6 | */ | |
7 | ||
8 | /*@-nextlinemacros@*/ | |
9 | /*@+allimponly@*/ | |
10 | /*@+globsimpmodifiesnothing@*/ | |
11 | ||
12 | /* | |
13 | * LCLint ISO C + POSIX Library | |
14 | * | |
15 | * $Id$ | |
16 | */ | |
17 | ||
18 | /* | |
19 | * In 1988, IEEE Std 1003.1-1988, commonly known as "POSIX" or the | |
20 | * "IEEE Portable Operating System Interface for Computing Environments" | |
21 | * was published as an American National Standard. In 1990, IEEE Std | |
22 | * 1003.1-1990 was published as an International Standard. The two | |
23 | * standards differ slightly, and where they do, the 1990 International | |
24 | * standard was used for this lclint library. The differences are: | |
25 | * | |
26 | * 1988: cuserid() | |
27 | * 1990: -removed- (but still in this lclint library) | |
28 | * | |
29 | * 1988: int read (int, void*, unsigned int) | |
30 | * 1990: ssize_t read (int, void*, size_t) | |
31 | * | |
32 | * 1988: int write (int, const void*, unsigned int) | |
33 | * 1990: ssize_t write (int, const void*, size_t) | |
34 | * | |
35 | * The other differences are in the semantics of functions. | |
36 | */ | |
37 | ||
38 | /* | |
39 | * The reference for the ISO C part of this library was | |
40 | * Plauger, Brodie's "Standard C - A Reference", Prentice Hall. | |
41 | * The reference for the POSIX part of this library was | |
42 | * Donald Lewine's "POSIX Programmer's Guide", O'Reilly. | |
43 | * Transcription by Jens Schweikhardt <schweikhardt@rus.uni-stuttgart.de> | |
44 | */ | |
45 | ||
46 | /* | |
47 | * Note that Amendment 1 to ISO C was published in 1995 after POSIX was out. | |
48 | * Amendment 1 basically adds support for wide characters and iso 646 | |
49 | * source character sets. In particular, there are three new headers: | |
50 | * <iso646.h>, <wchar.h>, and <wctype.h> | |
51 | */ | |
52 | ||
53 | /* | |
54 | * Each header has annotations in this order: | |
55 | * | |
56 | * 1) type definitions (if any) | |
57 | * 2) constant definitions (if any) | |
58 | * 3) structure definitions (if any) | |
59 | * 4) function prototypes and externals (if any) | |
60 | * | |
61 | * 5) type definitions augmented by POSIX (if any) | |
62 | * 6) constant definitions augmented by POSIX (if any) | |
63 | * 7) structure definitions augmented by POSIX (if any) | |
64 | * 8) function prototypes and externals augmented by POSIX (if any) | |
65 | * | |
66 | * Builtins are mentioned in the header where they appear according to ISO. | |
67 | */ | |
68 | ||
69 | /* | |
70 | ** sys/types.h | |
71 | */ | |
72 | ||
73 | typedef /*@integraltype@*/ dev_t; | |
74 | typedef /*@integraltype@*/ gid_t; | |
75 | typedef /*@integraltype@*/ ino_t; | |
76 | typedef /*@integraltype@*/ mode_t; | |
77 | typedef /*@integraltype@*/ nlink_t; | |
78 | typedef /*@integraltype@*/ off_t; | |
79 | typedef /*@integraltype@*/ pid_t; | |
80 | typedef /*@integraltype@*/ uid_t; | |
81 | ||
82 | /* | |
83 | ** dirent.h | |
84 | */ | |
85 | ||
86 | typedef /*@abstract@*/ /*@mutable@*/ void *DIR; | |
87 | ||
88 | struct dirent { | |
89 | char d_name[]; | |
90 | }; | |
91 | ||
92 | extern int | |
93 | closedir (DIR *dirp) | |
94 | /*@modifies errno@*/; | |
95 | ||
96 | extern /*@null@*/ DIR * | |
97 | opendir (const char *dirname) | |
98 | /*@modifies errno@*/; | |
99 | ||
100 | extern /*@null@*/ struct dirent * | |
101 | readdir (DIR *dirp) | |
102 | /*@modifies errno@*/; | |
103 | ||
104 | extern void | |
105 | rewinddir (DIR *dirp) | |
106 | /*@*/; | |
107 | ||
108 | /* | |
109 | ** errno.h | |
110 | */ | |
111 | ||
112 | /*@constant int E2BIG@*/ | |
113 | /*@constant int EACCES@*/ | |
114 | /*@constant int EAGAIN@*/ | |
115 | /*@constant int EBADF@*/ | |
116 | /*@constant int EBUSY@*/ | |
117 | /*@constant int ECHILD@*/ | |
118 | /*@constant int EDEADLK@*/ | |
119 | /*@constant int EEXIST@*/ | |
120 | /*@constant int EFAULT@*/ | |
121 | /*@constant int EFBIG@*/ | |
122 | /*@constant int EINTR@*/ | |
123 | /*@constant int EINVAL@*/ | |
124 | /*@constant int EIO@*/ | |
125 | /*@constant int EISDIR@*/ | |
126 | /*@constant int EMFILE@*/ | |
127 | /*@constant int EMLINK@*/ | |
128 | /*@constant int ENAMETOOLONG@*/ | |
129 | /*@constant int ENFILE@*/ | |
130 | /*@constant int ENODEV@*/ | |
131 | /*@constant int ENOENT@*/ | |
132 | /*@constant int ENOEXEC@*/ | |
133 | /*@constant int ENOLCK@*/ | |
134 | /*@constant int ENOMEM@*/ | |
135 | /*@constant int ENOSPC@*/ | |
136 | /*@constant int ENOSYS@*/ | |
137 | /*@constant int ENOTDIR@*/ | |
138 | /*@constant int ENOTEMPTY@*/ | |
139 | /*@constant int ENOTTY@*/ | |
140 | /*@constant int ENXIO@*/ | |
141 | /*@constant int EPERM@*/ | |
142 | /*@constant int EPIPE@*/ | |
143 | /*@constant int EROFS@*/ | |
144 | /*@constant int ESPIPE@*/ | |
145 | /*@constant int ESRCH@*/ | |
146 | /*@constant int EXDEV@*/ | |
147 | ||
148 | /* | |
149 | ** fcntl.h | |
150 | */ | |
151 | ||
152 | /*@constant int FD_CLOEXEC@*/ | |
153 | /*@constant int F_DUPFD@*/ | |
154 | /*@constant int F_GETFD@*/ | |
155 | /*@constant int F_GETFL@*/ | |
156 | /*@constant int F_GETLK@*/ | |
157 | /*@constant int F_RDLCK@*/ | |
158 | /*@constant int F_SETFD@*/ | |
159 | /*@constant int F_SETFL@*/ | |
160 | /*@constant int F_SETLK@*/ | |
161 | /*@constant int F_SETLKW@*/ | |
162 | /*@constant int F_UNLCK@*/ | |
163 | /*@constant int F_WRLCK@*/ | |
164 | /*@constant int O_ACCMODE@*/ | |
165 | /*@constant int O_APPEND@*/ | |
166 | /*@constant int O_CREAT@*/ | |
167 | /*@constant int O_EXCL@*/ | |
168 | /*@constant int O_NOCTTY@*/ | |
169 | /*@constant int O_NONBLOCK@*/ | |
170 | /*@constant int O_RDONLY@*/ | |
171 | /*@constant int O_RDWR@*/ | |
172 | /*@constant int O_TRUNC@*/ | |
173 | /*@constant int O_WRONLY@*/ | |
174 | /*@constant int SEEK_CUR@*/ | |
175 | /*@constant int SEEK_END@*/ | |
176 | /*@constant int SEEK_SET@*/ | |
177 | /*@constant int S_IRGRP@*/ | |
178 | /*@constant int S_IROTH@*/ | |
179 | /*@constant int S_IUSR@*/ | |
180 | /*@constant int S_IWXG@*/ | |
181 | /*@constant int S_IWXO@*/ | |
182 | /*@constant int S_IWXU@*/ | |
183 | /*@constant int S_ISGID@*/ | |
184 | /*@constant int S_ISUID@*/ | |
185 | /*@constant int S_IWGRP@*/ | |
186 | /*@constant int S_IWOTH@*/ | |
187 | /*@constant int S_IWUSR@*/ | |
188 | /*@constant int S_IXGRP@*/ | |
189 | /*@constant int S_IXOTH@*/ | |
190 | /*@constant int S_IXUSR@*/ | |
191 | ||
192 | struct flock { | |
193 | short l_type; | |
194 | short l_whence; | |
195 | off_t l_start; | |
196 | off_t l_len; | |
197 | pid_t l_pid; | |
198 | }; | |
199 | ||
200 | extern int | |
201 | creat (const char *path, mode_t mode) | |
202 | /*@modifies errno@*/; | |
203 | ||
204 | extern int | |
205 | fcntl (int fd, int cmd, ...) | |
206 | /*@modifies errno@*/; | |
207 | ||
208 | extern int | |
209 | open (const char *path, int oflag, ...) | |
210 | /*@modifies errno@*/; | |
211 | ||
212 | /* | |
213 | ** grp.h | |
214 | */ | |
215 | ||
216 | struct group { | |
217 | char *gr_name; | |
218 | gid_t gr_gid; | |
219 | char **gr_mem; | |
220 | }; | |
221 | ||
222 | extern /*@null@*/ struct group * | |
223 | getgrgid (gid_t gid) | |
224 | /*@modifies errno@*/; | |
225 | ||
226 | extern /*@null@*/ struct group * | |
227 | getgrnam (const char *nm) | |
228 | /*@modifies errno@*/; | |
229 | ||
230 | /* | |
231 | ** limits.h | |
232 | */ | |
233 | ||
234 | /*@constant long ARG_MAX@*/ | |
235 | /*@constant long CHILD_MAX@*/ | |
236 | /*@constant long LINK_MAX@*/ | |
237 | /*@constant long MAX_CANON@*/ | |
238 | /*@constant long MAX_INPUT@*/ | |
239 | /*@constant long NAME_MAX@*/ | |
240 | /*@constant long NGROUPS_MAX@*/ | |
241 | /*@constant long OPEN_MAX@*/ | |
242 | /*@constant long PIPE_BUF@*/ | |
243 | /*@constant long SSIZE_MAX@*/ | |
244 | /*@constant long STREAM_MAX@*/ | |
245 | /*@constant long TZNAME_MAX@*/ | |
246 | /*@constant long _POSIX_ARG_MAX@*/ | |
247 | /*@constant long _POSIX_CHILD_MAX@*/ | |
248 | /*@constant long _POSIX_LINK_MAX@*/ | |
249 | /*@constant long _POSIX_MAX_CANON@*/ | |
250 | /*@constant long _POSIX_MAX_INPUT@*/ | |
251 | /*@constant long _POSIX_NAME_MAX@*/ | |
252 | /*@constant long _POSIX_NGROUPS_MAX@*/ | |
253 | /*@constant long _POSIX_OPEN_MAX@*/ | |
254 | /*@constant long _POSIX_PATH_MAX@*/ | |
255 | /*@constant long _POSIX_PIPE_BUF@*/ | |
256 | /*@constant long _POSIX_SSIZE@*/ | |
257 | /*@constant long _POSIX_STREAM@*/ | |
258 | /*@constant long _POSIX_TZNAME_MAX@*/ | |
259 | ||
260 | /* | |
261 | ** pwd.h | |
262 | */ | |
263 | ||
264 | struct passwd { | |
265 | char *pw_name; | |
266 | uid_t pw_uid; | |
267 | gid_t pw_gid; | |
268 | char *pw_dir; | |
269 | char *pw_shell; | |
270 | } ; | |
271 | ||
272 | extern /*@observer@*/ /*@null@*/ struct passwd * | |
7bf96067 | 273 | getpwnam (const char *) |
274 | /*@modifies errno@*/ /*@ensures maxRead(result) == 0 /\ maxSet(result) == 0 @*/; | |
885824d3 | 275 | |
276 | extern /*@observer@*/ /*@null@*/ struct passwd * | |
277 | getpwuid (uid_t uid) | |
7bf96067 | 278 | /*@modifies errno@*/ /*@ensures maxRead(result) == 0 /\ maxSet(result) == 0 @*/; |
885824d3 | 279 | |
280 | /* | |
281 | ** setjmp.h | |
282 | */ | |
283 | ||
284 | typedef /*@abstract@*/ /*@mutable@*/ void *sigjmp_buf; | |
285 | ||
286 | extern /*@mayexit@*/ void | |
287 | siglongjmp (sigjmp_buf env, int val) | |
288 | /*@*/; | |
289 | ||
290 | extern int | |
291 | sigsetjmp (/*@out@*/ sigjmp_buf env, int savemask) | |
292 | /*@modifies env@*/; | |
293 | ||
294 | /* | |
295 | ** signal.h | |
296 | */ | |
297 | ||
298 | typedef /*@abstract@*/ sigset_t; | |
299 | ||
300 | /*@constant int SA_NOCLDSTOP@*/ | |
301 | /*@constant int SIG_BLOCK@*/ | |
302 | /*@constant int SIG_SETMASK@*/ | |
303 | /*@constant int SIG_UNBLOCK@*/ | |
304 | /*@constant int SIGALRM@*/ | |
305 | /*@constant int SIGCHLD@*/ | |
306 | /*@constant int SIGCONT@*/ | |
307 | /*@constant int SIGHUP@*/ | |
308 | /*@constant int SIGKILL@*/ | |
309 | /*@constant int SIGPIPE@*/ | |
310 | /*@constant int SIGQUIT@*/ | |
311 | /*@constant int SIGSTOP@*/ | |
312 | /*@constant int SIGTSTP@*/ | |
313 | /*@constant int SIGTTIN@*/ | |
314 | /*@constant int SIGTTOU@*/ | |
315 | /*@constant int SIGUSR1@*/ | |
316 | /*@constant int SIGUSR2@*/ | |
317 | ||
318 | struct sigaction { | |
319 | void (*sa_handler)(); | |
320 | sigset_t sa_mask; | |
321 | int sa_flags; | |
322 | } ; | |
323 | ||
324 | extern /*@mayexit@*/ int | |
325 | kill (pid_t pid, int sig) | |
326 | /*@modifies errno@*/; | |
327 | ||
328 | extern int | |
329 | sigaction (int sig, const struct sigaction *act, /*@out@*/ /*@null@*/ struct sigaction *oact) | |
ccf0a4a8 | 330 | /*@modifies *oact, errno, systemState@*/; |
885824d3 | 331 | |
332 | extern int | |
333 | sigaddset (sigset_t *set, int signo) | |
334 | /*@modifies *set, errno@*/; | |
335 | ||
336 | extern int | |
337 | sigdelset (sigset_t *set, int signo) | |
338 | /*@modifies *set, errno@*/; | |
339 | ||
340 | extern int | |
341 | sigemptyset (/*@out@*/ sigset_t *set) | |
342 | /*@modifies *set, errno@*/; | |
343 | ||
344 | extern int | |
345 | sigfillset (/*@out@*/ sigset_t *set) | |
346 | /*@modifies *set, errno@*/; | |
347 | ||
348 | extern int | |
349 | sigismember (const sigset_t *set, int signo) | |
350 | /*@modifies errno@*/; | |
351 | ||
352 | extern int | |
353 | sigpending (/*@out@*/ sigset_t *set) | |
354 | /*@modifies *set, errno@*/; | |
355 | ||
356 | extern int | |
357 | sigprocmask (int how, /*@null@*/ const sigset_t *set, /*@null@*/ /*@out@*/ sigset_t *oset) | |
ccf0a4a8 | 358 | /*@modifies *oset, errno, systemState@*/; |
885824d3 | 359 | |
360 | extern int | |
361 | sigsuspend (const sigset_t *sigmask) | |
ccf0a4a8 | 362 | /*@modifies errno, systemState@*/; |
885824d3 | 363 | |
364 | /* | |
365 | ** stdio.h | |
366 | */ | |
367 | ||
368 | /*@constant int L_ctermid@*/ | |
369 | /*@constant int L_cuserid@*/ | |
370 | /*@constant int STREAM_MAX@*/ | |
371 | ||
15b3d2b2 | 372 | extern /*@null@*/ /*@dependent@*/ FILE *fdopen (int fd, const char *type) |
373 | /*@modifies errno, fileSystem@*/; | |
885824d3 | 374 | |
15b3d2b2 | 375 | extern int fileno (FILE *fp) /*@modifies errno@*/; |
885824d3 | 376 | |
377 | /* | |
378 | ** sys/stat.h | |
379 | */ | |
380 | ||
381 | /*@constant int S_IRGRP@*/ | |
382 | /*@constant int S_IROTH@*/ | |
383 | /*@constant int S_IUSR@*/ | |
384 | /*@constant int S_IWXG@*/ | |
385 | /*@constant int S_IWXO@*/ | |
386 | /*@constant int S_IWXU@*/ | |
387 | /*@constant int S_ISGID@*/ | |
388 | /*@constant int S_ISUID@*/ | |
389 | /*@constant int S_IWGRP@*/ | |
390 | /*@constant int S_IWOTH@*/ | |
391 | /*@constant int S_IWUSR@*/ | |
392 | /*@constant int S_IXGRP@*/ | |
393 | /*@constant int S_IXOTH@*/ | |
394 | /*@constant int S_IXUSR@*/ | |
395 | ||
396 | struct stat { | |
397 | mode_t st_mode; | |
398 | ino_t st_ino; | |
399 | dev_t st_dev; | |
400 | nlink_t st_nlink; | |
401 | uid_t st_uid; | |
402 | gid_t st_gid; | |
403 | off_t st_size; | |
404 | time_t st_st_atime; | |
405 | time_t st_st_mtime; | |
406 | time_t st_st_ctime; | |
407 | } ; | |
408 | ||
409 | /* | |
410 | ** POSIX does not require that the S_I* be functions. They're | |
411 | ** macros virtually everywhere. | |
412 | */ | |
413 | ||
414 | # ifdef STRICT | |
415 | /*@notfunction@*/ | |
416 | # define SBOOLINT lltX_bool /*@alt int@*/ | |
417 | # else | |
418 | /*@notfunction@*/ | |
419 | # define SBOOLINT lltX_bool | |
420 | # endif | |
421 | ||
422 | extern SBOOLINT S_ISBLK (/*@sef@*/ mode_t m) /*@*/ ; | |
423 | ||
424 | extern SBOOLINT S_ISCHR (/*@sef@*/ mode_t m) /*@*/ ; | |
425 | ||
426 | extern SBOOLINT S_ISDIR (/*@sef@*/ mode_t m) /*@*/ ; | |
427 | ||
428 | extern SBOOLINT S_ISFIFO (/*@sef@*/ mode_t m) /*@*/ ; | |
429 | ||
430 | extern SBOOLINT S_ISREG (/*@sef@*/ mode_t m) /*@*/ ; | |
431 | ||
432 | extern int chmod (const char *path, mode_t mode) | |
433 | /*@modifies fileSystem, errno@*/ ; | |
434 | ||
435 | extern int fstat (int fd, /*@out@*/ struct stat *buf) | |
436 | /*@modifies errno, *buf@*/ ; | |
437 | ||
438 | extern int | |
439 | mkdir (const char *path, mode_t mode) | |
440 | /*@modifies fileSystem, errno@*/; | |
441 | ||
442 | extern int | |
443 | mkfifo (const char *path, mode_t mode) | |
444 | /*@modifies fileSystem, errno@*/; | |
445 | ||
446 | extern int | |
447 | stat (const char *path, /*@out@*/ struct stat *buf) | |
448 | /*@modifies errno, *buf@*/; | |
449 | ||
450 | extern int | |
451 | umask (mode_t cmask) | |
ccf0a4a8 | 452 | /*@modifies systemState@*/; |
885824d3 | 453 | |
454 | /* | |
455 | ** sys/times.h | |
456 | */ | |
457 | ||
458 | struct tms { | |
459 | clock_t tms_utime; | |
460 | clock_t tms_stime; | |
461 | clock_t tms_cutime; | |
462 | clock_t tms_cstime; | |
463 | }; | |
464 | ||
465 | extern clock_t | |
466 | times (/*@out@*/ struct tms *tp) | |
467 | /*@modifies *tp@*/; | |
468 | ||
469 | /* | |
470 | ** sys/utsname.h | |
471 | */ | |
472 | ||
473 | struct utsname { | |
474 | char sysname[]; | |
475 | char nodename[]; | |
476 | char release[]; | |
477 | char version[]; | |
478 | char machine[]; | |
479 | }; | |
480 | ||
481 | extern int | |
482 | uname (/*@out@*/ struct utsname *name) | |
483 | /*@modifies *name, errno@*/ ; | |
484 | ||
485 | /* | |
486 | ** sys/wait.h | |
487 | */ | |
488 | ||
489 | extern int WEXITSTATUS (int status) /*@*/ ; | |
490 | extern int WIFEXITED (int status) /*@*/ ; | |
491 | extern int WIFSIGNALED (int status) /*@*/ ; | |
492 | extern int WIFSTOPPED (int status) /*@*/ ; | |
493 | extern int WSTOPSIG (int status) /*@*/ ; | |
494 | extern int WTERMSIG (int status) /*@*/ ; | |
495 | ||
496 | /*@constant int WUNTRACED@*/ | |
497 | ||
ccf0a4a8 | 498 | pid_t wait (/*@out@*/ /*@null@*/ int *st) |
499 | /*@modifies *st, errno, systemState@*/; | |
885824d3 | 500 | |
ccf0a4a8 | 501 | pid_t waitpid (pid_t pid, /*@out@*/ /*@null@*/ int *st, int opt) |
502 | /*@modifies *st, errno, systemState@*/; | |
885824d3 | 503 | |
504 | /* | |
505 | ** termios.h | |
506 | */ | |
507 | ||
508 | typedef unsigned char /*@alt unsigned short@*/ cc_t; | |
509 | typedef unsigned long /*@alt long@*/ speed_t; | |
510 | typedef unsigned long /*@alt long@*/ tcflag_t; | |
511 | ||
512 | /*@constant int B0@*/ | |
513 | /*@constant int B50@*/ | |
514 | /*@constant int B75@*/ | |
515 | /*@constant int B110@*/ | |
516 | /*@constant int B134@*/ | |
517 | /*@constant int B150@*/ | |
518 | /*@constant int B200@*/ | |
519 | /*@constant int B300@*/ | |
520 | /*@constant int B600@*/ | |
521 | /*@constant int B1200@*/ | |
522 | /*@constant int B1800@*/ | |
523 | /*@constant int B2400@*/ | |
524 | /*@constant int B4800@*/ | |
525 | /*@constant int B9600@*/ | |
526 | /*@constant int B19200@*/ | |
527 | /*@constant int B38400@*/ | |
528 | /*@constant int BRKINT@*/ | |
529 | /*@constant int CLOCAL@*/ | |
530 | /*@constant int CREAD@*/ | |
531 | /*@constant int CS5@*/ | |
532 | /*@constant int CS6@*/ | |
533 | /*@constant int CS7@*/ | |
534 | /*@constant int CS8@*/ | |
535 | /*@constant int CSIZE@*/ | |
536 | /*@constant int CSTOPB@*/ | |
537 | /*@constant int ECHO@*/ | |
538 | /*@constant int ECHOE@*/ | |
539 | /*@constant int ECHOK@*/ | |
540 | /*@constant int ECHONL@*/ | |
541 | /*@constant int HUPCL@*/ | |
542 | /*@constant int ICANON@*/ | |
543 | /*@constant int ICRNL@*/ | |
544 | /*@constant int IEXTEN@*/ | |
545 | /*@constant int IGNBRK@*/ | |
546 | /*@constant int IGNCR@*/ | |
547 | /*@constant int IGNPAR@*/ | |
548 | /*@constant int IGNLCR@*/ | |
549 | /*@constant int INPCK@*/ | |
550 | /*@constant int ISIG@*/ | |
551 | /*@constant int ISTRIP@*/ | |
552 | /*@constant int IXOFF@*/ | |
553 | /*@constant int IXON@*/ | |
554 | /*@constant int NCCS@*/ | |
555 | /*@constant int NOFLSH@*/ | |
556 | /*@constant int OPOST@*/ | |
557 | /*@constant int PARENB@*/ | |
558 | /*@constant int PARMRK@*/ | |
559 | /*@constant int PARODD@*/ | |
560 | /*@constant int TCIFLUSH@*/ | |
561 | /*@constant int TCIOFF@*/ | |
562 | /*@constant int TCIOFLUSH@*/ | |
563 | /*@constant int TCION@*/ | |
564 | /*@constant int TCOFLUSH@*/ | |
565 | /*@constant int TCSADRAIN@*/ | |
566 | /*@constant int TCSAFLUSH@*/ | |
567 | /*@constant int TCSANOW@*/ | |
568 | /*@constant int TOSTOP@*/ | |
569 | /*@constant int VEOF@*/ | |
570 | /*@constant int VEOL@*/ | |
571 | /*@constant int VERASE@*/ | |
572 | /*@constant int VINTR@*/ | |
573 | /*@constant int VKILL@*/ | |
574 | /*@constant int VMIN@*/ | |
575 | /*@constant int VQUIT@*/ | |
576 | /*@constant int VSTART@*/ | |
577 | /*@constant int VSTOP@*/ | |
578 | /*@constant int VSUSP@*/ | |
579 | /*@constant int VTIME@*/ | |
580 | ||
581 | struct termios { | |
582 | tcflag_t c_iflag; | |
583 | tcflag_t c_oflag; | |
584 | tcflag_t c_cflag; | |
585 | tcflag_t c_lflag; | |
586 | cc_t c_cc; | |
587 | } ; | |
588 | ||
589 | extern speed_t | |
590 | cfgetispeed (const struct termios *p) | |
591 | /*@*/; | |
592 | ||
593 | extern speed_t | |
594 | cfgetospeed (const struct termios *p) | |
595 | /*@*/; | |
596 | ||
597 | extern int | |
598 | cfsetispeed (struct termios *p) | |
599 | /*@modifies *p@*/; | |
600 | ||
601 | extern int | |
602 | cfsetospeed (struct termios *p) | |
603 | /*@modifies *p@*/; | |
604 | ||
605 | extern int | |
606 | tcdrain (int fd) | |
607 | /*@modifies errno@*/; | |
608 | ||
609 | extern int | |
610 | tcflow (int fd, int action) | |
611 | /*@modifies errno@*/; | |
612 | ||
613 | extern int | |
614 | tcflush (int fd, int qs) | |
615 | /*@modifies errno@*/; | |
616 | ||
617 | extern int | |
618 | tcgetattr (int fd, /*@out@*/ struct termios *p) | |
619 | /*@modifies errno, *p@*/; | |
620 | ||
621 | extern int | |
622 | tcsendbreak (int fd, int d) | |
623 | /*@modifies errno@*/; | |
624 | ||
625 | extern int | |
626 | tcsetattr (int fd, int opt, const struct termios *p) | |
627 | /*@modifies errno@*/; | |
628 | ||
629 | /* | |
630 | ** time.h | |
631 | */ | |
632 | ||
633 | /* Environ must be known before it can be used in `globals' clauses. */ | |
634 | ||
635 | /*@unchecked@*/ extern char **environ; | |
636 | ||
637 | /*@constant int CLK_TCK@*/ | |
638 | ||
639 | extern void | |
640 | tzset (void) | |
ccf0a4a8 | 641 | /*@globals environ@*/ /*@modifies systemState@*/; |
885824d3 | 642 | |
643 | /* | |
644 | ** unistd.h | |
645 | */ | |
646 | ||
647 | /*@constant int F_OK@*/ | |
648 | /*@constant int R_OK@*/ | |
649 | /*@constant int SEEK_CUR@*/ | |
650 | /*@constant int SEEK_END@*/ | |
651 | /*@constant int SEEK_SET@*/ | |
652 | /*@constant int STDERR_FILENO@*/ | |
653 | /*@constant int STDIN_FILENO@*/ | |
654 | /*@constant int STDOUT_FILENO@*/ | |
655 | /*@constant int W_OK@*/ | |
656 | /*@constant int X_OK@*/ | |
657 | /*@constant int _PC_CHOWN_RESTRUCTED@*/ | |
658 | /*@constant int _PC_MAX_CANON@*/ | |
659 | /*@constant int _PC_MAX_INPUT@*/ | |
660 | /*@constant int _PC_NAME_MAX@*/ | |
661 | /*@constant int _PC_NO_TRUNC@*/ | |
662 | /*@constant int _PC_PATH_MAX@*/ | |
663 | /*@constant int _PC_PIPE_BUF@*/ | |
664 | /*@constant int _PC_VDISABLE@*/ | |
665 | /*@constant int _POSIX_CHOWN_RESTRICTED@*/ | |
666 | /*@constant int _POSIX_JOB_CONTROL@*/ | |
667 | /*@constant int _POSIX_NO_TRUNC@*/ | |
668 | /*@constant int _POSIX_SAVED_IDS@*/ | |
669 | /*@constant int _POSIX_VDISABLE@*/ | |
670 | /*@constant int _POSIX_VERSION@*/ | |
671 | /*@constant int _SC_ARG_MAX@*/ | |
672 | /*@constant int _SC_CHILD_MAX@*/ | |
673 | /*@constant int _SC_CLK_TCK@*/ | |
674 | /*@constant int _SC_JOB_CONTROL@*/ | |
675 | /*@constant int _SC_NGROUPS_MAX@*/ | |
676 | /*@constant int _SC_OPEN_MAX@*/ | |
677 | /*@constant int _SC_SAVED_IDS@*/ | |
678 | /*@constant int _SC_STREAM_MAX@*/ | |
679 | /*@constant int _SC_TZNAME_MAX@*/ | |
680 | /*@constant int _SC_VERSION@*/ | |
681 | ||
682 | extern /*@exits@*/ void | |
683 | _exit (int status) | |
684 | /*@*/; | |
685 | ||
686 | extern int | |
687 | access (const char *path, int mode) | |
688 | /*@modifies errno@*/; | |
689 | ||
690 | extern unsigned int | |
691 | alarm (unsigned int) | |
ccf0a4a8 | 692 | /*@modifies systemState@*/; |
885824d3 | 693 | |
694 | extern int | |
695 | chdir (const char *path) | |
696 | /*@modifies errno@*/; | |
697 | ||
698 | extern int | |
699 | chown (const char *path, uid_t owner, gid_t group) | |
700 | /*@modifies fileSystem, errno@*/; | |
701 | ||
702 | extern int | |
703 | close (int fd) | |
ccf0a4a8 | 704 | /*@modifies fileSystem, errno, systemState@*/; |
885824d3 | 705 | /* state: record locks are unlocked */ |
706 | ||
707 | extern char * | |
708 | ctermid (/*@returned@*/ /*@out@*/ /*@null@*/ char *s) | |
ccf0a4a8 | 709 | /*@modifies *s, systemState@*/; |
885824d3 | 710 | |
711 | /* cuserid is in the 1988 version of POSIX but removed in 1990 */ | |
712 | extern char * | |
713 | cuserid (/*@null@*/ /*@out@*/ char *s) | |
714 | /*@modifies *s@*/; | |
715 | ||
716 | extern int | |
717 | dup2 (int fd, int fd2) | |
718 | /*@modifies errno, fileSystem@*/; | |
719 | ||
720 | extern int | |
721 | dup (int fd) | |
722 | /*@modifies errno, fileSystem@*/; | |
723 | ||
724 | extern /*@mayexit@*/ int | |
725 | execl (const char *path, const char *arg, ...) | |
726 | /*@modifies errno@*/; | |
727 | ||
728 | extern /*@mayexit@*/ int | |
729 | execle (const char *file, const char *arg, ...) | |
730 | /*@modifies errno@*/; | |
731 | ||
732 | extern /*@mayexit@*/ int | |
733 | execlp (const char *file, const char *arg, ...) | |
734 | /*@modifies errno@*/; | |
735 | ||
736 | extern /*@mayexit@*/ int | |
737 | execv (const char *path, char *const argv[]) | |
738 | /*@modifies errno@*/; | |
739 | ||
740 | extern /*@mayexit@*/ int | |
741 | execve (const char *path, char *const argv[], char *const *envp) | |
742 | /*@modifies errno@*/; | |
743 | ||
744 | extern /*@mayexit@*/ int | |
745 | execvp (const char *file, char *const argv[]) | |
746 | /*@modifies errno@*/; | |
747 | ||
748 | extern pid_t | |
749 | fork (void) | |
750 | /*@modifies fileSystem, errno@*/; | |
751 | ||
752 | extern long | |
753 | fpathconf (int fd, int name) | |
754 | /*@modifies errno@*/; | |
755 | ||
756 | extern char * | |
757 | getcwd (/*@returned@*/ /*@out@*/ char *buf, size_t size) | |
758 | /*@modifies errno, *buf@*/; | |
759 | ||
760 | extern gid_t | |
761 | getegid (void) | |
762 | /*@*/; | |
763 | ||
764 | extern uid_t | |
765 | geteuid (void) | |
766 | /*@*/; | |
767 | ||
768 | extern gid_t | |
769 | getgid (void) | |
770 | /*@*/; | |
771 | ||
772 | extern int | |
773 | getgroups (int gs, /*@out@*/ gid_t gl[]) | |
774 | /*@modifies errno, gl[]@*/; | |
775 | ||
776 | extern /*@observer@*/ char * | |
777 | getlogin (void) | |
778 | /*@*/; | |
779 | ||
780 | extern pid_t | |
781 | getpgrp (void) | |
782 | /*@*/; | |
783 | ||
784 | extern pid_t | |
785 | getpid (void) | |
786 | /*@*/; | |
787 | ||
788 | extern pid_t | |
789 | getppid (void) | |
790 | /*@*/; | |
791 | ||
792 | extern uid_t | |
793 | getuid (void) | |
794 | /*@*/; | |
795 | ||
796 | extern int | |
797 | isatty (int fd) | |
798 | /*@*/; | |
799 | ||
800 | extern int | |
801 | link (const char *o, const char *n) | |
802 | /*@modifies errno, fileSystem@*/; | |
803 | ||
804 | extern off_t | |
805 | lseek (int fd, off_t offset, int whence) | |
806 | /*@modifies errno@*/; | |
807 | ||
808 | extern long | |
809 | pathconf (const char *path, int name) | |
810 | /*@modifies errno@*/; | |
811 | ||
812 | extern int | |
813 | pause (void) | |
814 | /*@modifies errno@*/; | |
815 | ||
816 | extern int | |
817 | pipe (/*@out@*/ int fd[]) /* Out parameter noticed by Marc Espie. */ | |
818 | /*@modifies errno@*/; | |
819 | ||
15b3d2b2 | 820 | extern ssize_t read (int fd, /*@out@*/ void *buf, size_t nbyte) |
821 | /*@modifies errno, *buf@*/ /*@requires maxSet(buf) >= (nbyte - 1) @*/ | |
822 | /*@ensures maxRead(buf) >= nbyte @*/ ; | |
885824d3 | 823 | |
15b3d2b2 | 824 | extern int rmdir (const char *path) |
825 | /*@modifies fileSystem, errno@*/; | |
885824d3 | 826 | |
15b3d2b2 | 827 | extern int setgid (gid_t gid) |
828 | /*@modifies errno, systemState@*/; | |
885824d3 | 829 | |
15b3d2b2 | 830 | extern int setpgid (pid_t pid, pid_t pgid) |
831 | /*@modifies errno, systemState@*/; | |
885824d3 | 832 | |
15b3d2b2 | 833 | extern pid_t setsid (void) /*@modifies systemState@*/; |
834 | ||
835 | extern int setuid (uid_t uid) | |
836 | /*@modifies errno, systemState@*/; | |
885824d3 | 837 | |
ccf0a4a8 | 838 | unsigned int sleep (unsigned int sec) /*@modifies systemState@*/ ; |
885824d3 | 839 | |
15b3d2b2 | 840 | extern long sysconf (int name) |
841 | /*@modifies errno@*/; | |
885824d3 | 842 | |
15b3d2b2 | 843 | extern pid_t tcgetpgrp (int fd) |
844 | /*@modifies errno@*/; | |
885824d3 | 845 | |
15b3d2b2 | 846 | extern int tcsetpgrp (int fd, pid_t pgrpid) |
847 | /*@modifies errno, systemState@*/; | |
885824d3 | 848 | |
15b3d2b2 | 849 | /* Q: observer ok? */ |
850 | extern /*@null@*/ /*@observer@*/ char *ttyname (int fd) | |
851 | /*@modifies errno@*/; | |
885824d3 | 852 | |
15b3d2b2 | 853 | extern int unlink (const char *path) |
854 | /*@modifies fileSystem, errno@*/; | |
885824d3 | 855 | |
15b3d2b2 | 856 | extern ssize_t write (int fd, const void *buf, size_t nbyte) |
857 | /*@modifies errno@*/; | |
885824d3 | 858 | |
859 | /* | |
860 | ** utime.h | |
861 | */ | |
862 | ||
863 | struct utimbuf { | |
864 | time_t actime; | |
865 | time_t modtime; | |
866 | } ; | |
867 | ||
868 | extern int | |
869 | utime (const char *path, /*@null@*/ const struct utimbuf *times) | |
870 | /*@modifies fileSystem, errno@*/; | |
871 | ||
b072092f | 872 | /* |
873 | ** regex.h | |
874 | */ | |
875 | ||
876 | typedef /*@abstract@*/ /*@mutable@*/ void *regex_t; | |
877 | typedef /*@integraltype@*/ regoff_t; | |
878 | ||
879 | typedef struct | |
880 | { | |
881 | regoff_t rm_so; | |
882 | regoff_t rm_eo; | |
883 | } regmatch_t; | |
884 | ||
885 | int regcomp (/*@out@*/ regex_t *preg, /*@nullterminated@*/ const char *regex, int cflags) | |
886 | /*:statusreturn@*/ | |
887 | /*@modifies preg@*/ ; | |
888 | ||
889 | int regexec (const regex_t *preg, /*@nullterminated@*/ const char *string, size_t nmatch, /*@out@*/ regmatch_t pmatch[], int eflags) | |
890 | /*@requires maxSet(pmatch) >= nmatch@*/ | |
891 | /*@modifies pmatch@*/ ; | |
892 | ||
893 | size_t regerror (int errcode, const regex_t *preg, /*@out@*/ char *errbuf, size_t errbuf_size) | |
894 | /*@requires maxSet(errbuf) >= errbuf_size@*/ | |
895 | /*@modifies errbuf@*/ ; | |
896 | ||
897 | void regfree (/*@only@*/ regex_t *preg) ; | |
898 | ||
899 | /* regcomp flags */ | |
900 | /*@constant int REG_BASIC@*/ | |
901 | /*@constant int REG_EXTENDED@*/ | |
902 | /*@constant int REG_ICASE@*/ | |
903 | /*@constant int REG_NOSUB@*/ | |
904 | /*@constant int REG_NEWLINE@*/ | |
905 | /*@constant int REG_NOSPEC@*/ | |
906 | /*@constant int REG_PEND@*/ | |
907 | /*@constant int REG_DUMP@*/ | |
908 | ||
909 | /* regerror flags */ | |
910 | /*@constant int REG_NOMATCH@*/ | |
911 | /*@constant int REG_BADPAT@*/ | |
912 | /*@constant int REG_ECOLLATE@*/ | |
913 | /*@constant int REG_ECTYPE@*/ | |
914 | /*@constant int REG_EESCAPE@*/ | |
915 | /*@constant int REG_ESUBREG@*/ | |
916 | /*@constant int REG_EBRACK@*/ | |
917 | /*@constant int REG_EPAREN@*/ | |
918 | /*@constant int REG_EBRACE@*/ | |
919 | /*@constant int REG_BADBR@*/ | |
920 | /*@constant int REG_ERANGE@*/ | |
921 | /*@constant int REG_ESPACE@*/ | |
922 | /*@constant int REG_BADRPT@*/ | |
923 | /*@constant int REG_EMPTY@*/ | |
924 | /*@constant int REG_ASSERT@*/ | |
925 | /*@constant int REG_INVARG@*/ | |
926 | /*@constant int REG_ATOI@*/ /* non standard */ | |
927 | /*@constant int REG_ITOA@*/ /* non standard */ | |
928 | ||
929 | /* regexec flags */ | |
930 | /*@constant int REG_NOTBOL@*/ | |
931 | /*@constant int REG_NOTEOL@*/ | |
932 | /*@constant int REG_STARTEND@*/ | |
933 | /*@constant int REG_TRACE@*/ | |
934 | /*@constant int REG_LARGE@*/ | |
935 | /*@constant int REG_BACKR@*/ | |
936 | ||
ccf0a4a8 | 937 |