]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - UnixPkg/Include/Protocol/UnixThunk.h
Fix issue with fixing tabs.
[mirror_edk2.git] / UnixPkg / Include / Protocol / UnixThunk.h
... / ...
CommitLineData
1/*++
2
3Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>
4Portions copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
5This program and the accompanying materials
6are licensed and made available under the terms and conditions of the BSD License
7which accompanies this distribution. The full text of the license may be found at
8http://opensource.org/licenses/bsd-license.php
9
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13Module Name:
14
15 UnixThunk.h
16
17Abstract:
18
19 This protocol allows an EFI driver in the Unix emulation environment
20 to make Posix calls.
21
22 NEVER make an Unix call directly, always make the call via this protocol.
23
24 There are no This pointers on the protocol member functions as they map
25 exactly into Unix system calls.
26
27--*/
28
29#ifndef _UNIX_THUNK_H_
30#define _UNIX_THUNK_H_
31
32#include <Common/UnixInclude.h>
33
34#include <Base.h>
35#include <Library/PeCoffLib.h>
36
37
38
39#define EFI_UNIX_THUNK_PROTOCOL_GUID \
40 { \
41 0xf2e98868, 0x8985, 0x11db, {0x9a, 0x59, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \
42 }
43
44typedef
45VOID
46(EFIAPI *UnixSleep) (
47 unsigned long Milliseconds
48 );
49
50typedef
51VOID
52(EFIAPI *UnixExit) (
53 int status // exit code for all threads
54 );
55
56typedef
57VOID
58(EFIAPI *UnixSetTimer) (
59 UINT64 PeriodMs,
60 VOID (EFIAPI *CallBack)(UINT64 DeltaMs)
61 );
62
63typedef
64VOID
65(EFIAPI *UnixGetLocalTime) (
66 EFI_TIME *Time
67 );
68
69typedef
70struct tm *
71(EFIAPI *UnixGmTime)(
72 const time_t *timep
73 );
74
75typedef
76long
77(EFIAPI *UnixGetTimeZone)(
78 void
79 );
80
81typedef
82int
83(EFIAPI *UnixGetDayLight)(
84 void
85 );
86
87typedef
88int
89(EFIAPI *UnixPoll)(
90 struct pollfd *pfd,
91 unsigned int nfds,
92 int timeout
93 );
94
95typedef
96long
97(EFIAPI *UnixRead) (
98 int fd,
99 void *buf,
100 int count
101 );
102
103typedef
104long
105(EFIAPI *UnixWrite) (
106 int fd,
107 const void *buf,
108 int count
109 );
110
111typedef
112char *
113(EFIAPI *UnixGetenv) (const char *var);
114
115typedef
116int
117(EFIAPI *UnixOpen) (const char *name, int flags, int mode);
118
119typedef
120off_t
121(EFIAPI *UnixSeek) (int fd, off_t off, int whence);
122
123typedef
124int
125(EFIAPI *UnixFtruncate) (int fd, long int len);
126
127typedef
128int
129(EFIAPI *UnixClose) (int fd);
130
131typedef
132int
133(EFIAPI *UnixMkdir)(const char *pathname, mode_t mode);
134
135typedef
136int
137(EFIAPI *UnixRmDir)(const char *pathname);
138
139typedef
140int
141(EFIAPI *UnixUnLink)(const char *pathname);
142
143typedef
144int
145(EFIAPI *UnixGetErrno)(VOID);
146
147typedef
148DIR *
149(EFIAPI *UnixOpenDir)(const char *pathname);
150
151typedef
152void
153(EFIAPI *UnixRewindDir)(DIR *dir);
154
155typedef
156struct dirent *
157(EFIAPI *UnixReadDir)(DIR *dir);
158
159typedef
160int
161(EFIAPI *UnixCloseDir)(DIR *dir);
162
163typedef
164int
165(EFIAPI *UnixStat)(const char *path, STAT_FIX *buf);
166
167typedef
168int
169(EFIAPI *UnixStatFs)(const char *path, struct statfs *buf);
170
171typedef
172int
173(EFIAPI *UnixRename)(const char *oldpath, const char *newpath);
174
175typedef
176time_t
177(EFIAPI *UnixMkTime)(struct tm *tm);
178
179typedef
180int
181(EFIAPI *UnixFSync)(int fd);
182
183typedef
184int
185(EFIAPI *UnixChmod)(const char *path, mode_t mode);
186
187typedef
188int
189(EFIAPI *UnixUTime)(const char *filename, const struct utimbuf *buf);
190
191struct _EFI_UNIX_UGA_IO_PROTOCOL;
192typedef
193EFI_STATUS
194(EFIAPI *UnixUgaCreate)(struct _EFI_UNIX_UGA_IO_PROTOCOL **UgaIo,
195 CONST CHAR16 *Title);
196
197typedef
198int
199(EFIAPI *UnixTcflush) (int fildes, int queue_selector);
200
201typedef
202void
203(EFIAPI *UnixPerror) (__const char *__s);
204
205typedef
206int
207#if __CYGWIN__
208(EFIAPI *UnixIoCtl) (int fd, int __request, UINTN Arg);
209#else
210(EFIAPI *UnixIoCtl) (int fd, unsigned long int __request, void *Arg);
211#endif
212
213typedef
214int
215(EFIAPI *UnixFcntl) (int __fd, int __cmd, void *Arg);
216
217typedef
218int
219(EFIAPI *UnixCfsetispeed) (struct termios *__termios_p, speed_t __speed);
220
221typedef
222int
223(EFIAPI *UnixCfsetospeed) (struct termios *__termios_p, speed_t __speed);
224
225typedef
226int
227(EFIAPI *UnixTcgetattr) (int __fd, struct termios *__termios_p);
228
229typedef
230int
231(EFIAPI *UnixTcsetattr) (int __fd, int __optional_actions,
232 __const struct termios *__termios_p);
233
234
235//
236// Worker functions to enable source level debug in the emulator
237//
238
239typedef
240RETURN_STATUS
241(EFIAPI *UnixPeCoffGetEntryPoint) (
242 IN VOID *Pe32Data,
243 IN OUT VOID **EntryPoint
244 );
245
246typedef
247VOID
248(EFIAPI *UnixPeCoffRelocateImageExtraAction) (
249 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
250 );
251
252typedef
253VOID
254(EFIAPI *UnixPeCoffLoaderUnloadImageExtraAction) (
255 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
256 );
257
258typedef
259int
260(EFIAPI *UnixGetIfAddrs) (
261 struct ifaddrs **ifap
262 );
263
264typedef
265void
266(EFIAPI *UnixFreeIfAddrs) (
267 struct ifaddrs *ifap
268 );
269
270typedef
271int
272(EFIAPI *UnixSocket) (
273 int domain,
274 int type,
275 int protocol
276 );
277
278typedef
279void
280(EFIAPI *UnixDisableInterruptEmulation) (void);
281
282typedef
283void
284(EFIAPI *UnixEnableInterruptEmulation) (void);
285
286
287
288
289#define EFI_UNIX_THUNK_PROTOCOL_SIGNATURE SIGNATURE_32 ('L', 'N', 'X', 'T')
290
291typedef struct _EFI_UNIX_THUNK_PROTOCOL {
292 UINT64 Signature;
293
294 UnixSleep Sleep;
295 UnixExit Exit;
296 UnixSetTimer SetTimer;
297 UnixGetLocalTime GetLocalTime;
298 UnixGmTime GmTime;
299 UnixGetTimeZone GetTimeZone;
300 UnixGetDayLight GetDayLight;
301 UnixPoll Poll;
302 UnixRead Read;
303 UnixWrite Write;
304 UnixGetenv Getenv;
305 UnixOpen Open;
306 UnixSeek Lseek;
307 UnixFtruncate FTruncate;
308 UnixClose Close;
309 UnixMkdir MkDir;
310 UnixRmDir RmDir;
311 UnixUnLink UnLink;
312 UnixGetErrno GetErrno;
313 UnixOpenDir OpenDir;
314 UnixRewindDir RewindDir;
315 UnixReadDir ReadDir;
316 UnixCloseDir CloseDir;
317 UnixStat Stat;
318 UnixStatFs StatFs;
319 UnixRename Rename;
320 UnixMkTime MkTime;
321 UnixFSync FSync;
322 UnixChmod Chmod;
323 UnixUTime UTime;
324 UnixTcflush Tcflush;
325 UnixUgaCreate UgaCreate;
326 UnixPerror Perror;
327 UnixIoCtl IoCtl;
328 UnixFcntl Fcntl;
329 UnixCfsetispeed Cfsetispeed;
330 UnixCfsetospeed Cfsetospeed;
331 UnixTcgetattr Tcgetattr;
332 UnixTcsetattr Tcsetattr;
333 UnixPeCoffGetEntryPoint PeCoffGetEntryPoint;
334 UnixPeCoffRelocateImageExtraAction PeCoffRelocateImageExtraAction;
335 UnixPeCoffLoaderUnloadImageExtraAction PeCoffUnloadImageExtraAction;
336 UnixEnableInterruptEmulation EnableInterrupt;
337 UnixDisableInterruptEmulation DisableInterrupt;
338
339 UnixGetIfAddrs GetIfAddrs;
340 UnixFreeIfAddrs FreeIfAddrs;
341 UnixSocket Socket;
342} EFI_UNIX_THUNK_PROTOCOL;
343
344extern EFI_GUID gEfiUnixThunkProtocolGuid;
345
346#endif