source: trunk/libs/newlib/src/newlib/libc/reent/linkr.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#ifdef REENTRANT_SYSCALLS_PROVIDED
18
19int _dummy_link_syscalls = 1;
20
21#else
22
23/* We use the errno variable used by the system dependent layer.  */
24#undef errno
25extern int errno;
26
27/*
28FUNCTION
29        <<_link_r>>---Reentrant version of link
30       
31INDEX
32        _link_r
33
34SYNOPSIS
35        #include <reent.h>
36        int _link_r(struct _reent *<[ptr]>,
37                    const char *<[old]>, const char *<[new]>);
38
39DESCRIPTION
40        This is a reentrant version of <<link>>.  It
41        takes a pointer to the global data block, which holds
42        <<errno>>.
43*/
44
45int
46_link_r (struct _reent *ptr,
47     const char *old,
48     const char *new)
49{
50  int ret;
51
52  errno = 0;
53  if ((ret = _link (old, new)) == -1 && errno != 0)
54    ptr->_errno = errno;
55  return ret;
56}
57
58#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */
Note: See TracBrowser for help on using the repository browser.