fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / gcc / newlib / libc / reent / lseek64r.c
blob0207a1220448039303d53826b2b572647592320e
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 ANSI_SYNOPSIS
32 #include <reent.h>
33 off64_t _lseek64_r(struct _reent *<[ptr]>,
34 int <[fd]>, off64_t <[pos]>, int <[whence]>);
36 TRAD_SYNOPSIS
37 #include <reent.h>
38 off64_t _lseek64_r(<[ptr]>, <[fd]>, <[pos]>, <[whence]>)
39 struct _reent *<[ptr]>;
40 int <[fd]>;
41 off64_t <[pos]>;
42 int <[whence]>;
44 DESCRIPTION
45 This is a reentrant version of <<lseek64>>. It
46 takes a pointer to the global data block, which holds
47 <<errno>>. This function only exists on a system
48 with large file support.
51 _off64_t
52 _DEFUN (_lseek64_r, (ptr, fd, pos, whence),
53 struct _reent *ptr _AND
54 int fd _AND
55 _off64_t pos _AND
56 int whence)
58 _off64_t ret;
60 errno = 0;
61 if ((ret = _lseek64 (fd, pos, whence)) == (_off64_t) -1 && errno != 0)
62 ptr->_errno = errno;
63 return ret;
66 #endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */
68 #endif /* __LARGE64_FILES */