source: trunk/libs/newlib/src/newlib/libc/reent/open64r.c @ 620

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

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

File size: 1.3 KB
Line 
1/* Reentrant versions of open system call. */
2
3#include <reent.h>
4#include <unistd.h>
5#include <fcntl.h>
6#include <_syslist.h>
7
8#ifdef __LARGE64_FILES
9
10/* Some targets provides their own versions of this functions.  Those
11   targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS.  */
12
13#ifdef _REENT_ONLY
14#ifndef REENTRANT_SYSCALLS_PROVIDED
15#define REENTRANT_SYSCALLS_PROVIDED
16#endif
17#endif
18
19#ifndef REENTRANT_SYSCALLS_PROVIDED
20
21/* We use the errno variable used by the system dependent layer.  */
22#undef errno
23extern int errno;
24
25/*
26FUNCTION
27        <<_open64_r>>---Reentrant version of open64
28       
29INDEX
30        _open64_r
31
32SYNOPSIS
33        #include <reent.h>
34        int _open64_r(struct _reent *<[ptr]>,
35                      const char *<[file]>, int <[flags]>, int <[mode]>);
36
37DESCRIPTION
38        This is a reentrant version of <<open64>>.  It
39        takes a pointer to the global data block, which holds
40        <<errno>>.  This function only exists on systems with
41        large file support.
42*/
43
44int
45_open64_r (ptr, file, flags, mode)
46     struct _reent *ptr;
47     const char *file;
48     int flags;
49     int mode;
50{
51  int ret;
52
53  errno = 0;
54  if ((ret = _open64 (file, flags, mode)) == -1 && errno != 0)
55    ptr->_errno = errno;
56  return ret;
57}
58
59#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */
60
61#endif /* __LARGE64_FILES */
Note: See TracBrowser for help on using the repository browser.