source: trunk/libs/newlib/src/newlib/libc/reent/unlinkr.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.1 KB
Line 
1/* Reentrant versions of file system calls.  These implementations
2   just call the usual system calls.  */
3
4#include <reent.h>
5#include <unistd.h>
6#include <_syslist.h>
7
8/* Some targets provides their own versions of these 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.  */
20#undef errno
21extern int errno;
22
23/*
24FUNCTION
25        <<_unlink_r>>---Reentrant version of unlink
26       
27INDEX
28        _unlink_r
29
30SYNOPSIS
31        #include <reent.h>
32        int _unlink_r(struct _reent *<[ptr]>, const char *<[file]>);
33
34DESCRIPTION
35        This is a reentrant version of <<unlink>>.  It
36        takes a pointer to the global data block, which holds
37        <<errno>>.
38*/
39
40int
41_unlink_r (struct _reent *ptr,
42     const char *file)
43{
44  int ret;
45
46  errno = 0;
47  if ((ret = _unlink (file)) == -1 && errno != 0)
48    ptr->_errno = errno;
49  return ret;
50}
51
52#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */
Note: See TracBrowser for help on using the repository browser.