Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / reent / fstat64r.c
bloba049206e2292e1e3fbb923dfe6bfe8358b19d8fa
1 /* Reentrant versions of fstat system call. This implementation just
2 calls the fstat system call. */
4 #include <reent.h>
5 #include <unistd.h>
6 #include <sys/stat.h>
7 #include <_syslist.h>
9 #ifdef __LARGE64_FILES
11 /* Some targets provides their own versions of these functions. Those
12 targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS. */
14 #ifdef _REENT_ONLY
15 #ifndef REENTRANT_SYSCALLS_PROVIDED
16 #define REENTRANT_SYSCALLS_PROVIDED
17 #endif
18 #endif
20 #ifdef REENTRANT_SYSCALLS_PROVIDED
22 int _dummy_fstat_syscalls = 1;
24 #else
26 /* We use the errno variable used by the system dependent layer. */
27 #undef errno
28 extern int errno;
31 FUNCTION
32 <<_fstat64_r>>---Reentrant version of fstat64
34 INDEX
35 _fstat64_r
37 SYNOPSIS
38 #include <reent.h>
39 int _fstat64_r(struct _reent *<[ptr]>,
40 int <[fd]>, struct stat64 *<[pstat]>);
42 DESCRIPTION
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.
49 int
50 _fstat64_r (struct _reent *ptr,
51 int fd,
52 struct stat64 *pstat)
54 int ret;
56 errno = 0;
57 if ((ret = _fstat64 (fd, pstat)) == -1 && errno != 0)
58 _REENT_ERRNO(ptr) = errno;
59 return ret;
62 #endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */
64 #endif /* __LARGE64_FILES */