Add device abstraction code for the UEFI Console and UEFI Shell-based file systems.
Make argv use narrow characters instead of wide characters. Add setenv functionality. Add poll() system call. Change signal names into macros – required for standards compliance. The enums were renamed and moved to sys/signal.h and the new macros reference the enums. Added SIGBREAK, which is required for Python. Modify stdio functions to fail cleanly when called with a NULL File Pointer argument. Added <sys/cdefs.h> that just includes <sys/EfiCdefs.h>. By adding this wrapper, we improve compatibility with *nix files which assume <sys/cdefs> exists. Add <netdb.h> Added macros for bcopy(), bcmp() and strsep(). Modify the clock() function so that it does not hang when running under an emulation environment such as NT32. Move TM structure specific macros from the private tzfile.h into <time.h> Add strncasecmp function. Add strptime function. Add gettimeofday function. Add getcwd function. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11908 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
Concept derived from NetBSD's unistd.h file.
|
||||
|
||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials are licensed and made available under
|
||||
the terms and conditions of the BSD License that accompanies this distribution.
|
||||
The full text of the license may be found at
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <sys/EfiCdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
struct stat; // Structure declared in <sys/stat.h>
|
||||
struct stat; /* Structure declared in <sys/stat.h> */
|
||||
|
||||
#define STDIN_FILENO 0 /* standard input file descriptor */
|
||||
#define STDOUT_FILENO 1 /* standard output file descriptor */
|
||||
@@ -31,53 +31,90 @@ struct stat; // Structure declared in <sys/stat.h>
|
||||
#define W_OK 0x02 /* test for write permission */
|
||||
#define R_OK 0x04 /* test for read permission */
|
||||
|
||||
/* whence values for lseek(2) */
|
||||
#define SEEK_SET 0 /* set file offset to offset */
|
||||
#define SEEK_CUR 1 /* set file offset to current plus offset */
|
||||
#define SEEK_END 2 /* set file offset to EOF plus offset */
|
||||
/* whence values for lseek(2)
|
||||
Always ensure that these are consistent with <stdio.h> and <unistd.h>!
|
||||
*/
|
||||
#ifndef SEEK_SET
|
||||
#define SEEK_SET 0 /* set file offset to offset */
|
||||
#endif
|
||||
#ifndef SEEK_CUR
|
||||
#define SEEK_CUR 1 /* set file offset to current plus offset */
|
||||
#endif
|
||||
#ifndef SEEK_END
|
||||
#define SEEK_END 2 /* set file offset to EOF plus offset */
|
||||
#endif
|
||||
|
||||
// Parameters for the ValidateFD function.
|
||||
#define VALID_OPEN 1
|
||||
#define VALID_CLOSED 0
|
||||
#define VALID_DONT_CARE -1
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* EFI versions of BSD system calls used in stdio */
|
||||
extern int close (int fd);
|
||||
extern ssize_t read (int fd, void *buf, size_t n);
|
||||
extern ssize_t write (int fd, const void *buf, size_t n);
|
||||
extern int unlink (const char *name);
|
||||
extern int dup2 (int, int);
|
||||
extern int rmdir (const char *);
|
||||
extern int isatty (int);
|
||||
int close (int fd);
|
||||
ssize_t read (int fd, void *buf, size_t n);
|
||||
ssize_t write (int fd, const void *buf, size_t n);
|
||||
int unlink (const char *name);
|
||||
int dup2 (int, int);
|
||||
int rmdir (const char *);
|
||||
int isatty (int);
|
||||
|
||||
/* These system calls are also declared in sys/fcntl.h */
|
||||
#ifndef __FCNTL_SYSCALLS_DECLARED
|
||||
#define __FCNTL_SYSCALLS_DECLARED
|
||||
extern int open (const char *name, int oflags, int mode);
|
||||
extern int creat (const char *, mode_t);
|
||||
extern int fcntl (int, int, ...);
|
||||
int open (const char *name, int oflags, int mode);
|
||||
int creat (const char *, mode_t);
|
||||
int fcntl (int, int, ...);
|
||||
#endif // __FCNTL_SYSCALLS_DECLARED
|
||||
|
||||
/* These system calls are also declared in stat.h */
|
||||
#ifndef __STAT_SYSCALLS_DECLARED
|
||||
#define __STAT_SYSCALLS_DECLARED
|
||||
extern int mkdir (const char *, mode_t);
|
||||
extern int fstat (int, struct stat *);
|
||||
extern int lstat (const char *, struct stat *);
|
||||
extern int stat (const char *, void *);
|
||||
// extern int chmod (const char *, mode_t);
|
||||
int mkdir (const char *, mode_t);
|
||||
int fstat (int, struct stat *);
|
||||
int lstat (const char *, struct stat *);
|
||||
int stat (const char *, void *);
|
||||
// int chmod (const char *, mode_t);
|
||||
#endif // __STAT_SYSCALLS_DECLARED
|
||||
|
||||
// These are also declared in sys/types.h
|
||||
#ifndef __OFF_T_SYSCALLS_DECLARED
|
||||
#define __OFF_T_SYSCALLS_DECLARED
|
||||
extern off_t lseek (int, off_t, int);
|
||||
extern int truncate (const char *, off_t);
|
||||
extern int ftruncate (int, off_t); // IEEE Std 1003.1b-93
|
||||
off_t lseek (int, off_t, int);
|
||||
int truncate (const char *, off_t);
|
||||
int ftruncate (int, off_t); // IEEE Std 1003.1b-93
|
||||
#endif /* __OFF_T_SYSCALLS_DECLARED */
|
||||
|
||||
/* EFI-specific Functions. */
|
||||
int DeleteOnClose(int fd); /* Mark an open file to be deleted when closed. */
|
||||
|
||||
/* Find and reserve a free File Descriptor.
|
||||
|
||||
Returns the first free File Descriptor greater than or equal to the,
|
||||
already validated, fd specified by Minfd.
|
||||
|
||||
@return Returns -1 if there are no free FDs. Otherwise returns the
|
||||
found fd.
|
||||
*/
|
||||
int FindFreeFD (int MinFd);
|
||||
|
||||
/* Validate that fd refers to a valid file descriptor.
|
||||
IsOpen is interpreted as follows:
|
||||
- Positive fd must be OPEN
|
||||
- Zero fd must be CLOSED
|
||||
- Negative fd may be OPEN or CLOSED
|
||||
|
||||
@retval TRUE fd is VALID
|
||||
@retval FALSE fd is INVALID
|
||||
*/
|
||||
BOOLEAN ValidateFD (int fd, int IsOpen);
|
||||
|
||||
/* These system calls don't YET have EFI implementations. */
|
||||
extern int access (const char *path, int amode);
|
||||
extern int chdir (const char *);
|
||||
extern char *getcwd (char *, size_t);
|
||||
extern int reboot (int, char *);
|
||||
int access (const char *path, int amode);
|
||||
int chdir (const char *);
|
||||
char *getcwd (char *, size_t);
|
||||
int reboot (int, char *);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
Reference in New Issue
Block a user