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 fstat system call.  This implementation just
2
   calls the fstat system call.  */
3
 
4
#include 
5
#include 
6
#include 
7
#include <_syslist.h>
8
 
9
/* Some targets provides their own versions of these functions.  Those
10
   targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS.  */
11
 
12
#ifdef _REENT_ONLY
13
#ifndef REENTRANT_SYSCALLS_PROVIDED
14
#define REENTRANT_SYSCALLS_PROVIDED
15
#endif
16
#endif
17
 
18
#ifdef REENTRANT_SYSCALLS_PROVIDED
19
 
20
int _dummy_fstat_syscalls = 1;
21
 
22
#else
23
 
24
/* We use the errno variable used by the system dependent layer.  */
4921 Serge 25
#undef errno
26
extern int errno;
4349 Serge 27
 
28
/*
29
FUNCTION
30
	<<_fstat_r>>---Reentrant version of fstat
31
 
32
INDEX
33
	_fstat_r
34
 
35
ANSI_SYNOPSIS
36
	#include 
37
	int _fstat_r(struct _reent *<[ptr]>,
38
		     int <[fd]>, struct stat *<[pstat]>);
39
 
40
TRAD_SYNOPSIS
41
	#include 
42
	int _fstat_r(<[ptr]>, <[fd]>, <[pstat]>)
43
	struct _reent *<[ptr]>;
44
	int <[fd]>;
45
	struct stat *<[pstat]>;
46
 
47
DESCRIPTION
48
	This is a reentrant version of <>.  It
49
	takes a pointer to the global data block, which holds
50
	<>.
51
*/
52
 
53
int
54
_fstat_r (ptr, fd, pstat)
55
     struct _reent *ptr;
56
     int fd;
57
     struct stat *pstat;
58
{
4921 Serge 59
  int ret;
4349 Serge 60
 
4921 Serge 61
  errno = 0;
62
  if ((ret = _fstat (fd, pstat)) == -1 && errno != 0)
63
    ptr->_errno = errno;
64
  return ret;
4349 Serge 65
}
66
 
67
#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */