]> git.proxmox.com Git - mirror_edk2.git/blame - UnixPkg/Include/Protocol/UnixThunk.h
Fix entry point prototype.
[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>
49
50#define EFI_UNIX_THUNK_PROTOCOL_GUID \
51 { \
52 0xf2e98868, 0x8985, 0x11db, {0x9a, 0x59, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \
53 }
54
55typedef
56VOID
57(*UnixSleep) (
58 unsigned long Milliseconds
59 );
60
61typedef
62VOID
63(*UnixExit) (
64 int status // exit code for all threads
65 );
66
67typedef
68VOID
69(*UnixSetTimer) (UINT64 PeriodMs, VOID (*CallBack)(UINT64 DeltaMs));
70typedef
71VOID
72(*UnixGetLocalTime) (EFI_TIME *Time);
73typedef
74struct tm *
75(*UnixGmTime)(const time_t *timep);
76typedef
77long
78(*UnixGetTimeZone)(void);
79typedef
80int
81(*UnixGetDayLight)(void);
82typedef
83int
84(*UnixPoll)(struct pollfd *pfd, int nfds, int timeout);
85typedef
86int
87(*UnixRead) (int fd, void *buf, int count);
88typedef
89int
90(*UnixWrite) (int fd, const void *buf, int count);
91typedef
92char *
93(*UnixGetenv) (const char *var);
94typedef
95int
96(*UnixOpen) (const char *name, int flags, int mode);
97typedef
98long int
99(*UnixSeek) (int fd, long int off, int whence);
100typedef
101int
102(*UnixFtruncate) (int fd, long int len);
103typedef
104int
105(*UnixClose) (int fd);
106
107typedef
108int
109(*UnixMkdir)(const char *pathname, mode_t mode);
110typedef
111int
112(*UnixRmDir)(const char *pathname);
113typedef
114int
115(*UnixUnLink)(const char *pathname);
116typedef
117int
118(*UnixGetErrno)(VOID);
119typedef
120DIR *
121(*UnixOpenDir)(const char *pathname);
122typedef
123void
124(*UnixRewindDir)(DIR *dir);
125typedef
126struct dirent *
127(*UnixReadDir)(DIR *dir);
128typedef
129int
130(*UnixCloseDir)(DIR *dir);
131typedef
132int
133(*UnixStat)(const char *path, struct stat *buf);
134typedef
135int
136(*UnixStatFs)(const char *path, struct statfs *buf);
137typedef
138int
139(*UnixRename)(const char *oldpath, const char *newpath);
140typedef
141time_t
142(*UnixMkTime)(struct tm *tm);
143typedef
144int
145(*UnixFSync)(int fd);
146typedef
147int
148(*UnixChmod)(const char *path, mode_t mode);
149typedef
150int
151(*UnixUTime)(const char *filename, const struct utimbuf *buf);
152
153struct _EFI_UNIX_UGA_IO_PROTOCOL;
154typedef
155EFI_STATUS
156(*UnixUgaCreate)(struct _EFI_UNIX_UGA_IO_PROTOCOL **UgaIo,
157 CONST CHAR16 *Title);
158
159typedef
160int
161(*UnixTcflush) (int fildes, int queue_selector);
162
163typedef
164void
165(*UnixPerror) (__const char *__s);
166
167typedef
168int
169(*UnixIoCtl) (int fd, unsigned long int __request, ...);
170
171typedef
172int
173(*UnixFcntl) (int __fd, int __cmd, ...);
174
175typedef
176int
177(*UnixCfsetispeed) (struct termios *__termios_p, speed_t __speed);
178
179typedef
180int
181(*UnixCfsetospeed) (struct termios *__termios_p, speed_t __speed);
182
183typedef
184int
185(*UnixTcgetattr) (int __fd, struct termios *__termios_p);
186
187typedef
188int
189(*UnixTcsetattr) (int __fd, int __optional_actions,
190 __const struct termios *__termios_p);
191
192//
193//
194//
195
196#define EFI_UNIX_THUNK_PROTOCOL_SIGNATURE EFI_SIGNATURE_32 ('L', 'N', 'X', 'T')
197
198typedef 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
242extern EFI_GUID gEfiUnixThunkProtocolGuid;
243
244#endif