]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | \r | |
3 | Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r | |
4 | This program and the accompanying materials are licensed and made available under\r | |
5 | the terms and conditions of the BSD License that accompanies this distribution.\r | |
6 | The full text of the license may be found at\r | |
7 | http://opensource.org/licenses/bsd-license.\r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
11 | \r | |
12 | **/\r | |
13 | #ifndef _UNISTD_H_\r | |
14 | #define _UNISTD_H_\r | |
15 | \r | |
16 | //#include <machine/ansi.h>\r | |
17 | //#include <machine/int_types.h>\r | |
18 | //#include <sys/featuretest.h>\r | |
19 | //#include <sys/types.h>\r | |
20 | #include <sys/unistd.h>\r | |
21 | #include <sys/EfiSysCall.h>\r | |
22 | \r | |
23 | #define F_ULOCK 0\r | |
24 | #define F_LOCK 1\r | |
25 | #define F_TLOCK 2\r | |
26 | #define F_TEST 3\r | |
27 | \r | |
28 | /* access function */\r | |
29 | #define F_OK 0 /* test for existence of file */\r | |
30 | #define X_OK 0x01 /* test for execute or search permission */\r | |
31 | #define W_OK 0x02 /* test for write permission */\r | |
32 | #define R_OK 0x04 /* test for read permission */\r | |
33 | \r | |
34 | \r | |
35 | __BEGIN_DECLS\r | |
36 | int dup(int);\r | |
37 | int rename(const char *, const char *);\r | |
38 | \r | |
39 | /* Functions implemented for compatibility. */\r | |
40 | int getopt(int, char * const [], const char *);\r | |
41 | extern char *optarg; /* getopt(3) external variables */\r | |
42 | extern int optind;\r | |
43 | pid_t getpgrp(void);\r | |
44 | pid_t tcgetpgrp(int);\r | |
45 | char *getpass(const char *);\r | |
46 | int usleep(useconds_t);\r | |
47 | unsigned int sleep(unsigned int);\r | |
48 | char *basename(char *path);\r | |
49 | \r | |
50 | #ifndef GETCWD_DECLARED\r | |
51 | /** Gets the current working directory.\r | |
52 | \r | |
53 | The getcwd() function shall place an absolute pathname of the current\r | |
54 | working directory in the array pointed to by buf, and return buf. The\r | |
55 | pathname copied to the array shall contain no components that are\r | |
56 | symbolic links. The size argument is the size in bytes of the character\r | |
57 | array pointed to by the buf argument.\r | |
58 | \r | |
59 | @param[in,out] Buf The buffer to fill.\r | |
60 | @param[in] BufSize The number of bytes in buffer.\r | |
61 | \r | |
62 | @retval NULL The function failed.\r | |
63 | @retval NULL Buf was NULL.\r | |
64 | @retval NULL Size was 0.\r | |
65 | @return buf The function completed successfully. See errno for info.\r | |
66 | **/\r | |
67 | char *getcwd(char *Buf, size_t BufSize);\r | |
68 | #define GETCWD_DECLARED\r | |
69 | #endif\r | |
70 | \r | |
71 | #ifndef CHDIR_DECLARED\r | |
72 | /** Change the current working directory.\r | |
73 | \r | |
74 | The chdir() function shall cause the directory named by the pathname\r | |
75 | pointed to by the path argument to become the current working directory;\r | |
76 | that is, the starting point for path searches for pathnames not beginning\r | |
77 | with '/'.\r | |
78 | \r | |
79 | @param[in] Path The new path to set.\r | |
80 | \r | |
81 | @todo Add non-shell CWD changing.\r | |
82 | **/\r | |
83 | int chdir(const char *Path);\r | |
84 | #define CHDIR_DECLARED\r | |
85 | #endif\r | |
86 | \r | |
87 | /** Determine accessibility of a file.\r | |
88 | The access() function checks the file, named by the pathname pointed to by\r | |
89 | the Path argument, for accessibility according to the bit pattern contained\r | |
90 | in Mode.\r | |
91 | \r | |
92 | The value of Mode is either the bitwise-inclusive OR of the access\r | |
93 | permissions to be checked (R_OK, W_OK, X_OK) or the existence test (F_OK).\r | |
94 | \r | |
95 | If Path ends in '/' or '\\', the target must be a directory, otherwise it doesn't matter.\r | |
96 | A file is executable if it is NOT a directory and it ends in ".efi".\r | |
97 | \r | |
98 | @param[in] Path Path or name of the file to be checked.\r | |
99 | @param[in] Mode Access permissions to check for.\r | |
100 | \r | |
101 | @retval 0 Successful completion.\r | |
102 | @retval -1 File is not accessible with the given Mode. The error condition\r | |
103 | is indicated by errno. Values of errno specific to the access\r | |
104 | function include: EACCES, ENOENT, ENOTDIR, ENAMETOOLONG\r | |
105 | **/\r | |
106 | int access(const char *Path, int Mode);\r | |
107 | pid_t getpid(void);\r | |
108 | \r | |
109 | // Networking\r | |
110 | long gethostid(void);\r | |
111 | int gethostname(char *, size_t);\r | |
112 | int getdomainname(char *, size_t);\r | |
113 | int setdomainname(const char *, size_t);\r | |
114 | int sethostid(long);\r | |
115 | int sethostname(const char *, size_t);\r | |
116 | \r | |
117 | /* Stub functions implemented for porting ease.\r | |
118 | These functions always fail or return NULL.\r | |
119 | */\r | |
120 | __aconst char *getlogin(void);\r | |
121 | pid_t fork(void);\r | |
122 | uid_t getuid(void);\r | |
123 | \r | |
124 | // For Future implementation\r | |
125 | ssize_t pread(int, void *, size_t, off_t);\r | |
126 | ssize_t pwrite(int, const void *, size_t, off_t);\r | |
127 | int syscall(int, ...);\r | |
128 | \r | |
129 | #if 0 // The following functions are not implemented\r | |
130 | __dead void _exit(int) __attribute__((__noreturn__));\r | |
131 | unsigned int alarm(unsigned int);\r | |
132 | int chown(const char *, uid_t, gid_t);\r | |
133 | size_t confstr(int, char *, size_t);\r | |
134 | int execl(const char *, const char *, ...);\r | |
135 | int execle(const char *, const char *, ...);\r | |
136 | int execlp(const char *, const char *, ...);\r | |
137 | int execv(const char *, char * const *);\r | |
138 | int execve(const char *, char * const *, char * const *);\r | |
139 | int execvp(const char *, char * const *);\r | |
140 | long fpathconf(int, int);\r | |
141 | gid_t getegid(void);\r | |
142 | uid_t geteuid(void);\r | |
143 | gid_t getgid(void);\r | |
144 | int getgroups(int, gid_t []);\r | |
145 | pid_t getppid(void);\r | |
146 | int link(const char *, const char *);\r | |
147 | long pathconf(const char *, int);\r | |
148 | int pause(void);\r | |
149 | int pipe(int *);\r | |
150 | int setgid(gid_t);\r | |
151 | int setpgid(pid_t, pid_t);\r | |
152 | pid_t setsid(void);\r | |
153 | int setuid(uid_t);\r | |
154 | long sysconf(int);\r | |
155 | \r | |
156 | int tcsetpgrp(int, pid_t);\r | |
157 | __aconst char *ttyname(int);\r | |
158 | \r | |
159 | extern int opterr;\r | |
160 | extern int optopt;\r | |
161 | extern int optreset;\r | |
162 | extern char *suboptarg;\r | |
163 | \r | |
164 | int setegid(gid_t);\r | |
165 | int seteuid(uid_t);\r | |
166 | int fdatasync(int);\r | |
167 | int fsync(int);\r | |
168 | int ttyname_r(int, char *, size_t);\r | |
169 | int chroot(const char *);\r | |
170 | int nice(int);\r | |
171 | __aconst char *crypt(const char *, const char *);\r | |
172 | int encrypt(char *, int);\r | |
173 | pid_t getsid(pid_t);\r | |
174 | \r | |
175 | #ifndef intptr_t\r | |
176 | typedef __intptr_t intptr_t;\r | |
177 | #define intptr_t __intptr_t\r | |
178 | #endif\r | |
179 | \r | |
180 | int brk(void *);\r | |
181 | int fchdir(int);\r | |
182 | int fchown(int, uid_t, gid_t);\r | |
183 | int getdtablesize(void);\r | |
184 | __pure int getpagesize(void); /* legacy */\r | |
185 | pid_t getpgid(pid_t);\r | |
186 | int lchown(const char *, uid_t, gid_t);\r | |
187 | int lockf(int, int, off_t);\r | |
188 | ssize_t readlink(const char * __restrict, char * __restrict, size_t);\r | |
189 | void *sbrk(intptr_t);\r | |
190 | int setregid(gid_t, gid_t);\r | |
191 | int setreuid(uid_t, uid_t);\r | |
192 | void swab(const void *, void *, size_t);\r | |
193 | int symlink(const char *, const char *);\r | |
194 | void sync(void);\r | |
195 | useconds_t ualarm(useconds_t, useconds_t);\r | |
196 | pid_t vfork(void) __RENAME(__vfork14);\r | |
197 | \r | |
198 | /*\r | |
199 | * Implementation-defined extensions\r | |
200 | */\r | |
201 | int acct(const char *);\r | |
202 | int closefrom(int);\r | |
203 | int des_cipher(const char *, char *, long, int);\r | |
204 | int des_setkey(const char *);\r | |
205 | void endusershell(void);\r | |
206 | int exect(const char *, char * const *, char * const *);\r | |
207 | int fchroot(int);\r | |
208 | int fsync_range(int, int, off_t, off_t);\r | |
209 | int getgrouplist(const char *, gid_t, gid_t *, int *);\r | |
210 | int getgroupmembership(const char *, gid_t, gid_t *, int, int *);\r | |
211 | mode_t getmode(const void *, mode_t);\r | |
212 | int getsubopt(char **, char * const *, char **);\r | |
213 | __aconst char *getusershell(void);\r | |
214 | int initgroups(const char *, gid_t);\r | |
215 | int iruserok(uint32_t, int, const char *, const char *);\r | |
216 | int issetugid(void);\r | |
217 | int nfssvc(int, void *);\r | |
218 | int profil(char *, size_t, u_long, u_int);\r | |
219 | void psignal(unsigned int, const char *);\r | |
220 | int rcmd(char **, int, const char *, const char *, const char *, int *);\r | |
221 | int revoke(const char *);\r | |
222 | int rresvport(int *);\r | |
223 | int ruserok(const char *, int, const char *, const char *);\r | |
224 | int setgroups(int, const gid_t *);\r | |
225 | int setlogin(const char *);\r | |
226 | void *setmode(const char *);\r | |
227 | int setrgid(gid_t);\r | |
228 | int setruid(uid_t);\r | |
229 | void setusershell(void);\r | |
230 | void strmode(mode_t, char *);\r | |
231 | __aconst char *strsignal(int);\r | |
232 | int swapctl(int, void *, int);\r | |
233 | quad_t __syscall(quad_t, ...);\r | |
234 | int undelete(const char *);\r | |
235 | int rcmd_af(char **, int, const char *, const char *, const char *, int *, int);\r | |
236 | int rresvport_af(int *, int);\r | |
237 | int iruserok_sa(const void *, int, int, const char *, const char *);\r | |
238 | #endif /* Unimplemented functions. */\r | |
239 | \r | |
240 | __END_DECLS\r | |
241 | \r | |
242 | #endif /* !_UNISTD_H_ */\r |