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>
33 #define EFI_UNIX_THUNK_PROTOCOL_GUID \
35 0xf2e98868, 0x8985, 0x11db, {0x9a, 0x59, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \
41 unsigned long Milliseconds
47 int status
// exit code for all threads
52 (*UnixSetTimer
) (UINT64 PeriodMs
, VOID (*CallBack
)(UINT64 DeltaMs
));
55 (*UnixGetLocalTime
) (EFI_TIME
*Time
);
58 (*UnixGmTime
)(const time_t *timep
);
61 (*UnixGetTimeZone
)(void);
64 (*UnixGetDayLight
)(void);
67 (*UnixPoll
)(struct pollfd
*pfd
, int nfds
, int timeout
);
70 (*UnixRead
) (int fd
, void *buf
, int count
);
73 (*UnixWrite
) (int fd
, const void *buf
, int count
);
76 (*UnixGetenv
) (const char *var
);
79 (*UnixOpen
) (const char *name
, int flags
, int mode
);
82 (*UnixSeek
) (int fd
, long int off
, int whence
);
85 (*UnixFtruncate
) (int fd
, long int len
);
88 (*UnixClose
) (int fd
);
92 (*UnixMkdir
)(const char *pathname
, mode_t mode
);
95 (*UnixRmDir
)(const char *pathname
);
98 (*UnixUnLink
)(const char *pathname
);
101 (*UnixGetErrno
)(VOID
);
104 (*UnixOpenDir
)(const char *pathname
);
107 (*UnixRewindDir
)(DIR *dir
);
110 (*UnixReadDir
)(DIR *dir
);
113 (*UnixCloseDir
)(DIR *dir
);
116 (*UnixStat
)(const char *path
, struct stat
*buf
);
119 (*UnixStatFs
)(const char *path
, struct statfs
*buf
);
122 (*UnixRename
)(const char *oldpath
, const char *newpath
);
125 (*UnixMkTime
)(struct tm
*tm
);
128 (*UnixFSync
)(int fd
);
131 (*UnixChmod
)(const char *path
, mode_t mode
);
134 (*UnixUTime
)(const char *filename
, const struct utimbuf
*buf
);
136 struct _EFI_UNIX_UGA_IO_PROTOCOL
;
139 (*UnixUgaCreate
)(struct _EFI_UNIX_UGA_IO_PROTOCOL
**UgaIo
,
140 CONST CHAR16
*Title
);
144 (*UnixTcflush
) (int fildes
, int queue_selector
);
148 (*UnixPerror
) (__const
char *__s
);
152 (*UnixPrintf
) (const char* format
, ...);
156 (*UnixIoCtl
) (int fd
, unsigned long int __request
, ...);
160 (*UnixFcntl
) (int __fd
, int __cmd
, ...);
164 (*UnixCfsetispeed
) (struct termios
*__termios_p
, speed_t __speed
);
168 (*UnixCfsetospeed
) (struct termios
*__termios_p
, speed_t __speed
);
172 (*UnixTcgetattr
) (int __fd
, struct termios
*__termios_p
);
176 (*UnixTcsetattr
) (int __fd
, int __optional_actions
,
177 __const
struct termios
*__termios_p
);
183 #define EFI_UNIX_THUNK_PROTOCOL_SIGNATURE EFI_SIGNATURE_32 ('L', 'N', 'X', 'T')
185 typedef struct _EFI_UNIX_THUNK_PROTOCOL
{
190 UnixSetTimer SetTimer
;
191 UnixGetLocalTime GetLocalTime
;
193 UnixGetTimeZone GetTimeZone
;
194 UnixGetDayLight GetDayLight
;
201 UnixFtruncate FTruncate
;
206 UnixGetErrno GetErrno
;
208 UnixRewindDir RewindDir
;
210 UnixCloseDir CloseDir
;
219 UnixUgaCreate UgaCreate
;
224 UnixCfsetispeed Cfsetispeed
;
225 UnixCfsetospeed Cfsetospeed
;
226 UnixTcgetattr Tcgetattr
;
227 UnixTcsetattr Tcsetattr
;
228 } EFI_UNIX_THUNK_PROTOCOL
;
230 extern EFI_GUID gEfiUnixThunkProtocolGuid
;