source: trunk/libs/newlib/src/newlib/libc/reent/fstat64r.c @ 620

Last change on this file since 620 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 1.3 KB
Line 
1/* 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 <sys/stat.h>
7#include <_syslist.h>
8
9#ifdef __LARGE64_FILES
10
11/* Some targets provides their own versions of these functions.  Those
12   targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS.  */
13
14#ifdef _REENT_ONLY
15#ifndef REENTRANT_SYSCALLS_PROVIDED
16#define REENTRANT_SYSCALLS_PROVIDED
17#endif
18#endif
19
20#ifdef REENTRANT_SYSCALLS_PROVIDED
21
22int _dummy_fstat_syscalls = 1;
23
24#else
25
26/* We use the errno variable used by the system dependent layer.  */
27#undef errno
28extern int errno;
29
30/*
31FUNCTION
32        <<_fstat64_r>>---Reentrant version of fstat64
33       
34INDEX
35        _fstat64_r
36
37SYNOPSIS
38        #include <reent.h>
39        int _fstat64_r(struct _reent *<[ptr]>,
40                       int <[fd]>, struct stat64 *<[pstat]>);
41
42DESCRIPTION
43        This is a reentrant version of <<fstat64>>.  It
44        takes a pointer to the global data block, which holds
45        <<errno>>.  This function is only enabled on systems
46        that define __LARGE64_FILES.
47*/
48
49int
50_fstat64_r (struct _reent *ptr,
51     int fd,
52     struct stat64 *pstat)
53{
54  int ret;
55
56  errno = 0;
57  if ((ret = _fstat64 (fd, pstat)) == -1 && errno != 0)
58    ptr->_errno = errno;
59  return ret;
60}
61
62#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */
63
64#endif /* __LARGE64_FILES */
Note: See TracBrowser for help on using the repository browser.