diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1999-04-22 21:13:23 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1999-04-22 21:13:23 +0000 |
commit | 933388ae2d3f1c2d4939e701ea9cd1290c851886 (patch) | |
tree | af4a76d9a0987674ca0c9a0f5ba7ae2b89551895 | |
parent | Added some CPU models that did not have BSPs. (diff) | |
download | rtems-933388ae2d3f1c2d4939e701ea9cd1290c851886.tar.bz2 |
Added lstat().
-rw-r--r-- | c/src/exec/libcsupport/src/lstat.c | 19 | ||||
-rw-r--r-- | c/src/exec/libcsupport/src/stat.c | 26 | ||||
-rw-r--r-- | c/src/lib/libc/Makefile.in | 2 | ||||
-rw-r--r-- | c/src/lib/libc/lstat.c | 19 | ||||
-rw-r--r-- | c/src/lib/libc/stat.c | 26 | ||||
-rw-r--r-- | cpukit/libcsupport/src/lstat.c | 19 | ||||
-rw-r--r-- | cpukit/libcsupport/src/stat.c | 26 |
7 files changed, 118 insertions, 19 deletions
diff --git a/c/src/exec/libcsupport/src/lstat.c b/c/src/exec/libcsupport/src/lstat.c new file mode 100644 index 0000000000..2c1746ac6e --- /dev/null +++ b/c/src/exec/libcsupport/src/lstat.c @@ -0,0 +1,19 @@ +/* + * lstat() - BSD 4.3 and SVR4 - Get File Status + * + * COPYRIGHT (c) 1989-1998. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#define _STAT_NAME lstat +#define _STAT_R_NAME _lstat_r +#define _STAT_FOLLOW_LINKS FALSE + +#include "stat.c" diff --git a/c/src/exec/libcsupport/src/stat.c b/c/src/exec/libcsupport/src/stat.c index 8ad7e61511..db28d0eedc 100644 --- a/c/src/exec/libcsupport/src/stat.c +++ b/c/src/exec/libcsupport/src/stat.c @@ -1,6 +1,8 @@ /* * stat() - POSIX 1003.1b 5.6.2 - Get File Status * + * Reused from lstat(). + * * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * Copyright assigned to U.S. Government, 1994. @@ -12,6 +14,18 @@ * $Id$ */ +/* + * lstat() and stat() share the same implementation with a minor + * difference on how links are evaluated. + */ + +#ifndef _STAT_NAME +#define _STAT_NAME stat +#define _STAT_R_NAME _stat_r +#define _STAT_FOLLOW_LINKS TRUE +#endif + + #include <rtems.h> #if !defined(RTEMS_UNIX) @@ -25,7 +39,7 @@ #include "libio_.h" -int stat( +int _STAT_NAME( const char *path, struct stat *buf ) @@ -40,7 +54,7 @@ int stat( if ( !buf ) set_errno_and_return_minus_one( EFAULT ); - status = rtems_filesystem_evaluate_path( path, 0, &loc, TRUE ); + status = rtems_filesystem_evaluate_path( path, 0, &loc, _STAT_FOLLOW_LINKS ); if ( status != 0 ) return -1; @@ -59,21 +73,21 @@ int stat( #endif /* - * _stat_r + * _stat_r, _lstat_r * - * This is the Newlib dependent reentrant version of stat(). + * This is the Newlib dependent reentrant version of stat() and lstat(). */ #if defined(RTEMS_NEWLIB) #include <reent.h> -int _stat_r( +int _STAT_R_NAME( struct _reent *ptr, const char *path, struct stat *buf ) { - return stat( path, buf ); + return _STAT_NAME( path, buf ); } #endif diff --git a/c/src/lib/libc/Makefile.in b/c/src/lib/libc/Makefile.in index 2bc8599d9e..c30130b7bd 100644 --- a/c/src/lib/libc/Makefile.in +++ b/c/src/lib/libc/Makefile.in @@ -47,7 +47,7 @@ MALLOC_PIECES=\ LIBC_GLUE_PIECES=\ __gettod __times \ - truncate access stat pathconf \ + truncate access stat lstat pathconf \ newlibc no_libc UNIX_LIBC_PIECES=unixlibc hosterr diff --git a/c/src/lib/libc/lstat.c b/c/src/lib/libc/lstat.c new file mode 100644 index 0000000000..2c1746ac6e --- /dev/null +++ b/c/src/lib/libc/lstat.c @@ -0,0 +1,19 @@ +/* + * lstat() - BSD 4.3 and SVR4 - Get File Status + * + * COPYRIGHT (c) 1989-1998. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#define _STAT_NAME lstat +#define _STAT_R_NAME _lstat_r +#define _STAT_FOLLOW_LINKS FALSE + +#include "stat.c" diff --git a/c/src/lib/libc/stat.c b/c/src/lib/libc/stat.c index 8ad7e61511..db28d0eedc 100644 --- a/c/src/lib/libc/stat.c +++ b/c/src/lib/libc/stat.c @@ -1,6 +1,8 @@ /* * stat() - POSIX 1003.1b 5.6.2 - Get File Status * + * Reused from lstat(). + * * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * Copyright assigned to U.S. Government, 1994. @@ -12,6 +14,18 @@ * $Id$ */ +/* + * lstat() and stat() share the same implementation with a minor + * difference on how links are evaluated. + */ + +#ifndef _STAT_NAME +#define _STAT_NAME stat +#define _STAT_R_NAME _stat_r +#define _STAT_FOLLOW_LINKS TRUE +#endif + + #include <rtems.h> #if !defined(RTEMS_UNIX) @@ -25,7 +39,7 @@ #include "libio_.h" -int stat( +int _STAT_NAME( const char *path, struct stat *buf ) @@ -40,7 +54,7 @@ int stat( if ( !buf ) set_errno_and_return_minus_one( EFAULT ); - status = rtems_filesystem_evaluate_path( path, 0, &loc, TRUE ); + status = rtems_filesystem_evaluate_path( path, 0, &loc, _STAT_FOLLOW_LINKS ); if ( status != 0 ) return -1; @@ -59,21 +73,21 @@ int stat( #endif /* - * _stat_r + * _stat_r, _lstat_r * - * This is the Newlib dependent reentrant version of stat(). + * This is the Newlib dependent reentrant version of stat() and lstat(). */ #if defined(RTEMS_NEWLIB) #include <reent.h> -int _stat_r( +int _STAT_R_NAME( struct _reent *ptr, const char *path, struct stat *buf ) { - return stat( path, buf ); + return _STAT_NAME( path, buf ); } #endif diff --git a/cpukit/libcsupport/src/lstat.c b/cpukit/libcsupport/src/lstat.c new file mode 100644 index 0000000000..2c1746ac6e --- /dev/null +++ b/cpukit/libcsupport/src/lstat.c @@ -0,0 +1,19 @@ +/* + * lstat() - BSD 4.3 and SVR4 - Get File Status + * + * COPYRIGHT (c) 1989-1998. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#define _STAT_NAME lstat +#define _STAT_R_NAME _lstat_r +#define _STAT_FOLLOW_LINKS FALSE + +#include "stat.c" diff --git a/cpukit/libcsupport/src/stat.c b/cpukit/libcsupport/src/stat.c index 8ad7e61511..db28d0eedc 100644 --- a/cpukit/libcsupport/src/stat.c +++ b/cpukit/libcsupport/src/stat.c @@ -1,6 +1,8 @@ /* * stat() - POSIX 1003.1b 5.6.2 - Get File Status * + * Reused from lstat(). + * * COPYRIGHT (c) 1989-1998. * On-Line Applications Research Corporation (OAR). * Copyright assigned to U.S. Government, 1994. @@ -12,6 +14,18 @@ * $Id$ */ +/* + * lstat() and stat() share the same implementation with a minor + * difference on how links are evaluated. + */ + +#ifndef _STAT_NAME +#define _STAT_NAME stat +#define _STAT_R_NAME _stat_r +#define _STAT_FOLLOW_LINKS TRUE +#endif + + #include <rtems.h> #if !defined(RTEMS_UNIX) @@ -25,7 +39,7 @@ #include "libio_.h" -int stat( +int _STAT_NAME( const char *path, struct stat *buf ) @@ -40,7 +54,7 @@ int stat( if ( !buf ) set_errno_and_return_minus_one( EFAULT ); - status = rtems_filesystem_evaluate_path( path, 0, &loc, TRUE ); + status = rtems_filesystem_evaluate_path( path, 0, &loc, _STAT_FOLLOW_LINKS ); if ( status != 0 ) return -1; @@ -59,21 +73,21 @@ int stat( #endif /* - * _stat_r + * _stat_r, _lstat_r * - * This is the Newlib dependent reentrant version of stat(). + * This is the Newlib dependent reentrant version of stat() and lstat(). */ #if defined(RTEMS_NEWLIB) #include <reent.h> -int _stat_r( +int _STAT_R_NAME( struct _reent *ptr, const char *path, struct stat *buf ) { - return stat( path, buf ); + return _STAT_NAME( path, buf ); } #endif |