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