]>
Commit | Line | Data |
---|---|---|
804405e7 | 1 | /*++ |
2 | ||
3 | Copyright (c) 2004, Intel Corporation | |
4 | All rights reserved. This program and the accompanying materials | |
5 | are licensed and made available under the terms and conditions of the BSD License | |
6 | which accompanies this distribution. The full text of the license may be found at | |
7 | http://opensource.org/licenses/bsd-license.php | |
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 | Module Name: | |
13 | ||
14 | UnixThunk.h | |
15 | ||
16 | Abstract: | |
17 | ||
18 | This protocol allows an EFI driver in the Unix emulation environment | |
19 | to make Posix calls. | |
20 | ||
21 | NEVER make an Unix call directly, always make the call via this protocol. | |
22 | ||
23 | There are no This pointers on the protocol member functions as they map | |
24 | exactly into Unix system calls. | |
25 | ||
26 | --*/ | |
27 | ||
28 | #ifndef _UNIX_THUNK_H_ | |
29 | #define _UNIX_THUNK_H_ | |
30 | ||
31 | #include <sys/termios.h> | |
32 | #include <stdio.h> | |
33 | #include <sys/time.h> | |
34 | #include <sys/dir.h> | |
35 | #include <unistd.h> | |
36 | #include <poll.h> | |
37 | #include <sys/types.h> | |
38 | #include <sys/stat.h> | |
39 | #include <fcntl.h> | |
40 | #include <time.h> | |
41 | #include <signal.h> | |
42 | #include <errno.h> | |
43 | #include <string.h> | |
44 | #include <stdlib.h> | |
45 | #include <termio.h> | |
46 | #include <sys/ioctl.h> | |
47 | #include <sys/vfs.h> | |
48 | #include <utime.h> | |
49 | ||
50 | #define EFI_UNIX_THUNK_PROTOCOL_GUID \ | |
51 | { \ | |
52 | 0xf2e98868, 0x8985, 0x11db, {0x9a, 0x59, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \ | |
53 | } | |
54 | ||
55 | typedef | |
56 | VOID | |
57 | (*UnixSleep) ( | |
58 | unsigned long Milliseconds | |
59 | ); | |
60 | ||
61 | typedef | |
62 | VOID | |
63 | (*UnixExit) ( | |
64 | int status // exit code for all threads | |
65 | ); | |
66 | ||
67 | typedef | |
68 | VOID | |
69 | (*UnixSetTimer) (UINT64 PeriodMs, VOID (*CallBack)(UINT64 DeltaMs)); | |
70 | typedef | |
71 | VOID | |
72 | (*UnixGetLocalTime) (EFI_TIME *Time); | |
73 | typedef | |
74 | struct tm * | |
75 | (*UnixGmTime)(const time_t *timep); | |
76 | typedef | |
77 | long | |
78 | (*UnixGetTimeZone)(void); | |
79 | typedef | |
80 | int | |
81 | (*UnixGetDayLight)(void); | |
82 | typedef | |
83 | int | |
84 | (*UnixPoll)(struct pollfd *pfd, int nfds, int timeout); | |
85 | typedef | |
86 | int | |
87 | (*UnixRead) (int fd, void *buf, int count); | |
88 | typedef | |
89 | int | |
90 | (*UnixWrite) (int fd, const void *buf, int count); | |
91 | typedef | |
92 | char * | |
93 | (*UnixGetenv) (const char *var); | |
94 | typedef | |
95 | int | |
96 | (*UnixOpen) (const char *name, int flags, int mode); | |
97 | typedef | |
98 | long int | |
99 | (*UnixSeek) (int fd, long int off, int whence); | |
100 | typedef | |
101 | int | |
102 | (*UnixFtruncate) (int fd, long int len); | |
103 | typedef | |
104 | int | |
105 | (*UnixClose) (int fd); | |
106 | ||
107 | typedef | |
108 | int | |
109 | (*UnixMkdir)(const char *pathname, mode_t mode); | |
110 | typedef | |
111 | int | |
112 | (*UnixRmDir)(const char *pathname); | |
113 | typedef | |
114 | int | |
115 | (*UnixUnLink)(const char *pathname); | |
116 | typedef | |
117 | int | |
118 | (*UnixGetErrno)(VOID); | |
119 | typedef | |
120 | DIR * | |
121 | (*UnixOpenDir)(const char *pathname); | |
122 | typedef | |
123 | void | |
124 | (*UnixRewindDir)(DIR *dir); | |
125 | typedef | |
126 | struct dirent * | |
127 | (*UnixReadDir)(DIR *dir); | |
128 | typedef | |
129 | int | |
130 | (*UnixCloseDir)(DIR *dir); | |
131 | typedef | |
132 | int | |
133 | (*UnixStat)(const char *path, struct stat *buf); | |
134 | typedef | |
135 | int | |
136 | (*UnixStatFs)(const char *path, struct statfs *buf); | |
137 | typedef | |
138 | int | |
139 | (*UnixRename)(const char *oldpath, const char *newpath); | |
140 | typedef | |
141 | time_t | |
142 | (*UnixMkTime)(struct tm *tm); | |
143 | typedef | |
144 | int | |
145 | (*UnixFSync)(int fd); | |
146 | typedef | |
147 | int | |
148 | (*UnixChmod)(const char *path, mode_t mode); | |
149 | typedef | |
150 | int | |
151 | (*UnixUTime)(const char *filename, const struct utimbuf *buf); | |
152 | ||
153 | struct _EFI_UNIX_UGA_IO_PROTOCOL; | |
154 | typedef | |
155 | EFI_STATUS | |
156 | (*UnixUgaCreate)(struct _EFI_UNIX_UGA_IO_PROTOCOL **UgaIo, | |
157 | CONST CHAR16 *Title); | |
158 | ||
159 | typedef | |
160 | int | |
161 | (*UnixTcflush) (int fildes, int queue_selector); | |
162 | ||
163 | typedef | |
164 | void | |
165 | (*UnixPerror) (__const char *__s); | |
166 | ||
167 | typedef | |
168 | int | |
169 | (*UnixIoCtl) (int fd, unsigned long int __request, ...); | |
170 | ||
171 | typedef | |
172 | int | |
173 | (*UnixFcntl) (int __fd, int __cmd, ...); | |
174 | ||
175 | typedef | |
176 | int | |
177 | (*UnixCfsetispeed) (struct termios *__termios_p, speed_t __speed); | |
178 | ||
179 | typedef | |
180 | int | |
181 | (*UnixCfsetospeed) (struct termios *__termios_p, speed_t __speed); | |
182 | ||
183 | typedef | |
184 | int | |
185 | (*UnixTcgetattr) (int __fd, struct termios *__termios_p); | |
186 | ||
187 | typedef | |
188 | int | |
189 | (*UnixTcsetattr) (int __fd, int __optional_actions, | |
190 | __const struct termios *__termios_p); | |
191 | ||
192 | // | |
193 | // | |
194 | // | |
195 | ||
208301e9 | 196 | #define EFI_UNIX_THUNK_PROTOCOL_SIGNATURE SIGNATURE_32 ('L', 'N', 'X', 'T') |
804405e7 | 197 | |
198 | typedef struct _EFI_UNIX_THUNK_PROTOCOL { | |
199 | UINT64 Signature; | |
200 | ||
201 | UnixSleep Sleep; | |
202 | UnixExit Exit; | |
203 | UnixSetTimer SetTimer; | |
204 | UnixGetLocalTime GetLocalTime; | |
205 | UnixGmTime GmTime; | |
206 | UnixGetTimeZone GetTimeZone; | |
207 | UnixGetDayLight GetDayLight; | |
208 | UnixPoll Poll; | |
209 | UnixRead Read; | |
210 | UnixWrite Write; | |
211 | UnixGetenv Getenv; | |
212 | UnixOpen Open; | |
213 | UnixSeek Lseek; | |
214 | UnixFtruncate FTruncate; | |
215 | UnixClose Close; | |
216 | UnixMkdir MkDir; | |
217 | UnixRmDir RmDir; | |
218 | UnixUnLink UnLink; | |
219 | UnixGetErrno GetErrno; | |
220 | UnixOpenDir OpenDir; | |
221 | UnixRewindDir RewindDir; | |
222 | UnixReadDir ReadDir; | |
223 | UnixCloseDir CloseDir; | |
224 | UnixStat Stat; | |
225 | UnixStatFs StatFs; | |
226 | UnixRename Rename; | |
227 | UnixMkTime MkTime; | |
228 | UnixFSync FSync; | |
229 | UnixChmod Chmod; | |
230 | UnixUTime UTime; | |
231 | UnixTcflush Tcflush; | |
232 | UnixUgaCreate UgaCreate; | |
233 | UnixPerror Perror; | |
234 | UnixIoCtl IoCtl; | |
235 | UnixFcntl Fcntl; | |
236 | UnixCfsetispeed Cfsetispeed; | |
237 | UnixCfsetospeed Cfsetospeed; | |
238 | UnixTcgetattr Tcgetattr; | |
239 | UnixTcsetattr Tcsetattr; | |
240 | } EFI_UNIX_THUNK_PROTOCOL; | |
241 | ||
242 | extern EFI_GUID gEfiUnixThunkProtocolGuid; | |
243 | ||
244 | #endif |