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