]>
git.proxmox.com Git - mirror_edk2.git/blob - StdLib/Include/unistd.h
3 Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials are licensed and made available under
5 the terms and conditions of the BSD License that accompanies this distribution.
6 The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 //#include <machine/ansi.h>
17 //#include <machine/int_types.h>
18 //#include <sys/featuretest.h>
19 //#include <sys/types.h>
20 #include <sys/unistd.h>
21 #include <sys/EfiSysCall.h>
29 #define F_OK 0 /* test for existence of file */
30 #define X_OK 0x01 /* test for execute or search permission */
31 #define W_OK 0x02 /* test for write permission */
32 #define R_OK 0x04 /* test for read permission */
37 int rename(const char *, const char *);
39 /* Functions implemented for compatibility. */
40 int getopt(int, char * const [], const char *);
41 extern char *optarg
; /* getopt(3) external variables */
45 char *getpass(const char *);
46 int usleep(useconds_t
);
47 unsigned int sleep(unsigned int);
48 char *basename(char *path
);
50 #ifndef GETCWD_DECLARED
51 /** Gets the current working directory.
53 The getcwd() function shall place an absolute pathname of the current
54 working directory in the array pointed to by buf, and return buf. The
55 pathname copied to the array shall contain no components that are
56 symbolic links. The size argument is the size in bytes of the character
57 array pointed to by the buf argument.
59 @param[in,out] Buf The buffer to fill.
60 @param[in] BufSize The number of bytes in buffer.
62 @retval NULL The function failed.
63 @retval NULL Buf was NULL.
64 @retval NULL Size was 0.
65 @return buf The function completed successfully. See errno for info.
67 char *getcwd(char *Buf
, size_t BufSize
);
68 #define GETCWD_DECLARED
71 #ifndef CHDIR_DECLARED
72 /** Change the current working directory.
74 The chdir() function shall cause the directory named by the pathname
75 pointed to by the path argument to become the current working directory;
76 that is, the starting point for path searches for pathnames not beginning
79 @param[in] Path The new path to set.
81 @todo Add non-shell CWD changing.
83 int chdir(const char *Path
);
84 #define CHDIR_DECLARED
87 /** Determine accessibility of a file.
88 The access() function checks the file, named by the pathname pointed to by
89 the Path argument, for accessibility according to the bit pattern contained
92 The value of Mode is either the bitwise-inclusive OR of the access
93 permissions to be checked (R_OK, W_OK, X_OK) or the existence test (F_OK).
95 If Path ends in '/' or '\\', the target must be a directory, otherwise it doesn't matter.
96 A file is executable if it is NOT a directory and it ends in ".efi".
98 @param[in] Path Path or name of the file to be checked.
99 @param[in] Mode Access permissions to check for.
101 @retval 0 Successful completion.
102 @retval -1 File is not accessible with the given Mode. The error condition
103 is indicated by errno. Values of errno specific to the access
104 function include: EACCES, ENOENT, ENOTDIR, ENAMETOOLONG
106 int access(const char *Path
, int Mode
);
110 long gethostid(void);
111 int gethostname(char *, size_t);
112 int getdomainname(char *, size_t);
113 int setdomainname(const char *, size_t);
115 int sethostname(const char *, size_t);
117 /* Stub functions implemented for porting ease.
118 These functions always fail or return NULL.
120 __aconst
char *getlogin(void);
124 // For Future implementation
125 ssize_t
pread(int, void *, size_t, off_t
);
126 ssize_t
pwrite(int, const void *, size_t, off_t
);
127 int syscall(int, ...);
129 #if 0 // The following functions are not implemented
130 __dead
void _exit(int) __attribute__((__noreturn__
));
131 unsigned int alarm(unsigned int);
132 int chown(const char *, uid_t
, gid_t
);
133 size_t confstr(int, char *, size_t);
134 int execl(const char *, const char *, ...);
135 int execle(const char *, const char *, ...);
136 int execlp(const char *, const char *, ...);
137 int execv(const char *, char * const *);
138 int execve(const char *, char * const *, char * const *);
139 int execvp(const char *, char * const *);
140 long fpathconf(int, int);
144 int getgroups(int, gid_t
[]);
146 int link(const char *, const char *);
147 long pathconf(const char *, int);
151 int setpgid(pid_t
, pid_t
);
156 int tcsetpgrp(int, pid_t
);
157 __aconst
char *ttyname(int);
162 extern char *suboptarg
;
168 int ttyname_r(int, char *, size_t);
169 int chroot(const char *);
171 __aconst
char *crypt(const char *, const char *);
172 int encrypt(char *, int);
176 typedef __intptr_t
intptr_t;
177 #define intptr_t __intptr_t
182 int fchown(int, uid_t
, gid_t
);
183 int getdtablesize(void);
184 __pure
int getpagesize(void); /* legacy */
185 pid_t
getpgid(pid_t
);
186 int lchown(const char *, uid_t
, gid_t
);
187 int lockf(int, int, off_t
);
188 ssize_t
readlink(const char * __restrict
, char * __restrict
, size_t);
189 void *sbrk(intptr_t);
190 int setregid(gid_t
, gid_t
);
191 int setreuid(uid_t
, uid_t
);
192 void swab(const void *, void *, size_t);
193 int symlink(const char *, const char *);
195 useconds_t
ualarm(useconds_t
, useconds_t
);
196 pid_t
vfork(void) __RENAME(__vfork14
);
199 * Implementation-defined extensions
201 int acct(const char *);
203 int des_cipher(const char *, char *, long, int);
204 int des_setkey(const char *);
205 void endusershell(void);
206 int exect(const char *, char * const *, char * const *);
208 int fsync_range(int, int, off_t
, off_t
);
209 int getgrouplist(const char *, gid_t
, gid_t
*, int *);
210 int getgroupmembership(const char *, gid_t
, gid_t
*, int, int *);
211 mode_t
getmode(const void *, mode_t
);
212 int getsubopt(char **, char * const *, char **);
213 __aconst
char *getusershell(void);
214 int initgroups(const char *, gid_t
);
215 int iruserok(uint32_t, int, const char *, const char *);
217 int nfssvc(int, void *);
218 int profil(char *, size_t, u_long
, u_int
);
219 void psignal(unsigned int, const char *);
220 int rcmd(char **, int, const char *, const char *, const char *, int *);
221 int revoke(const char *);
222 int rresvport(int *);
223 int ruserok(const char *, int, const char *, const char *);
224 int setgroups(int, const gid_t
*);
225 int setlogin(const char *);
226 void *setmode(const char *);
229 void setusershell(void);
230 void strmode(mode_t
, char *);
231 __aconst
char *strsignal(int);
232 int swapctl(int, void *, int);
233 quad_t
__syscall(quad_t
, ...);
234 int undelete(const char *);
235 int rcmd_af(char **, int, const char *, const char *, const char *, int *, int);
236 int rresvport_af(int *, int);
237 int iruserok_sa(const void *, int, int, const char *, const char *);
238 #endif /* Unimplemented functions. */
242 #endif /* !_UNISTD_H_ */