OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [newlib/] [libc/] [reent/] [statr.c] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 39 lampret
/* Reentrant versions of stat system call.  This implementation just
2
   calls the stat system call.  */
3
 
4
#include <reent.h>
5
#include <unistd.h>
6
#include <_syslist.h>
7
 
8
/* Some targets provides their own versions of these functions.  Those
9
   targets should define REENTRANT_SYSCALLS_PROVIDED in
10
   TARGET_CFLAGS.  */
11
 
12
#ifdef _REENT_ONLY
13
#ifndef REENTRANT_SYSCALLS_PROVIDED
14
#define REENTRANT_SYSCALLS_PROVIDED
15
#endif
16
#endif
17
 
18
#ifdef REENTRANT_SYSCALLS_PROVIDED
19
 
20
int _dummy_stat_syscalls = 1;
21
 
22
#else
23
 
24
/* We use the errno variable used by the system dependent layer.  */
25
#undef errno
26
extern int errno;
27
 
28
/*
29
FUNCTION
30
        <<_stat_r>>---Reentrant version of stat
31
 
32
INDEX
33
        _stat_r
34
 
35
ANSI_SYNOPSIS
36
        #include <reent.h>
37
        int _stat_r(struct _reent *<[ptr]>,
38
                    const char *<[file]>, struct stat *<[pstat]>);
39
 
40
TRAD_SYNOPSIS
41
        #include <reent.h>
42
        int _stat_r(<[ptr]>, <[file]>, <[pstat]>)
43
        struct _reent *<[ptr]>;
44
        char *<[file]>;
45
        struct stat *<[pstat]>;
46
 
47
DESCRIPTION
48
        This is a reentrant version of <<stat>>.  It
49
        takes a pointer to the global data block, which holds
50
        <<errno>>.
51
*/
52
 
53
int
54
_stat_r (ptr, file, pstat)
55
     struct _reent *ptr;
56
     _CONST char *file;
57
     struct stat *pstat;
58
{
59
  int ret;
60
 
61
  errno = 0;
62
  if ((ret = _stat (file, pstat)) == -1 && errno != 0)
63
    ptr->_errno = errno;
64
  return ret;
65
}
66
 
67
#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.