OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-newlib/] [newlib-1.17.0/] [newlib/] [libc/] [reent/] [linkr.c] - Blame information for rev 9

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 9 jlechner
/* 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
 
19
int _dummy_link_syscalls = 1;
20
 
21
#else
22
 
23
/* We use the errno variable used by the system dependent layer.  */
24
#undef errno
25
extern int errno;
26
 
27
/*
28
FUNCTION
29
        <<_link_r>>---Reentrant version of link
30
 
31
INDEX
32
        _link_r
33
 
34
ANSI_SYNOPSIS
35
        #include <reent.h>
36
        int _link_r(struct _reent *<[ptr]>,
37
                    const char *<[old]>, const char *<[new]>);
38
 
39
TRAD_SYNOPSIS
40
        #include <reent.h>
41
        int _link_r(<[ptr]>, <[old]>, <[new]>)
42
        struct _reent *<[ptr]>;
43
        char *<[old]>;
44
        char *<[new]>;
45
 
46
DESCRIPTION
47
        This is a reentrant version of <<link>>.  It
48
        takes a pointer to the global data block, which holds
49
        <<errno>>.
50
*/
51
 
52
int
53
_DEFUN (_link_r, (ptr, old, new),
54
     struct _reent *ptr _AND
55
     _CONST char *old _AND
56
     _CONST char *new)
57
{
58
  int ret;
59
 
60
  errno = 0;
61
  if ((ret = _link (old, new)) == -1 && errno != 0)
62
    ptr->_errno = errno;
63
  return ret;
64
}
65
 
66
#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.