source: trunk/libs/newlib/src/newlib/libc/reent/lseek64r.c @ 567

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

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

File size: 1.2 KB
Line 
1/* Reentrant versions of lseek system call. */
2
3#include <reent.h>
4#include <unistd.h>
5#include <_syslist.h>
6
7/* Some targets provides their own versions of this functions.  Those
8   targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS.  */
9
10#ifdef __LARGE64_FILES
11
12#ifdef _REENT_ONLY
13#ifndef REENTRANT_SYSCALLS_PROVIDED
14#define REENTRANT_SYSCALLS_PROVIDED
15#endif
16#endif
17
18#ifndef REENTRANT_SYSCALLS_PROVIDED
19
20/* We use the errno variable used by the system dependent layer.  */
21#undef errno
22extern int errno;
23
24/*
25FUNCTION
26        <<_lseek64_r>>---Reentrant version of lseek
27       
28INDEX
29        _lseek64_r
30
31SYNOPSIS
32        #include <reent.h>
33        off64_t _lseek64_r(struct _reent *<[ptr]>,
34                           int <[fd]>, off64_t <[pos]>, int <[whence]>);
35
36DESCRIPTION
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.
41*/
42
43_off64_t
44_lseek64_r (struct _reent *ptr,
45     int fd,
46     _off64_t pos,
47     int whence)
48{
49  _off64_t ret;
50
51  errno = 0;
52  if ((ret = _lseek64 (fd, pos, whence)) == (_off64_t) -1 && errno != 0)
53    ptr->_errno = errno;
54  return ret;
55}
56
57#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */
58
59#endif /* __LARGE64_FILES */
Note: See TracBrowser for help on using the repository browser.