Subversion Repositories Kolibri OS

Rev

Rev 4874 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4349 Serge 1
/* Reentrant versions of lseek system call. */
2
 
3
#include 
4
#include 
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 _REENT_ONLY
11
#ifndef REENTRANT_SYSCALLS_PROVIDED
12
#define REENTRANT_SYSCALLS_PROVIDED
13
#endif
14
#endif
15
 
16
#ifndef REENTRANT_SYSCALLS_PROVIDED
17
 
4921 Serge 18
/* We use the errno variable used by the system dependent layer.  */
19
#undef errno
20
extern int errno;
4349 Serge 21
 
22
/*
23
FUNCTION
24
	<<_lseek_r>>---Reentrant version of lseek
25
 
26
INDEX
27
	_lseek_r
28
 
29
ANSI_SYNOPSIS
30
	#include 
31
	off_t _lseek_r(struct _reent *<[ptr]>,
32
		       int <[fd]>, off_t <[pos]>, int <[whence]>);
33
 
34
TRAD_SYNOPSIS
35
	#include 
36
	off_t _lseek_r(<[ptr]>, <[fd]>, <[pos]>, <[whence]>)
37
	struct _reent *<[ptr]>;
38
	int <[fd]>;
39
	off_t <[pos]>;
40
	int <[whence]>;
41
 
42
DESCRIPTION
43
	This is a reentrant version of <>.  It
44
	takes a pointer to the global data block, which holds
45
	<>.
46
*/
47
 
48
_off_t
49
_DEFUN (_lseek_r, (ptr, fd, pos, whence),
50
     struct _reent *ptr _AND
51
     int fd _AND
52
     _off_t pos _AND
53
     int whence)
54
{
4921 Serge 55
  _off_t ret;
4349 Serge 56
 
4921 Serge 57
  errno = 0;
58
  if ((ret = _lseek (fd, pos, whence)) == (_off_t) -1 && errno != 0)
59
    ptr->_errno = errno;
60
  return ret;
4349 Serge 61
}
62
 
63
#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */