+++ /dev/null
-/*++\r
-\r
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
-Portions copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-Module Name:\r
- UnixInclude.h\r
-\r
-Abstract:\r
- Public include file for the Unix Library\r
-\r
---*/\r
-\r
-#ifndef __UNIX_INCLUDE_H__\r
-#define __UNIX_INCLUDE_H__\r
-\r
-// #include <sys/poll.h>\r
-// #include <dirent.h>\r
-\r
-//\r
-// Name mangle to prevent build errors. I.e conflicts between EFI and OS\r
-//\r
-#define NTOHL _UNIX_EFI_NAME_MANGLE_NTOHL_\r
-#define HTONL _UNIX_EFI_NAME_MANGLE_HTONL_\r
-#define NTOHS _UNIX_EFI_NAME_MANGLE_NTOHS_\r
-#define HTONS _UNIX_EFI_NAME_MANGLE_HTOHS_\r
-#define B0 _UNIX_EFI_NAME_MANGLE_B0_\r
-\r
-\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-\r
-#include <sys/types.h>\r
-#include <sys/stat.h>\r
-#include <sys/termios.h>\r
-#include <sys/time.h>\r
-\r
-#if __CYGWIN__\r
-#include <sys/dirent.h>\r
-#else\r
-#include <sys/dir.h>\r
-#endif\r
-\r
-#include <unistd.h>\r
-#include <poll.h>\r
-#include <fcntl.h>\r
-#include <time.h>\r
-#include <signal.h>\r
-#include <errno.h>\r
-#include <string.h>\r
-#include <stdlib.h>\r
-#include <sys/ioctl.h>\r
-\r
-#include <sys/socket.h>\r
-#include <netdb.h>\r
-#include <netinet/in.h>\r
-#include <net/if.h>\r
-#include <ifaddrs.h>\r
-\r
-#ifdef __APPLE__\r
-#include <net/if_dl.h>\r
-#include <net/bpf.h>\r
-#include <sys/param.h>\r
-#include <sys/mount.h>\r
-#define _XOPEN_SOURCE\r
-#ifndef _Bool\r
- #define _Bool char // for clang debug\r
-#endif\r
-#else\r
-#include <termio.h>\r
-#include <sys/vfs.h>\r
-#endif \r
-\r
-#include <utime.h>\r
-\r
-#if __APPLE__\r
-//\r
-// EFI packing is not compatible witht he default OS packing for struct stat.\r
-// st_size is 64-bit but starts on a 32-bit offset in the structure. The compiler\r
-// flags used to produce compatible EFI images, break struct stat\r
-//\r
-#ifdef MDE_CPU_IA32\r
-#pragma pack(4)\r
-#endif\r
-\r
-#if defined(__DARWIN_64_BIT_INO_T)\r
-\r
-\r
-typedef struct {\r
- UINTN tv_sec; /* seconds */\r
- UINTN tv_nsec; /* and nanoseconds */\r
-} EFI_timespec;\r
-\r
-\r
-\r
-typedef struct stat_fix { \\r
- dev_t st_dev; /* [XSI] ID of device containing file */ \r
- mode_t st_mode; /* [XSI] Mode of file (see below) */ \r
- nlink_t st_nlink; /* [XSI] Number of hard links */ \r
- __darwin_ino64_t st_ino; /* [XSI] File serial number */ \r
- uid_t st_uid; /* [XSI] User ID of the file */ \r
- gid_t st_gid; /* [XSI] Group ID of the file */ \r
- dev_t st_rdev; /* [XSI] Device ID */ \r
-\r
- // clang for X64 ABI follows Windows and a long is 32-bits\r
- // this breaks system inlcude files so that is why we need\r
- // to redefine timespec as EFI_timespec \r
- EFI_timespec st_atimespec;\r
- EFI_timespec st_mtimespec;\r
- EFI_timespec st_ctimespec;\r
- EFI_timespec st_birthtimespec;\r
-\r
- off_t st_size; /* [XSI] file size, in bytes */ \r
- blkcnt_t st_blocks; /* [XSI] blocks allocated for file */ \r
- blksize_t st_blksize; /* [XSI] optimal blocksize for I/O */ \r
- __uint32_t st_flags; /* user defined flags for file */ \r
- __uint32_t st_gen; /* file generation number */ \r
- __int32_t st_lspare; /* RESERVED: DO NOT USE! */ \r
- __int64_t st_qspare[2]; /* RESERVED: DO NOT USE! */ \r
-} STAT_FIX;\r
-\r
-#else /* !__DARWIN_64_BIT_INO_T */\r
-\r
-typedef struct stat_fix {\r
- dev_t st_dev; /* [XSI] ID of device containing file */\r
- ino_t st_ino; /* [XSI] File serial number */\r
- mode_t st_mode; /* [XSI] Mode of file (see below) */\r
- nlink_t st_nlink; /* [XSI] Number of hard links */\r
- uid_t st_uid; /* [XSI] User ID of the file */\r
- gid_t st_gid; /* [XSI] Group ID of the file */\r
- dev_t st_rdev; /* [XSI] Device ID */\r
-#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)\r
- struct timespec st_atimespec; /* time of last access */\r
- struct timespec st_mtimespec; /* time of last data modification */\r
- struct timespec st_ctimespec; /* time of last status change */\r
-#else\r
- time_t st_atime; /* [XSI] Time of last access */\r
- long st_atimensec; /* nsec of last access */\r
- time_t st_mtime; /* [XSI] Last data modification time */\r
- long st_mtimensec; /* last data modification nsec */\r
- time_t st_ctime; /* [XSI] Time of last status change */\r
- long st_ctimensec; /* nsec of last status change */\r
-#endif\r
- off_t st_size; /* [XSI] file size, in bytes */\r
- blkcnt_t st_blocks; /* [XSI] blocks allocated for file */\r
- blksize_t st_blksize; /* [XSI] optimal blocksize for I/O */\r
- __uint32_t st_flags; /* user defined flags for file */\r
- __uint32_t st_gen; /* file generation number */\r
- __int32_t st_lspare; /* RESERVED: DO NOT USE! */\r
- __int64_t st_qspare[2]; /* RESERVED: DO NOT USE! */\r
-} STAT_FIX;\r
-\r
-#endif\r
-\r
-#ifdef MDE_CPU_IA32\r
-#pragma pack(4)\r
-#endif\r
-\r
-#else \r
-\r
- typedef struct stat STAT_FIX;\r
-\r
-#endif\r
-\r
-//\r
-// Undo name mangling\r
-//\r
-#undef NTOHL\r
-#undef HTONL\r
-#undef NTOHS\r
-#undef HTONS\r
-#undef B0\r
-\r
-\r
-#endif\r
-\r