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
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.
18 This protocol allows an EFI driver in the Unix emulation environment
21 NEVER make an Unix call directly, always make the call via this protocol.
23 There are no This pointers on the protocol member functions as they map
24 exactly into Unix system calls.
28 #ifndef _UNIX_THUNK_H_
29 #define _UNIX_THUNK_H_
31 #include <sys/termios.h>
37 #include <sys/types.h>
46 #include <sys/ioctl.h>
51 #define EFI_UNIX_THUNK_PROTOCOL_GUID \
53 0xf2e98868, 0x8985, 0x11db, {0x9a, 0x59, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \
59 unsigned long Milliseconds
65 int status
// exit code for all threads
70 (*UnixSetTimer
) (UINT64 PeriodMs
, VOID (*CallBack
)(UINT64 DeltaMs
));
73 (*UnixGetLocalTime
) (EFI_TIME
*Time
);
76 (*UnixGmTime
)(const time_t *timep
);
79 (*UnixGetTimeZone
)(void);
82 (*UnixGetDayLight
)(void);
85 (*UnixPoll
)(struct pollfd
*pfd
, int nfds
, int timeout
);
88 (*UnixRead
) (int fd
, void *buf
, int count
);
91 (*UnixWrite
) (int fd
, const void *buf
, int count
);
94 (*UnixGetenv
) (const char *var
);
97 (*UnixOpen
) (const char *name
, int flags
, int mode
);
100 (*UnixSeek
) (int fd
, long int off
, int whence
);
103 (*UnixFtruncate
) (int fd
, long int len
);
106 (*UnixClose
) (int fd
);
110 (*UnixMkdir
)(const char *pathname
, mode_t mode
);
113 (*UnixRmDir
)(const char *pathname
);
116 (*UnixUnLink
)(const char *pathname
);
119 (*UnixGetErrno
)(VOID
);
122 (*UnixOpenDir
)(const char *pathname
);
125 (*UnixRewindDir
)(DIR *dir
);
128 (*UnixReadDir
)(DIR *dir
);
131 (*UnixCloseDir
)(DIR *dir
);
134 (*UnixStat
)(const char *path
, struct stat
*buf
);
137 (*UnixStatFs
)(const char *path
, struct statfs
*buf
);
140 (*UnixRename
)(const char *oldpath
, const char *newpath
);
143 (*UnixMkTime
)(struct tm
*tm
);
146 (*UnixFSync
)(int fd
);
149 (*UnixChmod
)(const char *path
, mode_t mode
);
152 (*UnixUTime
)(const char *filename
, const struct utimbuf
*buf
);
154 struct _EFI_UNIX_UGA_IO_PROTOCOL
;
157 (*UnixUgaCreate
)(struct _EFI_UNIX_UGA_IO_PROTOCOL
**UgaIo
,
158 CONST CHAR16
*Title
);
162 (*UnixTcflush
) (int fildes
, int queue_selector
);
166 (*UnixPerror
) (__const
char *__s
);
170 (*UnixIoCtl
) (int fd
, unsigned long int __request
, ...);
174 (*UnixFcntl
) (int __fd
, int __cmd
, ...);
178 (*UnixCfsetispeed
) (struct termios
*__termios_p
, speed_t __speed
);
182 (*UnixCfsetospeed
) (struct termios
*__termios_p
, speed_t __speed
);
186 (*UnixTcgetattr
) (int __fd
, struct termios
*__termios_p
);
190 (*UnixTcsetattr
) (int __fd
, int __optional_actions
,
191 __const
struct termios
*__termios_p
);
195 (*UnixDlopen
) (const char *FileName
, int Flag
);
199 (*UnixDlerror
) (VOID
);
203 (*UnixDlsym
) (VOID
* Handle
, const char* Symbol
);
210 #define EFI_UNIX_THUNK_PROTOCOL_SIGNATURE SIGNATURE_32 ('L', 'N', 'X', 'T')
212 typedef struct _EFI_UNIX_THUNK_PROTOCOL
{
217 UnixSetTimer SetTimer
;
218 UnixGetLocalTime GetLocalTime
;
220 UnixGetTimeZone GetTimeZone
;
221 UnixGetDayLight GetDayLight
;
228 UnixFtruncate FTruncate
;
233 UnixGetErrno GetErrno
;
235 UnixRewindDir RewindDir
;
237 UnixCloseDir CloseDir
;
246 UnixUgaCreate UgaCreate
;
250 UnixCfsetispeed Cfsetispeed
;
251 UnixCfsetospeed Cfsetospeed
;
252 UnixTcgetattr Tcgetattr
;
253 UnixTcsetattr Tcsetattr
;
257 } EFI_UNIX_THUNK_PROTOCOL
;
259 extern EFI_GUID gEfiUnixThunkProtocolGuid
;