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