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