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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [newlib/] [libc/] [reent/] [execr.c] - Blame information for rev 1778

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

Line No. Rev Author Line
1 39 lampret
/* Reentrant versions of execution system calls.  These
2
   implementations 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
/* If NO_EXEC is defined, we don't need these functions.  */
18
 
19
#if defined (REENTRANT_SYSCALLS_PROVIDED) || defined (NO_EXEC)
20
 
21
int _dummy_exec_syscalls = 1;
22
 
23
#else
24
 
25
/* We use the errno variable used by the system dependent layer.  */
26
#undef errno
27
extern int errno;
28
 
29
/*
30
FUNCTION
31 56 joel
        <<_execve_r>>---Reentrant version of execve
32
INDEX
33
        _execve_r
34
 
35
ANSI_SYNOPSIS
36
        #include <reent.h>
37
        int _execve_r(struct _reent *<[ptr]>, char *<[name]>,
38
                      char **<[argv]>, char **<[env]>);
39
 
40
TRAD_SYNOPSIS
41
        #include <reent.h>
42
        int _execve_r(<[ptr]>, <[name]>, <[argv]>, <[env]>)
43
        struct _reent *<[ptr]>;
44
        char *<[name]>;
45
        char **<[argv]>;
46
        char **<[env]>;
47
 
48
DESCRIPTION
49
        This is a reentrant version of <<execve>>.  It
50
        takes a pointer to the global data block, which holds
51
        <<errno>>.
52
*/
53
 
54
int
55
_execve_r (ptr, name, argv, env)
56
     struct _reent *ptr;
57
     char *name;
58
     char **argv;
59
     char **env;
60
{
61
  int ret;
62
 
63
  errno = 0;
64
  if ((ret = _execve (name, argv, env)) == -1 && errno != 0)
65
    ptr->_errno = errno;
66
  return ret;
67
}
68
 
69
 
70
/*
71
FUNCTION
72 39 lampret
        <<_fork_r>>---Reentrant version of fork
73
 
74
INDEX
75
        _fork_r
76
 
77
ANSI_SYNOPSIS
78
        #include <reent.h>
79
        int _fork_r(struct _reent *<[ptr]>);
80
 
81
TRAD_SYNOPSIS
82
        #include <reent.h>
83
        int _fork_r(<[ptr]>)
84
        struct _reent *<[ptr]>;
85
 
86
DESCRIPTION
87
        This is a reentrant version of <<fork>>.  It
88
        takes a pointer to the global data block, which holds
89
        <<errno>>.
90
*/
91
 
92
#ifndef NO_FORK
93
 
94
int
95
_fork_r (ptr)
96
     struct _reent *ptr;
97
{
98
  int ret;
99
 
100
  errno = 0;
101
  if ((ret = _fork ()) == -1 && errno != 0)
102
    ptr->_errno = errno;
103
  return ret;
104
}
105
 
106
#endif
107
 
108
/*
109
FUNCTION
110
        <<_wait_r>>---Reentrant version of wait
111
 
112
INDEX
113
        _wait_r
114
 
115
ANSI_SYNOPSIS
116
        #include <reent.h>
117
        int _wait_r(struct _reent *<[ptr]>, int *<[status]>);
118
 
119
TRAD_SYNOPSIS
120
        #include <reent.h>
121
        int _wait_r(<[ptr]>, <[status]>)
122
        struct _reent *<[ptr]>;
123
        int *<[status]>;
124
 
125
DESCRIPTION
126
        This is a reentrant version of <<wait>>.  It
127
        takes a pointer to the global data block, which holds
128
        <<errno>>.
129
*/
130
 
131
int
132
_wait_r (ptr, status)
133
     struct _reent *ptr;
134
     int *status;
135
{
136
  int ret;
137
 
138
  errno = 0;
139
  if ((ret = _wait (status)) == -1 && errno != 0)
140
    ptr->_errno = errno;
141
  return ret;
142
}
143
 
144
#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.