]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/Include/unistd.h
Fix a bug about the iSCSI DHCP dependency issue.
[mirror_edk2.git] / StdLib / Include / unistd.h
CommitLineData
53e1e5c6 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
0c1992fb 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
53e1e5c6 34\r
35__BEGIN_DECLS\r
d7ce7006 36int dup(int);\r
53e1e5c6 37int rename(const char *, const char *);\r
38\r
d7ce7006 39/* Functions implemented for compatibility. */\r
40int getopt(int, char * const [], const char *);\r
41extern char *optarg; /* getopt(3) external variables */\r
42extern int optind;\r
43pid_t getpgrp(void);\r
44pid_t tcgetpgrp(int);\r
45char *getpass(const char *);\r
5252c292 46int usleep(useconds_t);\r
47unsigned int sleep(unsigned int);\r
41b152c5 48char *basename(char *path);\r
d7ce7006 49\r
0c1992fb 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
106int access(const char *Path, int Mode);\r
107pid_t getpid(void);\r
108\r
53e1e5c6 109// Networking\r
110long gethostid(void);\r
111int gethostname(char *, size_t);\r
112int getdomainname(char *, size_t);\r
113int setdomainname(const char *, size_t);\r
114int sethostid(long);\r
115int sethostname(const char *, size_t);\r
116\r
d7ce7006 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
121pid_t fork(void);\r
122uid_t getuid(void);\r
123\r
53e1e5c6 124// For Future implementation\r
53e1e5c6 125ssize_t pread(int, void *, size_t, off_t);\r
126ssize_t pwrite(int, const void *, size_t, off_t);\r
127int syscall(int, ...);\r
53e1e5c6 128\r
d7ce7006 129#if 0 // The following functions are not implemented\r
130__dead void _exit(int) __attribute__((__noreturn__));\r
53e1e5c6 131unsigned int alarm(unsigned int);\r
132int chown(const char *, uid_t, gid_t);\r
133size_t confstr(int, char *, size_t);\r
134int execl(const char *, const char *, ...);\r
135int execle(const char *, const char *, ...);\r
136int execlp(const char *, const char *, ...);\r
137int execv(const char *, char * const *);\r
138int execve(const char *, char * const *, char * const *);\r
139int execvp(const char *, char * const *);\r
140long fpathconf(int, int);\r
141gid_t getegid(void);\r
142uid_t geteuid(void);\r
143gid_t getgid(void);\r
144int getgroups(int, gid_t []);\r
53e1e5c6 145pid_t getppid(void);\r
53e1e5c6 146int link(const char *, const char *);\r
147long pathconf(const char *, int);\r
148int pause(void);\r
149int pipe(int *);\r
150int setgid(gid_t);\r
151int setpgid(pid_t, pid_t);\r
152pid_t setsid(void);\r
153int setuid(uid_t);\r
53e1e5c6 154long sysconf(int);\r
d7ce7006 155\r
53e1e5c6 156int tcsetpgrp(int, pid_t);\r
157__aconst char *ttyname(int);\r
158\r
53e1e5c6 159extern int opterr;\r
53e1e5c6 160extern int optopt;\r
d7ce7006 161extern int optreset;\r
162extern char *suboptarg;\r
53e1e5c6 163\r
164int setegid(gid_t);\r
165int seteuid(uid_t);\r
166int fdatasync(int);\r
167int fsync(int);\r
168int ttyname_r(int, char *, size_t);\r
169int chroot(const char *);\r
170int nice(int);\r
171__aconst char *crypt(const char *, const char *);\r
172int encrypt(char *, int);\r
53e1e5c6 173pid_t getsid(pid_t);\r
174\r
175#ifndef intptr_t\r
176typedef __intptr_t intptr_t;\r
177#define intptr_t __intptr_t\r
178#endif\r
179\r
180int brk(void *);\r
181int fchdir(int);\r
182int fchown(int, uid_t, gid_t);\r
183int getdtablesize(void);\r
184__pure int getpagesize(void); /* legacy */\r
185pid_t getpgid(pid_t);\r
186int lchown(const char *, uid_t, gid_t);\r
187int lockf(int, int, off_t);\r
188ssize_t readlink(const char * __restrict, char * __restrict, size_t);\r
189void *sbrk(intptr_t);\r
190int setregid(gid_t, gid_t);\r
191int setreuid(uid_t, uid_t);\r
192void swab(const void *, void *, size_t);\r
193int symlink(const char *, const char *);\r
194void sync(void);\r
195useconds_t ualarm(useconds_t, useconds_t);\r
53e1e5c6 196pid_t vfork(void) __RENAME(__vfork14);\r
197\r
198/*\r
199 * Implementation-defined extensions\r
200 */\r
201int acct(const char *);\r
202int closefrom(int);\r
203int des_cipher(const char *, char *, long, int);\r
204int des_setkey(const char *);\r
205void endusershell(void);\r
206int exect(const char *, char * const *, char * const *);\r
207int fchroot(int);\r
208int fsync_range(int, int, off_t, off_t);\r
209int getgrouplist(const char *, gid_t, gid_t *, int *);\r
210int getgroupmembership(const char *, gid_t, gid_t *, int, int *);\r
211mode_t getmode(const void *, mode_t);\r
212int getsubopt(char **, char * const *, char **);\r
213__aconst char *getusershell(void);\r
214int initgroups(const char *, gid_t);\r
215int iruserok(uint32_t, int, const char *, const char *);\r
216int issetugid(void);\r
217int nfssvc(int, void *);\r
218int profil(char *, size_t, u_long, u_int);\r
219void psignal(unsigned int, const char *);\r
220int rcmd(char **, int, const char *, const char *, const char *, int *);\r
221int revoke(const char *);\r
222int rresvport(int *);\r
223int ruserok(const char *, int, const char *, const char *);\r
224int setgroups(int, const gid_t *);\r
225int setlogin(const char *);\r
226void *setmode(const char *);\r
227int setrgid(gid_t);\r
228int setruid(uid_t);\r
229void setusershell(void);\r
230void strmode(mode_t, char *);\r
231__aconst char *strsignal(int);\r
232int swapctl(int, void *, int);\r
233quad_t __syscall(quad_t, ...);\r
234int undelete(const char *);\r
235int rcmd_af(char **, int, const char *, const char *, const char *, int *, int);\r
236int rresvport_af(int *, int);\r
237int iruserok_sa(const void *, int, int, const char *, const char *);\r
d7ce7006 238#endif /* Unimplemented functions. */\r
53e1e5c6 239\r
240__END_DECLS\r
241\r
242#endif /* !_UNISTD_H_ */\r