summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1999-04-22 21:13:23 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1999-04-22 21:13:23 +0000
commit933388ae2d3f1c2d4939e701ea9cd1290c851886 (patch)
treeaf4a76d9a0987674ca0c9a0f5ba7ae2b89551895 /cpukit/libcsupport/src
parentAdded some CPU models that did not have BSPs. (diff)
downloadrtems-933388ae2d3f1c2d4939e701ea9cd1290c851886.tar.bz2
Added lstat().
Diffstat (limited to 'cpukit/libcsupport/src')
-rw-r--r--cpukit/libcsupport/src/lstat.c19
-rw-r--r--cpukit/libcsupport/src/stat.c26
2 files changed, 39 insertions, 6 deletions
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