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>
50 #define EFI_UNIX_THUNK_PROTOCOL_GUID \
52 0xf2e98868, 0x8985, 0x11db, {0x9a, 0x59, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \
58 unsigned long Milliseconds
64 int status
// exit code for all threads
69 (*UnixSetTimer
) (UINT64 PeriodMs
, VOID (*CallBack
)(UINT64 DeltaMs
));
72 (*UnixGetLocalTime
) (EFI_TIME
*Time
);
75 (*UnixGmTime
)(const time_t *timep
);
78 (*UnixGetTimeZone
)(void);
81 (*UnixGetDayLight
)(void);
84 (*UnixPoll
)(struct pollfd
*pfd
, int nfds
, int timeout
);
87 (*UnixRead
) (int fd
, void *buf
, int count
);
90 (*UnixWrite
) (int fd
, const void *buf
, int count
);
93 (*UnixGetenv
) (const char *var
);
96 (*UnixOpen
) (const char *name
, int flags
, int mode
);
99 (*UnixSeek
) (int fd
, long int off
, int whence
);
102 (*UnixFtruncate
) (int fd
, long int len
);
105 (*UnixClose
) (int fd
);
109 (*UnixMkdir
)(const char *pathname
, mode_t mode
);
112 (*UnixRmDir
)(const char *pathname
);
115 (*UnixUnLink
)(const char *pathname
);
118 (*UnixGetErrno
)(VOID
);
121 (*UnixOpenDir
)(const char *pathname
);
124 (*UnixRewindDir
)(DIR *dir
);
127 (*UnixReadDir
)(DIR *dir
);
130 (*UnixCloseDir
)(DIR *dir
);
133 (*UnixStat
)(const char *path
, struct stat
*buf
);
136 (*UnixStatFs
)(const char *path
, struct statfs
*buf
);
139 (*UnixRename
)(const char *oldpath
, const char *newpath
);
142 (*UnixMkTime
)(struct tm
*tm
);
145 (*UnixFSync
)(int fd
);
148 (*UnixChmod
)(const char *path
, mode_t mode
);
151 (*UnixUTime
)(const char *filename
, const struct utimbuf
*buf
);
153 struct _EFI_UNIX_UGA_IO_PROTOCOL
;
156 (*UnixUgaCreate
)(struct _EFI_UNIX_UGA_IO_PROTOCOL
**UgaIo
,
157 CONST CHAR16
*Title
);
161 (*UnixTcflush
) (int fildes
, int queue_selector
);
165 (*UnixPerror
) (__const
char *__s
);
169 (*UnixIoCtl
) (int fd
, unsigned long int __request
, ...);
173 (*UnixFcntl
) (int __fd
, int __cmd
, ...);
177 (*UnixCfsetispeed
) (struct termios
*__termios_p
, speed_t __speed
);
181 (*UnixCfsetospeed
) (struct termios
*__termios_p
, speed_t __speed
);
185 (*UnixTcgetattr
) (int __fd
, struct termios
*__termios_p
);
189 (*UnixTcsetattr
) (int __fd
, int __optional_actions
,
190 __const
struct termios
*__termios_p
);
196 #define EFI_UNIX_THUNK_PROTOCOL_SIGNATURE EFI_SIGNATURE_32 ('L', 'N', 'X', 'T')
198 typedef struct _EFI_UNIX_THUNK_PROTOCOL
{
203 UnixSetTimer SetTimer
;
204 UnixGetLocalTime GetLocalTime
;
206 UnixGetTimeZone GetTimeZone
;
207 UnixGetDayLight GetDayLight
;
214 UnixFtruncate FTruncate
;
219 UnixGetErrno GetErrno
;
221 UnixRewindDir RewindDir
;
223 UnixCloseDir CloseDir
;
232 UnixUgaCreate UgaCreate
;
236 UnixCfsetispeed Cfsetispeed
;
237 UnixCfsetospeed Cfsetospeed
;
238 UnixTcgetattr Tcgetattr
;
239 UnixTcsetattr Tcsetattr
;
240 } EFI_UNIX_THUNK_PROTOCOL
;
242 extern EFI_GUID gEfiUnixThunkProtocolGuid
;