fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / gcc / newlib / libc / reent / unlinkr.c
blob95b815f1be475deea3d6ebf196ca404805a7afa7
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 ANSI_SYNOPSIS
31 #include <reent.h>
32 int _unlink_r(struct _reent *<[ptr]>, const char *<[file]>);
34 TRAD_SYNOPSIS
35 #include <reent.h>
36 int _unlink_r(<[ptr]>, <[file]>)
37 struct _reent *<[ptr]>;
38 char *<[file]>;
40 DESCRIPTION
41 This is a reentrant version of <<unlink>>. It
42 takes a pointer to the global data block, which holds
43 <<errno>>.
46 int
47 _DEFUN (_unlink_r, (ptr, file),
48 struct _reent *ptr _AND
49 _CONST char *file)
51 int ret;
53 errno = 0;
54 if ((ret = _unlink (file)) == -1 && errno != 0)
55 ptr->_errno = errno;
56 return ret;
59 #endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */