Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / reent / linkr.c
blob169b6eeecd8bde58274471c59765024359bbbc7f
1 /* Reentrant versions of file system calls. These implementations
2 just call the usual system calls. */
4 #include <reent.h>
5 #include <unistd.h>
6 #include <_syslist.h>
8 /* Some targets provides their own versions of these functions. Those
9 targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS. */
11 #ifdef _REENT_ONLY
12 #ifndef REENTRANT_SYSCALLS_PROVIDED
13 #define REENTRANT_SYSCALLS_PROVIDED
14 #endif
15 #endif
17 #ifdef REENTRANT_SYSCALLS_PROVIDED
19 int _dummy_link_syscalls = 1;
21 #else
23 /* We use the errno variable used by the system dependent layer. */
24 #undef errno
25 extern int errno;
28 FUNCTION
29 <<_link_r>>---Reentrant version of link
31 INDEX
32 _link_r
34 SYNOPSIS
35 #include <reent.h>
36 int _link_r(struct _reent *<[ptr]>,
37 const char *<[old]>, const char *<[new]>);
39 DESCRIPTION
40 This is a reentrant version of <<link>>. It
41 takes a pointer to the global data block, which holds
42 <<errno>>.
45 int
46 _link_r (struct _reent *ptr,
47 const char *old,
48 const char *new)
50 int ret;
52 errno = 0;
53 if ((ret = _link (old, new)) == -1 && errno != 0)
54 _REENT_ERRNO(ptr) = errno;
55 return ret;
58 #endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */