Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / reent / unlinkr.c
blob495e65b02f3323a4a96adca3e626522b9abf20c0
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 #ifndef REENTRANT_SYSCALLS_PROVIDED
19 /* We use the errno variable used by the system dependent layer. */
20 #undef errno
21 extern int errno;
24 FUNCTION
25 <<_unlink_r>>---Reentrant version of unlink
27 INDEX
28 _unlink_r
30 SYNOPSIS
31 #include <reent.h>
32 int _unlink_r(struct _reent *<[ptr]>, const char *<[file]>);
34 DESCRIPTION
35 This is a reentrant version of <<unlink>>. It
36 takes a pointer to the global data block, which holds
37 <<errno>>.
40 int
41 _unlink_r (struct _reent *ptr,
42 const char *file)
44 int ret;
46 errno = 0;
47 if ((ret = _unlink (file)) == -1 && errno != 0)
48 _REENT_ERRNO(ptr) = errno;
49 return ret;
52 #endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */