Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / reent / lseek64r.c
blobc9afd01df4ea4b8c3d81946cde8b6075544dfd19
1 /* Reentrant versions of lseek system call. */
3 #include <reent.h>
4 #include <unistd.h>
5 #include <_syslist.h>
7 /* Some targets provides their own versions of this functions. Those
8 targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS. */
10 #ifdef __LARGE64_FILES
12 #ifdef _REENT_ONLY
13 #ifndef REENTRANT_SYSCALLS_PROVIDED
14 #define REENTRANT_SYSCALLS_PROVIDED
15 #endif
16 #endif
18 #ifndef REENTRANT_SYSCALLS_PROVIDED
20 /* We use the errno variable used by the system dependent layer. */
21 #undef errno
22 extern int errno;
25 FUNCTION
26 <<_lseek64_r>>---Reentrant version of lseek
28 INDEX
29 _lseek64_r
31 SYNOPSIS
32 #include <reent.h>
33 off64_t _lseek64_r(struct _reent *<[ptr]>,
34 int <[fd]>, off64_t <[pos]>, int <[whence]>);
36 DESCRIPTION
37 This is a reentrant version of <<lseek64>>. It
38 takes a pointer to the global data block, which holds
39 <<errno>>. This function only exists on a system
40 with large file support.
43 _off64_t
44 _lseek64_r (struct _reent *ptr,
45 int fd,
46 _off64_t pos,
47 int whence)
49 _off64_t ret;
51 errno = 0;
52 if ((ret = _lseek64 (fd, pos, whence)) == (_off64_t) -1 && errno != 0)
53 _REENT_ERRNO(ptr) = errno;
54 return ret;
57 #endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */
59 #endif /* __LARGE64_FILES */