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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [newlib/] [libc/] [reent/] [fstatr.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 fstat system call.  This implementation just
2
   calls the fstat 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 TARGET_CFLAGS.  */
10
 
11
#ifdef _REENT_ONLY
12
#ifndef REENTRANT_SYSCALLS_PROVIDED
13
#define REENTRANT_SYSCALLS_PROVIDED
14
#endif
15
#endif
16
 
17
#ifdef REENTRANT_SYSCALLS_PROVIDED
18
 
19
int _dummy_fstat_syscalls = 1;
20
 
21
#else
22
 
23
/* We use the errno variable used by the system dependent layer.  */
24
#undef errno
25
extern int errno;
26
 
27
/*
28
FUNCTION
29
        <<_fstat_r>>---Reentrant version of fstat
30
 
31
INDEX
32
        _fstat_r
33
 
34
ANSI_SYNOPSIS
35
        #include <reent.h>
36
        int _fstat_r(struct _reent *<[ptr]>,
37
                     int <[fd]>, struct stat *<[pstat]>);
38
 
39
TRAD_SYNOPSIS
40
        #include <reent.h>
41
        int _fstat_r(<[ptr]>, <[fd]>, <[pstat]>)
42
        struct _reent *<[ptr]>;
43
        int <[fd]>;
44
        struct stat *<[pstat]>;
45
 
46
DESCRIPTION
47
        This is a reentrant version of <<fstat>>.  It
48
        takes a pointer to the global data block, which holds
49
        <<errno>>.
50
*/
51
 
52
int
53
_fstat_r (ptr, fd, pstat)
54
     struct _reent *ptr;
55
     int fd;
56
     struct stat *pstat;
57
{
58
  int ret;
59
 
60
  errno = 0;
61
  if ((ret = _fstat (fd, pstat)) == -1 && errno != 0)
62
    ptr->_errno = errno;
63
  return ret;
64
}
65
 
66
#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.