]> git.proxmox.com Git - mirror_edk2.git/blame - UnixPkg/Include/Protocol/UnixThunk.h
Fix file headers
[mirror_edk2.git] / UnixPkg / Include / Protocol / UnixThunk.h
CommitLineData
804405e7 1/*++
2
3Copyright (c) 2004, Intel Corporation
4All rights reserved. This program and the accompanying materials
5are licensed and made available under the terms and conditions of the BSD License
6which accompanies this distribution. The full text of the license may be found at
7http://opensource.org/licenses/bsd-license.php
8
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12Module Name:
13
14 UnixThunk.h
15
16Abstract:
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>
398b646f 49#include <dlfcn.h>
804405e7 50
51#define EFI_UNIX_THUNK_PROTOCOL_GUID \
52 { \
53 0xf2e98868, 0x8985, 0x11db, {0x9a, 0x59, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \
54 }
55
56typedef
57VOID
58(*UnixSleep) (
59 unsigned long Milliseconds
60 );
61
62typedef
63VOID
64(*UnixExit) (
65 int status // exit code for all threads
66 );
67
68typedef
69VOID
70(*UnixSetTimer) (UINT64 PeriodMs, VOID (*CallBack)(UINT64 DeltaMs));
71typedef
72VOID
73(*UnixGetLocalTime) (EFI_TIME *Time);
74typedef
75struct tm *
76(*UnixGmTime)(const time_t *timep);
77typedef
78long
79(*UnixGetTimeZone)(void);
80typedef
81int
82(*UnixGetDayLight)(void);
83typedef
84int
85(*UnixPoll)(struct pollfd *pfd, int nfds, int timeout);
86typedef
87int
88(*UnixRead) (int fd, void *buf, int count);
89typedef
90int
91(*UnixWrite) (int fd, const void *buf, int count);
92typedef
93char *
94(*UnixGetenv) (const char *var);
95typedef
96int
97(*UnixOpen) (const char *name, int flags, int mode);
98typedef
99long int
100(*UnixSeek) (int fd, long int off, int whence);
101typedef
102int
103(*UnixFtruncate) (int fd, long int len);
104typedef
105int
106(*UnixClose) (int fd);
107
108typedef
109int
110(*UnixMkdir)(const char *pathname, mode_t mode);
111typedef
112int
113(*UnixRmDir)(const char *pathname);
114typedef
115int
116(*UnixUnLink)(const char *pathname);
117typedef
118int
119(*UnixGetErrno)(VOID);
120typedef
121DIR *
122(*UnixOpenDir)(const char *pathname);
123typedef
124void
125(*UnixRewindDir)(DIR *dir);
126typedef
127struct dirent *
128(*UnixReadDir)(DIR *dir);
129typedef
130int
131(*UnixCloseDir)(DIR *dir);
132typedef
133int
134(*UnixStat)(const char *path, struct stat *buf);
135typedef
136int
137(*UnixStatFs)(const char *path, struct statfs *buf);
138typedef
139int
140(*UnixRename)(const char *oldpath, const char *newpath);
141typedef
142time_t
143(*UnixMkTime)(struct tm *tm);
144typedef
145int
146(*UnixFSync)(int fd);
147typedef
148int
149(*UnixChmod)(const char *path, mode_t mode);
150typedef
151int
152(*UnixUTime)(const char *filename, const struct utimbuf *buf);
153
154struct _EFI_UNIX_UGA_IO_PROTOCOL;
155typedef
156EFI_STATUS
157(*UnixUgaCreate)(struct _EFI_UNIX_UGA_IO_PROTOCOL **UgaIo,
158 CONST CHAR16 *Title);
159
160typedef
161int
162(*UnixTcflush) (int fildes, int queue_selector);
163
164typedef
165void
166(*UnixPerror) (__const char *__s);
167
168typedef
169int
170(*UnixIoCtl) (int fd, unsigned long int __request, ...);
171
172typedef
173int
174(*UnixFcntl) (int __fd, int __cmd, ...);
175
176typedef
177int
178(*UnixCfsetispeed) (struct termios *__termios_p, speed_t __speed);
179
180typedef
181int
182(*UnixCfsetospeed) (struct termios *__termios_p, speed_t __speed);
183
184typedef
185int
186(*UnixTcgetattr) (int __fd, struct termios *__termios_p);
187
188typedef
189int
190(*UnixTcsetattr) (int __fd, int __optional_actions,
191 __const struct termios *__termios_p);
192
398b646f 193typedef
194VOID *
195(*UnixDlopen) (const char *FileName, int Flag);
196
197typedef
198char *
199(*UnixDlerror) (VOID);
200
201typedef
202VOID *
203(*UnixDlsym) (VOID* Handle, const char* Symbol);
204
205
804405e7 206//
207//
208//
209
208301e9 210#define EFI_UNIX_THUNK_PROTOCOL_SIGNATURE SIGNATURE_32 ('L', 'N', 'X', 'T')
804405e7 211
212typedef struct _EFI_UNIX_THUNK_PROTOCOL {
213 UINT64 Signature;
214
215 UnixSleep Sleep;
216 UnixExit Exit;
217 UnixSetTimer SetTimer;
218 UnixGetLocalTime GetLocalTime;
219 UnixGmTime GmTime;
220 UnixGetTimeZone GetTimeZone;
221 UnixGetDayLight GetDayLight;
222 UnixPoll Poll;
223 UnixRead Read;
224 UnixWrite Write;
225 UnixGetenv Getenv;
226 UnixOpen Open;
227 UnixSeek Lseek;
228 UnixFtruncate FTruncate;
229 UnixClose Close;
230 UnixMkdir MkDir;
231 UnixRmDir RmDir;
232 UnixUnLink UnLink;
233 UnixGetErrno GetErrno;
234 UnixOpenDir OpenDir;
235 UnixRewindDir RewindDir;
236 UnixReadDir ReadDir;
237 UnixCloseDir CloseDir;
238 UnixStat Stat;
239 UnixStatFs StatFs;
240 UnixRename Rename;
241 UnixMkTime MkTime;
242 UnixFSync FSync;
243 UnixChmod Chmod;
244 UnixUTime UTime;
245 UnixTcflush Tcflush;
246 UnixUgaCreate UgaCreate;
247 UnixPerror Perror;
248 UnixIoCtl IoCtl;
249 UnixFcntl Fcntl;
250 UnixCfsetispeed Cfsetispeed;
251 UnixCfsetospeed Cfsetospeed;
252 UnixTcgetattr Tcgetattr;
253 UnixTcsetattr Tcsetattr;
398b646f 254 UnixDlopen Dlopen;
255 UnixDlerror Dlerror;
256 UnixDlsym Dlsym;
804405e7 257} EFI_UNIX_THUNK_PROTOCOL;
258
259extern EFI_GUID gEfiUnixThunkProtocolGuid;
260
261#endif