27
27
#include <sys/cdefs.h>
28
28
__FBSDID ("$FreeBSD$" );
29
29
30
- #include "namespace.h"
31
30
#include <sys/queue.h>
32
31
#include <sys/wait.h>
33
32
34
33
#include <errno.h>
35
34
#include <fcntl.h>
36
35
#include <sched.h>
37
- #include < spawn.h>
36
+ #include " spawn.h"
38
37
#include <signal.h>
39
38
#include <stdlib.h>
40
39
#include <string.h>
41
40
#include <unistd.h>
42
- #include "un-namespace.h"
43
- #include "libc_private.h"
44
41
45
42
extern char * * environ ;
46
43
@@ -85,6 +82,7 @@ typedef struct __posix_spawn_file_actions_entry {
85
82
static int
86
83
process_spawnattr (const posix_spawnattr_t sa )
87
84
{
85
+ #if 0
88
86
struct sigaction sigact = { .sa_flags = 0 , .sa_handler = SIG_DFL };
89
87
int i ;
90
88
@@ -133,6 +131,7 @@ process_spawnattr(const posix_spawnattr_t sa)
133
131
return (errno );
134
132
}
135
133
}
134
+ #endif
136
135
137
136
return (0 );
138
137
}
@@ -145,30 +144,30 @@ process_file_actions_entry(posix_spawn_file_actions_entry_t *fae)
145
144
switch (fae -> fae_action ) {
146
145
case FAE_OPEN :
147
146
/* Perform an open(), make it use the right fd */
148
- fd = _open (fae -> fae_path , fae -> fae_oflag , fae -> fae_mode );
147
+ fd = open (fae -> fae_path , fae -> fae_oflag , fae -> fae_mode );
149
148
if (fd < 0 )
150
149
return (errno );
151
150
if (fd != fae -> fae_fildes ) {
152
- if (_dup2 (fd , fae -> fae_fildes ) == -1 )
151
+ if (dup2 (fd , fae -> fae_fildes ) == -1 )
153
152
return (errno );
154
- if (_close (fd ) != 0 ) {
153
+ if (close (fd ) != 0 ) {
155
154
if (errno == EBADF )
156
155
return (EBADF );
157
156
}
158
157
}
159
- if (_fcntl (fae -> fae_fildes , F_SETFD , 0 ) == -1 )
158
+ if (fcntl (fae -> fae_fildes , F_SETFD , 0 ) == -1 )
160
159
return (errno );
161
160
break ;
162
161
case FAE_DUP2 :
163
162
/* Perform a dup2() */
164
- if (_dup2 (fae -> fae_fildes , fae -> fae_newfildes ) == -1 )
163
+ if (dup2 (fae -> fae_fildes , fae -> fae_newfildes ) == -1 )
165
164
return (errno );
166
- if (_fcntl (fae -> fae_newfildes , F_SETFD , 0 ) == -1 )
165
+ if (fcntl (fae -> fae_newfildes , F_SETFD , 0 ) == -1 )
167
166
return (errno );
168
167
break ;
169
168
case FAE_CLOSE :
170
169
/* Perform a close(), do not fail if already closed */
171
- (void )_close (fae -> fae_fildes );
170
+ (void )close (fae -> fae_fildes );
172
171
break ;
173
172
}
174
173
return (0 );
@@ -198,7 +197,7 @@ do_posix_spawn(pid_t *pid, const char *path,
198
197
pid_t p ;
199
198
volatile int error = 0 ;
200
199
201
- p = vfork ();
200
+ p = fork ();
202
201
switch (p ) {
203
202
case -1 :
204
203
return (errno );
@@ -213,15 +212,15 @@ do_posix_spawn(pid_t *pid, const char *path,
213
212
if (error )
214
213
_exit (127 );
215
214
}
216
- if (use_env_path )
217
- _execvpe (path , argv , envp != NULL ? envp : environ );
218
- else
219
- _execve (path , argv , envp != NULL ? envp : environ );
215
+ // if (use_env_path)
216
+ // execvpe (path, argv, envp != NULL ? envp : environ);
217
+ // else
218
+ execve (path , argv , envp != NULL ? envp : environ );
220
219
error = errno ;
221
220
_exit (127 );
222
221
default :
223
222
if (error != 0 )
224
- _waitpid (p , NULL , WNOHANG );
223
+ waitpid (p , NULL , WNOHANG );
225
224
else if (pid != NULL )
226
225
* pid = p ;
227
226
return (error );
0 commit comments