StdLib: Add isDirSep character classification macro and function. Implement several Posix functions and clean up EfiSysCall.h. Align file mode handling with UEFI file protocol flags.

Include/ctype.h:             Function declaration and Macro definition of isDirSep
Include/unistd.h:            Declarations added from EfiSysCall.h
Include/utime.h:             New file.  For the Posix utime() function.
Include/sys/_ctype.h:        Update character class bit maps.
Include/sys/EfiSysCall.h:    Move declarations to unistd.h
Include/sys/fcntl.h:         Improve comments.  Add UEFI-specific macros.
Include/sys/filio.h:         Remove declarations for unsupported file ioctls.
Include/sys/stat.h:          Fix flags.  Add macros and declarations.
Include/sys/time.h:          Add declarations for new functions Tm2Efi() and Time2Efi().
Include/sys/types.h:         Use EFI-specific instead of BSD-specific definitions for typedefs.
Include/sys/unistd.h:        Delete inappropriate content.  Guard macro definitions.

LibC/Locale/setlocale.c
LibC/Stdio/{fdopen.c, findfp.c, fopen.c, freopen.c, gettemp.c, makebuf.c, mktemp.c,
            remove.c, stdio.c, tempnam.c, tmpfile.c, tmpnam.c}
LibC/Time/{itimer.c, ZoneProc.c}
LibC/Uefi/SysCalls.c
LibC/Uefi/Devices/Console/daConsole.c
LibC/Uefi/Devices/UefiShell/daShell.c
PosixLib/Gen/readdir.c
                             Include unistd.h instead of EfiSysCall.h

LibC/Ctype/CClass.c:         Character classification function implementation for isDirSep.
LibC/Ctype/iCtype.c:         Update character classification and case conversion tables.
LibC/Time/TimeEfi.c:         Improve comments.  Implement new functions Tm2Efi() and Time2Efi().
LibC/Uefi/StubFunctions.c:   Add missing include.  Cosmetic changes to declarations.
LibC/Uefi/SysCalls.c:        Add support function for utime().
LibC/Uefi/Uefi.inf:          Add LibGen library class dependency.
LibC/Uefi/Xform.c:           Enhance Omode2EFI().
LibC/Uefi/Devices/UefiShell/daShell.c:    Enhance da_ShellMkdir.  Implement da_ShellIoctl to set file times.
PosixLib/Gen/access.c:       New file.  Implement the access() function.
PosixLib/Gen/dirname.c:      Enhance to use isDirSep and differentiate between the device, path, and filename components of UEFI Shell-style paths.
PosixLib/Gen/utime.c:        New file.  Implement the utime() function.
PosixLib/Gen/LibGen.inf:     Change MODULE_TYPE.  Add new files.

Signed-off-by: darylm503
Reviewed-by: geekboy15a
Reviewed-by: jljusten
Reviewed-by: Rahul Khana
Reviewed-by: leegrosenbaum


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12800 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
darylm503
2011-11-30 00:52:45 +00:00
parent 8f04ca1a8f
commit 0c1992fbcc
40 changed files with 1017 additions and 421 deletions

View File

@@ -25,6 +25,12 @@
#define F_TLOCK 2
#define F_TEST 3
/* access function */
#define F_OK 0 /* test for existence of file */
#define X_OK 0x01 /* test for execute or search permission */
#define W_OK 0x02 /* test for write permission */
#define R_OK 0x04 /* test for read permission */
__BEGIN_DECLS
int dup(int);
@@ -41,6 +47,65 @@ int usleep(useconds_t);
unsigned int sleep(unsigned int);
char *basename(char *path);
#ifndef GETCWD_DECLARED
/** Gets the current working directory.
The getcwd() function shall place an absolute pathname of the current
working directory in the array pointed to by buf, and return buf. The
pathname copied to the array shall contain no components that are
symbolic links. The size argument is the size in bytes of the character
array pointed to by the buf argument.
@param[in,out] Buf The buffer to fill.
@param[in] BufSize The number of bytes in buffer.
@retval NULL The function failed.
@retval NULL Buf was NULL.
@retval NULL Size was 0.
@return buf The function completed successfully. See errno for info.
**/
char *getcwd(char *Buf, size_t BufSize);
#define GETCWD_DECLARED
#endif
#ifndef CHDIR_DECLARED
/** Change the current working directory.
The chdir() function shall cause the directory named by the pathname
pointed to by the path argument to become the current working directory;
that is, the starting point for path searches for pathnames not beginning
with '/'.
@param[in] Path The new path to set.
@todo Add non-shell CWD changing.
**/
int chdir(const char *Path);
#define CHDIR_DECLARED
#endif
/** Determine accessibility of a file.
The access() function checks the file, named by the pathname pointed to by
the Path argument, for accessibility according to the bit pattern contained
in Mode.
The value of Mode is either the bitwise-inclusive OR of the access
permissions to be checked (R_OK, W_OK, X_OK) or the existence test (F_OK).
If Path ends in '/' or '\\', the target must be a directory, otherwise it doesn't matter.
A file is executable if it is NOT a directory and it ends in ".efi".
@param[in] Path Path or name of the file to be checked.
@param[in] Mode Access permissions to check for.
@retval 0 Successful completion.
@retval -1 File is not accessible with the given Mode. The error condition
is indicated by errno. Values of errno specific to the access
function include: EACCES, ENOENT, ENOTDIR, ENAMETOOLONG
**/
int access(const char *Path, int Mode);
pid_t getpid(void);
// Networking
long gethostid(void);
int gethostname(char *, size_t);
@@ -77,7 +142,6 @@ gid_t getegid(void);
uid_t geteuid(void);
gid_t getgid(void);
int getgroups(int, gid_t []);
pid_t getpid(void);
pid_t getppid(void);
int link(const char *, const char *);
long pathconf(const char *, int);