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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [newlib/] [libc/] [reent/] [linkr.c] - Blame information for rev 39

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 39 lampret
/* 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
_link_r (ptr, old, new)
54
     struct _reent *ptr;
55
     _CONST char *old;
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
/*
67
FUNCTION
68
        <<_unlink_r>>---Reentrant version of unlink
69
 
70
INDEX
71
        _unlink_r
72
 
73
ANSI_SYNOPSIS
74
        #include <reent.h>
75
        int _unlink_r(struct _reent *<[ptr]>, const char *<[file]>);
76
 
77
TRAD_SYNOPSIS
78
        #include <reent.h>
79
        int _unlink_r(<[ptr]>, <[file]>)
80
        struct _reent *<[ptr]>;
81
        char *<[file]>;
82
 
83
DESCRIPTION
84
        This is a reentrant version of <<unlink>>.  It
85
        takes a pointer to the global data block, which holds
86
        <<errno>>.
87
*/
88
 
89
int
90
_unlink_r (ptr, file)
91
     struct _reent *ptr;
92
     _CONST char *file;
93
{
94
  int ret;
95
 
96
  errno = 0;
97
  if ((ret = _unlink (file)) == -1 && errno != 0)
98
    ptr->_errno = errno;
99
  return ret;
100
}
101
 
102
#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.