forked from Imagelibrary/rtems
Added lstat().
This commit is contained in:
19
c/src/exec/libcsupport/src/lstat.c
Normal file
19
c/src/exec/libcsupport/src/lstat.c
Normal file
@@ -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"
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* stat() - POSIX 1003.1b 5.6.2 - Get File Status
|
* stat() - POSIX 1003.1b 5.6.2 - Get File Status
|
||||||
*
|
*
|
||||||
|
* Reused from lstat().
|
||||||
|
*
|
||||||
* COPYRIGHT (c) 1989-1998.
|
* COPYRIGHT (c) 1989-1998.
|
||||||
* On-Line Applications Research Corporation (OAR).
|
* On-Line Applications Research Corporation (OAR).
|
||||||
* Copyright assigned to U.S. Government, 1994.
|
* Copyright assigned to U.S. Government, 1994.
|
||||||
@@ -12,6 +14,18 @@
|
|||||||
* $Id$
|
* $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>
|
#include <rtems.h>
|
||||||
|
|
||||||
#if !defined(RTEMS_UNIX)
|
#if !defined(RTEMS_UNIX)
|
||||||
@@ -25,7 +39,7 @@
|
|||||||
|
|
||||||
#include "libio_.h"
|
#include "libio_.h"
|
||||||
|
|
||||||
int stat(
|
int _STAT_NAME(
|
||||||
const char *path,
|
const char *path,
|
||||||
struct stat *buf
|
struct stat *buf
|
||||||
)
|
)
|
||||||
@@ -40,7 +54,7 @@ int stat(
|
|||||||
if ( !buf )
|
if ( !buf )
|
||||||
set_errno_and_return_minus_one( EFAULT );
|
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 )
|
if ( status != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@@ -59,21 +73,21 @@ int stat(
|
|||||||
#endif
|
#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)
|
#if defined(RTEMS_NEWLIB)
|
||||||
|
|
||||||
#include <reent.h>
|
#include <reent.h>
|
||||||
|
|
||||||
int _stat_r(
|
int _STAT_R_NAME(
|
||||||
struct _reent *ptr,
|
struct _reent *ptr,
|
||||||
const char *path,
|
const char *path,
|
||||||
struct stat *buf
|
struct stat *buf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return stat( path, buf );
|
return _STAT_NAME( path, buf );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ MALLOC_PIECES=\
|
|||||||
|
|
||||||
LIBC_GLUE_PIECES=\
|
LIBC_GLUE_PIECES=\
|
||||||
__gettod __times \
|
__gettod __times \
|
||||||
truncate access stat pathconf \
|
truncate access stat lstat pathconf \
|
||||||
newlibc no_libc
|
newlibc no_libc
|
||||||
|
|
||||||
UNIX_LIBC_PIECES=unixlibc hosterr
|
UNIX_LIBC_PIECES=unixlibc hosterr
|
||||||
|
|||||||
19
c/src/lib/libc/lstat.c
Normal file
19
c/src/lib/libc/lstat.c
Normal file
@@ -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"
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* stat() - POSIX 1003.1b 5.6.2 - Get File Status
|
* stat() - POSIX 1003.1b 5.6.2 - Get File Status
|
||||||
*
|
*
|
||||||
|
* Reused from lstat().
|
||||||
|
*
|
||||||
* COPYRIGHT (c) 1989-1998.
|
* COPYRIGHT (c) 1989-1998.
|
||||||
* On-Line Applications Research Corporation (OAR).
|
* On-Line Applications Research Corporation (OAR).
|
||||||
* Copyright assigned to U.S. Government, 1994.
|
* Copyright assigned to U.S. Government, 1994.
|
||||||
@@ -12,6 +14,18 @@
|
|||||||
* $Id$
|
* $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>
|
#include <rtems.h>
|
||||||
|
|
||||||
#if !defined(RTEMS_UNIX)
|
#if !defined(RTEMS_UNIX)
|
||||||
@@ -25,7 +39,7 @@
|
|||||||
|
|
||||||
#include "libio_.h"
|
#include "libio_.h"
|
||||||
|
|
||||||
int stat(
|
int _STAT_NAME(
|
||||||
const char *path,
|
const char *path,
|
||||||
struct stat *buf
|
struct stat *buf
|
||||||
)
|
)
|
||||||
@@ -40,7 +54,7 @@ int stat(
|
|||||||
if ( !buf )
|
if ( !buf )
|
||||||
set_errno_and_return_minus_one( EFAULT );
|
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 )
|
if ( status != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@@ -59,21 +73,21 @@ int stat(
|
|||||||
#endif
|
#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)
|
#if defined(RTEMS_NEWLIB)
|
||||||
|
|
||||||
#include <reent.h>
|
#include <reent.h>
|
||||||
|
|
||||||
int _stat_r(
|
int _STAT_R_NAME(
|
||||||
struct _reent *ptr,
|
struct _reent *ptr,
|
||||||
const char *path,
|
const char *path,
|
||||||
struct stat *buf
|
struct stat *buf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return stat( path, buf );
|
return _STAT_NAME( path, buf );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
19
cpukit/libcsupport/src/lstat.c
Normal file
19
cpukit/libcsupport/src/lstat.c
Normal file
@@ -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"
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* stat() - POSIX 1003.1b 5.6.2 - Get File Status
|
* stat() - POSIX 1003.1b 5.6.2 - Get File Status
|
||||||
*
|
*
|
||||||
|
* Reused from lstat().
|
||||||
|
*
|
||||||
* COPYRIGHT (c) 1989-1998.
|
* COPYRIGHT (c) 1989-1998.
|
||||||
* On-Line Applications Research Corporation (OAR).
|
* On-Line Applications Research Corporation (OAR).
|
||||||
* Copyright assigned to U.S. Government, 1994.
|
* Copyright assigned to U.S. Government, 1994.
|
||||||
@@ -12,6 +14,18 @@
|
|||||||
* $Id$
|
* $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>
|
#include <rtems.h>
|
||||||
|
|
||||||
#if !defined(RTEMS_UNIX)
|
#if !defined(RTEMS_UNIX)
|
||||||
@@ -25,7 +39,7 @@
|
|||||||
|
|
||||||
#include "libio_.h"
|
#include "libio_.h"
|
||||||
|
|
||||||
int stat(
|
int _STAT_NAME(
|
||||||
const char *path,
|
const char *path,
|
||||||
struct stat *buf
|
struct stat *buf
|
||||||
)
|
)
|
||||||
@@ -40,7 +54,7 @@ int stat(
|
|||||||
if ( !buf )
|
if ( !buf )
|
||||||
set_errno_and_return_minus_one( EFAULT );
|
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 )
|
if ( status != 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@@ -59,21 +73,21 @@ int stat(
|
|||||||
#endif
|
#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)
|
#if defined(RTEMS_NEWLIB)
|
||||||
|
|
||||||
#include <reent.h>
|
#include <reent.h>
|
||||||
|
|
||||||
int _stat_r(
|
int _STAT_R_NAME(
|
||||||
struct _reent *ptr,
|
struct _reent *ptr,
|
||||||
const char *path,
|
const char *path,
|
||||||
struct stat *buf
|
struct stat *buf
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return stat( path, buf );
|
return _STAT_NAME( path, buf );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user