2 |
- |
1 |
#ifndef __UNISTD_H
|
|
|
2 |
#define __UNISTD_H
|
|
|
3 |
#ifndef _POSIX_SOURCE
|
|
|
4 |
This header file is not defined in pure ANSI
|
|
|
5 |
#endif
|
|
|
6 |
#pragma lib "/$M/lib/ape/libap.a"
|
|
|
7 |
|
|
|
8 |
#define _POSIX_VERSION 199309L
|
|
|
9 |
#define _POSIX_ASYNC_IO -1
|
|
|
10 |
#define _POSIX_CHOWN_RESTRICTED 1
|
|
|
11 |
#define _POSIX_NO_TRUNC 1
|
|
|
12 |
#define _POSIX_PRIO_IO -1
|
|
|
13 |
#define _POSIX_SYNC_IO -1
|
|
|
14 |
#define _POSIX_VDISABLE -1
|
|
|
15 |
|
|
|
16 |
#ifndef _SIZE_T
|
|
|
17 |
#define _SIZE_T
|
|
|
18 |
typedef unsigned long size_t;
|
|
|
19 |
#endif
|
|
|
20 |
#ifndef _SSIZE_T
|
|
|
21 |
#define _SSIZE_T
|
|
|
22 |
typedef long ssize_t;
|
|
|
23 |
#endif
|
|
|
24 |
#ifndef NULL
|
|
|
25 |
#ifndef NULL
|
|
|
26 |
#ifdef __cplusplus
|
|
|
27 |
#define NULL 0
|
|
|
28 |
#else
|
|
|
29 |
#define NULL ((void*)0)
|
|
|
30 |
#endif
|
|
|
31 |
#endif
|
|
|
32 |
#endif
|
|
|
33 |
|
|
|
34 |
/* access */
|
|
|
35 |
#define R_OK 4
|
|
|
36 |
#define W_OK 2
|
|
|
37 |
#define X_OK 1
|
|
|
38 |
#define F_OK 0 /* test for existence */
|
|
|
39 |
|
|
|
40 |
/* lockf */
|
|
|
41 |
#define F_ULOCK 0 /* unlock a previously locked region */
|
|
|
42 |
#define F_LOCK 1 /* lock a region for exclusive use */
|
|
|
43 |
#define F_TLOCK 2 /* test and lock a region for exclusive use */
|
|
|
44 |
#define F_TEST 3 /* test a region for a previous lock */
|
|
|
45 |
|
|
|
46 |
/* lseek */
|
|
|
47 |
#ifndef SEEK_SET /* also defined in stdio.h */
|
|
|
48 |
#define SEEK_SET 0
|
|
|
49 |
#define SEEK_CUR 1
|
|
|
50 |
#define SEEK_END 2
|
|
|
51 |
#endif
|
|
|
52 |
|
|
|
53 |
/* sysconf argument */
|
|
|
54 |
#define _SC_ARG_MAX 1 /* max chars in args to exec */
|
|
|
55 |
#define _SC_CHILD_MAX 2 /* max child process per process */
|
|
|
56 |
#define _SC_CLK_TCK 3 /* number of clock() units per second */
|
|
|
57 |
#define _SC_NGROUPS_MAX 4 /* max supplementary groups per process */
|
|
|
58 |
#define _SC_OPEN_MAX 5
|
|
|
59 |
#define _SC_STREAM_MAX 6
|
|
|
60 |
#define _SC_TZNAME_MAX 7
|
|
|
61 |
#define _SC_JOB_CONTROL 8 /* posix job control */
|
|
|
62 |
#define _SC_SAVED_IDS 9 /* saved suid/sgid per process */
|
|
|
63 |
#define _SC_VERSION 10 /* this version */
|
|
|
64 |
#define _SC_LOGIN_NAME_MAX 11 /* max length of a login name */
|
|
|
65 |
|
|
|
66 |
/* pathconf argument */
|
|
|
67 |
#define _PC_LINK_MAX 1
|
|
|
68 |
#define _PC_MAX_CANON 2
|
|
|
69 |
#define _PC_MAX_INPUT 3
|
|
|
70 |
#define _PC_NAME_MAX 4
|
|
|
71 |
#define _PC_PATH_MAX 5
|
|
|
72 |
#define _PC_PIPE_BUF 6
|
|
|
73 |
#define _PC_CHOWN_RESTRICTED 7
|
|
|
74 |
#define _PC_NO_TRUNC 8
|
|
|
75 |
#define _PC_VDISABLE 9
|
|
|
76 |
|
|
|
77 |
/* standard filenos */
|
|
|
78 |
#define STDIN_FILENO 0
|
|
|
79 |
#define STDOUT_FILENO 1
|
|
|
80 |
#define STDERR_FILENO 2
|
|
|
81 |
|
|
|
82 |
#ifdef __cplusplus
|
|
|
83 |
extern "C" {
|
|
|
84 |
#endif
|
|
|
85 |
|
|
|
86 |
/* process primitives */
|
|
|
87 |
extern int execl(const char *, const char *, ...);
|
|
|
88 |
extern int execv(const char *, const char **);
|
|
|
89 |
extern int execle(const char *, const char *, const char *, ...);
|
|
|
90 |
extern int execve(const char *, const char **, const char **);
|
|
|
91 |
extern int execlp(const char *, const char *, ...);
|
|
|
92 |
extern int execvp(const char *, const char **);
|
|
|
93 |
extern void _exit(int);
|
|
|
94 |
extern unsigned int alarm(unsigned int);
|
|
|
95 |
extern int pause(void);
|
|
|
96 |
extern unsigned int sleep(unsigned int);
|
|
|
97 |
#ifdef __TYPES_H
|
|
|
98 |
extern pid_t fork(void);
|
|
|
99 |
#endif
|
|
|
100 |
|
|
|
101 |
/* process environment */
|
|
|
102 |
extern char *getlogin(void);
|
|
|
103 |
extern char *cuserid(char *);
|
|
|
104 |
extern char *ttyname(int);
|
|
|
105 |
extern int isatty(int);
|
|
|
106 |
extern long sysconf(int);
|
|
|
107 |
#ifdef __TYPES_H
|
|
|
108 |
extern pid_t getpid(void);
|
|
|
109 |
extern pid_t getppid(void);
|
|
|
110 |
extern uid_t getuid(void);
|
|
|
111 |
extern uid_t geteuid(void);
|
|
|
112 |
extern gid_t getgid(void);
|
|
|
113 |
extern gid_t getegid(void);
|
|
|
114 |
extern int setuid(uid_t);
|
|
|
115 |
extern int setgid(gid_t);
|
|
|
116 |
extern int getgroups(int, gid_t *);
|
|
|
117 |
extern pid_t getpgrp(void);
|
|
|
118 |
extern int setpgid(pid_t, pid_t);
|
|
|
119 |
extern pid_t setsid(void);
|
|
|
120 |
#endif
|
|
|
121 |
|
|
|
122 |
/* files and directories */
|
|
|
123 |
extern int chdir(const char *);
|
|
|
124 |
extern int link(const char *, const char *);
|
|
|
125 |
extern char *getcwd(char *, size_t);
|
|
|
126 |
extern int unlink(const char *);
|
|
|
127 |
extern int rmdir(const char *);
|
|
|
128 |
extern int rename(const char *, const char *);
|
|
|
129 |
extern int access(const char *, int);
|
|
|
130 |
extern long pathconf(const char *, int);
|
|
|
131 |
extern long fpathconf(int, int);
|
|
|
132 |
#ifdef __TYPES_H
|
|
|
133 |
extern int chown(const char *, uid_t, gid_t);
|
|
|
134 |
#endif
|
|
|
135 |
|
|
|
136 |
/* input and output primitives */
|
|
|
137 |
extern int pipe(int *);
|
|
|
138 |
extern int dup(int);
|
|
|
139 |
extern int dup2(int, int);
|
|
|
140 |
extern int close(int);
|
|
|
141 |
extern ssize_t read(int, void *, size_t);
|
|
|
142 |
extern ssize_t write(int, const void *, size_t);
|
|
|
143 |
#ifdef __TYPES_H
|
|
|
144 |
extern int ftruncate(int, off_t);
|
|
|
145 |
extern off_t lseek(int, off_t, int);
|
|
|
146 |
#endif
|
|
|
147 |
|
|
|
148 |
/* device- and class-specific functions */
|
|
|
149 |
#ifdef __TYPES_H
|
|
|
150 |
extern pid_t tcgetpgrp(int);
|
|
|
151 |
extern int tcsetpgrp(int, pid_t);
|
|
|
152 |
#endif
|
|
|
153 |
|
|
|
154 |
#ifdef _REENTRANT_SOURCE
|
|
|
155 |
extern char *getlogin_r(char *, int);
|
|
|
156 |
#endif
|
|
|
157 |
|
|
|
158 |
/* berkeley specific functions */
|
|
|
159 |
#ifdef _BSD_EXTENSION
|
|
|
160 |
#include <bsd.h>
|
|
|
161 |
#endif
|
|
|
162 |
|
|
|
163 |
#ifdef __cplusplus
|
|
|
164 |
}
|
|
|
165 |
#endif
|
|
|
166 |
|
|
|
167 |
|
|
|
168 |
#endif
|