diff options
author | darylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-07-30 00:25:54 +0000 |
---|---|---|
committer | darylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-07-30 00:25:54 +0000 |
commit | f766dd76fde231ecd4f2e9faf99293e90902cebb (patch) | |
tree | 38f845277a463deb34006d84ff1651203dfa425a | |
parent | 84c1b22e843a3af1994e2a938a3685f4874462f9 (diff) | |
download | edk2-platforms-f766dd76fde231ecd4f2e9faf99293e90902cebb.tar.xz |
Changes so that Argv points to narrow-character versions of the command-line arguments.
Fix "long double" handling and differences between MSFT and GCC compilers.
Fix compliance issues with ISO/IEC 9899:199409
New Function declarations:
setenv(), fparseln(), GetFileNameFromPath(), rename()
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12060 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | StdLibPrivateInternalFiles/Include/Device/Console.h | 5 | ||||
-rw-r--r-- | StdLibPrivateInternalFiles/Include/Device/Device.h | 21 | ||||
-rw-r--r-- | StdLibPrivateInternalFiles/Include/LibConfig.h | 27 | ||||
-rw-r--r-- | StdLibPrivateInternalFiles/Include/MainData.h | 5 | ||||
-rw-r--r-- | StdLibPrivateInternalFiles/Include/extern.h | 2 | ||||
-rw-r--r-- | StdLibPrivateInternalFiles/Include/kfile.h | 29 | ||||
-rw-r--r-- | StdLibPrivateInternalFiles/Include/namespace.h | 28 |
7 files changed, 83 insertions, 34 deletions
diff --git a/StdLibPrivateInternalFiles/Include/Device/Console.h b/StdLibPrivateInternalFiles/Include/Device/Console.h index 6f65660485..e97ee3fd2c 100644 --- a/StdLibPrivateInternalFiles/Include/Device/Console.h +++ b/StdLibPrivateInternalFiles/Include/Device/Console.h @@ -51,10 +51,11 @@ __BEGIN_DECLS int
EFIAPI
da_ConOpen(
+ IN DeviceNode *DevNode,
IN struct __filedes *filp,
- IN void *DevInstance,
+ IN int DevInstance,
IN CHAR16 *Path,
- IN CHAR16 *Flags
+ IN CHAR16 *MPath
);
__END_DECLS
diff --git a/StdLibPrivateInternalFiles/Include/Device/Device.h b/StdLibPrivateInternalFiles/Include/Device/Device.h index 68eade0523..cf2053d8b3 100644 --- a/StdLibPrivateInternalFiles/Include/Device/Device.h +++ b/StdLibPrivateInternalFiles/Include/Device/Device.h @@ -127,7 +127,7 @@ NormalizePath( const char *path); **/
RETURN_STATUS
EFIAPI
-ParsePath( const char *path, wchar_t **FullPath, DeviceNode **DevNode, int *Which);
+ParsePath( const char *path, wchar_t **FullPath, DeviceNode **DevNode, int *Which, wchar_t **MapPath);
/** Process a wide character string representing a Mapping Path and extract the instance number.
@@ -192,6 +192,25 @@ wchar_t * EFIAPI
PathAlias(wchar_t *Path, DeviceNode **Node);
+/**
+ Parses a normalized wide character path and returns a pointer to the entry
+ following the last \. If a \ is not found in the path the return value will
+ be the same as the input value. All error conditions return NULL.
+
+ The behavior when passing in a path that has not been normalized is undefined.
+
+ @param Path - A pointer to a wide character string containing a path to a
+ directory or a file.
+
+ @return Pointer to the file name or terminal directory. NULL if an error is
+ detected.
+**/
+wchar_t *
+EFIAPI
+GetFileNameFromPath(
+ const wchar_t *Path
+ );
+
__END_DECLS
#endif /* __DEV_UTILITY_H__ */
diff --git a/StdLibPrivateInternalFiles/Include/LibConfig.h b/StdLibPrivateInternalFiles/Include/LibConfig.h index 67f49c244b..d925ac3258 100644 --- a/StdLibPrivateInternalFiles/Include/LibConfig.h +++ b/StdLibPrivateInternalFiles/Include/LibConfig.h @@ -8,11 +8,11 @@ these libraries have been tested with. Changing this configuration may
produce code that will not build or may not run. Change at your own risk.
- 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
- http://opensource.org/licenses/bsd-license.php.
+ http://opensource.org/licenses/bsd-license.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@@ -28,3 +28,26 @@ #define _IEEE_LIBM 1
#undef WITH_RUNE
+
+#if defined(__GNUC__)
+ #define REAL_LONG_DOUBLE_SUPPORT 1
+#endif
+
+/* Define these if the associated file exists. */
+//#define HAVE_NBTOOL_CONFIG_H
+
+/* Define these if StdLib provides the functionality as opposed to a "compatibility" library */
+
+//#define HAVE_GETOPT
+//#define HAVE_BASENAME
+//#define HAVE_FFS
+//#define HAVE_GETTIMEOFDAY
+//#define HAVE_SETPROGNAME 0
+//#define HAVE_STRLCPY
+//#define HAVE_STRLCAT
+//#define HAVE_DIRNAME
+#define HAVE_MKSTEMP
+#define HAVE_SNPRINTF
+#define HAVE_VSNPRINTF
+
+//#define USE_8BIT_CHARS
diff --git a/StdLibPrivateInternalFiles/Include/MainData.h b/StdLibPrivateInternalFiles/Include/MainData.h index b4b071a080..fcb28e3255 100644 --- a/StdLibPrivateInternalFiles/Include/MainData.h +++ b/StdLibPrivateInternalFiles/Include/MainData.h @@ -18,6 +18,7 @@ #include <limits.h>
#include <signal.h>
#include <time.h>
+#include <setjmp.h>
#include <kfile.h>
#include <Device/Device.h>
@@ -74,7 +75,6 @@ struct __MainData { char *NCmdLine; // Narrow character version of command line arguments.
void (*cleanup)(void); // Stdio Cleanup Function Pointer
- void (*FinalCleanup)(void); // Function to free this structure and cleanup before exit.
__xithandler_t *atexit_handler[ATEXIT_MAX]; // Array of handlers for atexit.
clock_t AppStartTime; // Set in Main.c and used for time.h
@@ -88,6 +88,9 @@ struct __MainData { char ASgetenv[ASCII_STRING_MAX]; // Only modified by getenv
char ASasctime[ASCTIME_BUFLEN]; // Only modified by asctime
+ jmp_buf MainExit; ///< Save environment used for implementing _Exit()
+ int ExitValue; ///< Value being returned by _Exit()
+
BOOLEAN aborting; // Ensures cleanup function only called once when aborting.
};
diff --git a/StdLibPrivateInternalFiles/Include/extern.h b/StdLibPrivateInternalFiles/Include/extern.h index 14e6fa04da..ff37d1c0a4 100644 --- a/StdLibPrivateInternalFiles/Include/extern.h +++ b/StdLibPrivateInternalFiles/Include/extern.h @@ -66,4 +66,6 @@ int vsnprintf_ss(char * __restrict, size_t, const char * __restrict, void Efi2Tm( EFI_TIME *ET, struct tm *BT);
time_t Efi2Time( EFI_TIME *EfiBDtime);
+int ffs(int x);
+
__END_DECLS
diff --git a/StdLibPrivateInternalFiles/Include/kfile.h b/StdLibPrivateInternalFiles/Include/kfile.h index 845b7d908e..c83b07b1a8 100644 --- a/StdLibPrivateInternalFiles/Include/kfile.h +++ b/StdLibPrivateInternalFiles/Include/kfile.h @@ -79,14 +79,14 @@ struct _Device_Node; This structure must be a multiple of 8 bytes in length.
*/
struct __filedes {
+ off_t f_offset; /* current position in file */
const struct fileops *f_ops;
void *devdata; /* Device-specific data */
- off_t f_offset; /* current position in file */
- UINT32 f_flag; /* see fcntl.h */
- UINT32 f_iflags; // In use if non-zero
int Oflags; // From the open call
int Omode; // From the open call
int RefCount; // Reference count of opens
+ UINT32 f_flag; /* see fcntl.h */
+ UINT32 f_iflags; // In use if non-zero
UINT16 MyFD; // Which FD this is.
UINT16 Reserved_1; // Force this structure to be a multiple of 8-bytes in length
};
@@ -130,7 +130,8 @@ typedef struct { /* Type of all Device-specific handler's open routines. */
typedef
- int (EFIAPI *FO_OPEN) (struct __filedes *FD, void *IP, wchar_t *Path, wchar_t *Flags);
+ int (EFIAPI *FO_OPEN) (struct _Device_Node *This, struct __filedes *FD,
+ int Instance, wchar_t *Path, wchar_t *MPath);
#define FILE_IS_USABLE(fp) (((fp)->f_iflags & \
(FIF_WANTCLOSE|FIF_LARVAL)) == 0)
@@ -153,16 +154,16 @@ int fdcreate (CHAR16 *, UINT32, UINT32, BOOLEAN, VOID *, const struct fileo fnullop_* Does nothing and returns success.
fbadop_* Does nothing and returns EPERM
*/
-int fnullop_fcntl (struct __filedes *filp, UINT32 Cmd, void *p3, void *p4);
-short fnullop_poll (struct __filedes *filp, short Events);
-int fnullop_flush (struct __filedes *filp);
-
-int fbadop_stat (struct __filedes *filp, struct stat *StatBuf, void *Buf);
-int fbadop_ioctl (struct __filedes *filp, ULONGN Cmd, void *argp);
-int fbadop_delete (struct __filedes *filp);
-int fbadop_rmdir (struct __filedes *filp);
-int fbadop_mkdir (const char *path, __mode_t perms);
-int fbadop_rename (const char *from, const char *to);
+int EFIAPI fnullop_fcntl (struct __filedes *filp, UINT32 Cmd, void *p3, void *p4);
+short EFIAPI fnullop_poll (struct __filedes *filp, short Events);
+int EFIAPI fnullop_flush (struct __filedes *filp);
+
+int EFIAPI fbadop_stat (struct __filedes *filp, struct stat *StatBuf, void *Buf);
+int EFIAPI fbadop_ioctl (struct __filedes *filp, ULONGN Cmd, void *argp);
+int EFIAPI fbadop_delete (struct __filedes *filp);
+int EFIAPI fbadop_rmdir (struct __filedes *filp);
+int EFIAPI fbadop_mkdir (const char *path, __mode_t perms);
+int EFIAPI fbadop_rename (const char *from, const char *to);
__END_DECLS
diff --git a/StdLibPrivateInternalFiles/Include/namespace.h b/StdLibPrivateInternalFiles/Include/namespace.h index 038e402cc8..67666fc999 100644 --- a/StdLibPrivateInternalFiles/Include/namespace.h +++ b/StdLibPrivateInternalFiles/Include/namespace.h @@ -39,6 +39,17 @@ #include <sys/EfiCdefs.h>
#ifndef __lint__
+#define ftello _ftello
+#define getcontext _getcontext
+#define getenv_r _getenv_r
+#define strtof _strtof
+#define strtoimax _strtoimax
+#define strtold _strtold
+#define strtoll _strtoll
+#define strtoull _strtoull
+#define strtoumax _strtoumax
+
+#if 0
#define brk _brk
#define catclose _catclose
#define catgets _catgets
@@ -51,22 +62,13 @@ #endif /* _REENTRANT */
#define fork _fork
#define fseeko _fseeko
-#define ftello _ftello
-#define getcontext _getcontext
-#define getenv_r _getenv_r
-//#define inet_aton _inet_aton
-//#define inet_pton _inet_pton
+#define inet_aton _inet_aton
+#define inet_pton _inet_pton
#define pipe _pipe
#define sbrk _sbrk
-//#define strerror_r _strerror_r
+#define strerror_r _strerror_r
#define strlcat _strlcat
#define strlcpy _strlcpy
-#define strtof _strtof
-#define strtoimax _strtoimax
-#define strtold _strtold
-#define strtoll _strtoll
-#define strtoull _strtoull
-#define strtoumax _strtoumax
#define sys_errlist _sys_errlist
#define sys_nerr _sys_nerr
#define sys_siglist _sys_siglist
@@ -79,7 +81,6 @@ #define warn _warn
#define warnx _warnx
-#if 0
//#ifdef __weak_alias
#define MD2Data _MD2Data
#define MD2End _MD2End
@@ -244,7 +245,6 @@ #define ftrylockfile _ftrylockfile
#define funlockfile _funlockfile
#define fnmatch _fnmatch
-#define fparseln _fparseln
#define fpgetmask _fpgetmask
#define fpgetround _fpgetround
#define fpgetsticky _fpgetsticky
|