]> git.proxmox.com Git - mirror_edk2.git/blob - StdLib/Include/unistd.h
4d738c64b61656df9e4e1995ed2df1a1f7db3e30
[mirror_edk2.git] / StdLib / Include / unistd.h
1 /** @file
2
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.
8
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.
11
12 **/
13 #ifndef _UNISTD_H_
14 #define _UNISTD_H_
15
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>
22
23 #define F_ULOCK 0
24 #define F_LOCK 1
25 #define F_TLOCK 2
26 #define F_TEST 3
27
28
29 __BEGIN_DECLS
30 int dup(int);
31 int rename(const char *, const char *);
32
33 /* Functions implemented for compatibility. */
34 int getopt(int, char * const [], const char *);
35 extern char *optarg; /* getopt(3) external variables */
36 extern int optind;
37 pid_t getpgrp(void);
38 pid_t tcgetpgrp(int);
39 char *getpass(const char *);
40 int usleep(useconds_t);
41 unsigned int sleep(unsigned int);
42 char *basename(char *path);
43
44 // Networking
45 long gethostid(void);
46 int gethostname(char *, size_t);
47 int getdomainname(char *, size_t);
48 int setdomainname(const char *, size_t);
49 int sethostid(long);
50 int sethostname(const char *, size_t);
51
52 /* Stub functions implemented for porting ease.
53 These functions always fail or return NULL.
54 */
55 __aconst char *getlogin(void);
56 pid_t fork(void);
57 uid_t getuid(void);
58
59 // For Future implementation
60 ssize_t pread(int, void *, size_t, off_t);
61 ssize_t pwrite(int, const void *, size_t, off_t);
62 int syscall(int, ...);
63
64 #if 0 // The following functions are not implemented
65 __dead void _exit(int) __attribute__((__noreturn__));
66 unsigned int alarm(unsigned int);
67 int chown(const char *, uid_t, gid_t);
68 size_t confstr(int, char *, size_t);
69 int execl(const char *, const char *, ...);
70 int execle(const char *, const char *, ...);
71 int execlp(const char *, const char *, ...);
72 int execv(const char *, char * const *);
73 int execve(const char *, char * const *, char * const *);
74 int execvp(const char *, char * const *);
75 long fpathconf(int, int);
76 gid_t getegid(void);
77 uid_t geteuid(void);
78 gid_t getgid(void);
79 int getgroups(int, gid_t []);
80 pid_t getpid(void);
81 pid_t getppid(void);
82 int link(const char *, const char *);
83 long pathconf(const char *, int);
84 int pause(void);
85 int pipe(int *);
86 int setgid(gid_t);
87 int setpgid(pid_t, pid_t);
88 pid_t setsid(void);
89 int setuid(uid_t);
90 long sysconf(int);
91
92 int tcsetpgrp(int, pid_t);
93 __aconst char *ttyname(int);
94
95 extern int opterr;
96 extern int optopt;
97 extern int optreset;
98 extern char *suboptarg;
99
100 int setegid(gid_t);
101 int seteuid(uid_t);
102 int fdatasync(int);
103 int fsync(int);
104 int ttyname_r(int, char *, size_t);
105 int chroot(const char *);
106 int nice(int);
107 __aconst char *crypt(const char *, const char *);
108 int encrypt(char *, int);
109 pid_t getsid(pid_t);
110
111 #ifndef intptr_t
112 typedef __intptr_t intptr_t;
113 #define intptr_t __intptr_t
114 #endif
115
116 int brk(void *);
117 int fchdir(int);
118 int fchown(int, uid_t, gid_t);
119 int getdtablesize(void);
120 __pure int getpagesize(void); /* legacy */
121 pid_t getpgid(pid_t);
122 int lchown(const char *, uid_t, gid_t);
123 int lockf(int, int, off_t);
124 ssize_t readlink(const char * __restrict, char * __restrict, size_t);
125 void *sbrk(intptr_t);
126 int setregid(gid_t, gid_t);
127 int setreuid(uid_t, uid_t);
128 void swab(const void *, void *, size_t);
129 int symlink(const char *, const char *);
130 void sync(void);
131 useconds_t ualarm(useconds_t, useconds_t);
132 pid_t vfork(void) __RENAME(__vfork14);
133
134 /*
135 * Implementation-defined extensions
136 */
137 int acct(const char *);
138 int closefrom(int);
139 int des_cipher(const char *, char *, long, int);
140 int des_setkey(const char *);
141 void endusershell(void);
142 int exect(const char *, char * const *, char * const *);
143 int fchroot(int);
144 int fsync_range(int, int, off_t, off_t);
145 int getgrouplist(const char *, gid_t, gid_t *, int *);
146 int getgroupmembership(const char *, gid_t, gid_t *, int, int *);
147 mode_t getmode(const void *, mode_t);
148 int getsubopt(char **, char * const *, char **);
149 __aconst char *getusershell(void);
150 int initgroups(const char *, gid_t);
151 int iruserok(uint32_t, int, const char *, const char *);
152 int issetugid(void);
153 int nfssvc(int, void *);
154 int profil(char *, size_t, u_long, u_int);
155 void psignal(unsigned int, const char *);
156 int rcmd(char **, int, const char *, const char *, const char *, int *);
157 int revoke(const char *);
158 int rresvport(int *);
159 int ruserok(const char *, int, const char *, const char *);
160 int setgroups(int, const gid_t *);
161 int setlogin(const char *);
162 void *setmode(const char *);
163 int setrgid(gid_t);
164 int setruid(uid_t);
165 void setusershell(void);
166 void strmode(mode_t, char *);
167 __aconst char *strsignal(int);
168 int swapctl(int, void *, int);
169 quad_t __syscall(quad_t, ...);
170 int undelete(const char *);
171 int rcmd_af(char **, int, const char *, const char *, const char *, int *, int);
172 int rresvport_af(int *, int);
173 int iruserok_sa(const void *, int, int, const char *, const char *);
174 #endif /* Unimplemented functions. */
175
176 __END_DECLS
177
178 #endif /* !_UNISTD_H_ */