1 /* exec.cc: exec system call support.
3 This file is part of Cygwin.
5 This software is a copyrighted work licensed under the terms of the
6 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
22 execl (const char *path
, const char *arg0
, ...)
26 const char *argv
[1024];
28 va_start (args
, arg0
);
32 argv
[i
] = va_arg (args
, const char *);
33 while (argv
[i
++] != NULL
);
35 return spawnve (_P_OVERLAY
, path
, (char * const *) argv
, environ
);
39 execle (const char *path
, const char *arg0
, ...)
43 const char *argv
[1024];
44 const char * const *envp
;
46 va_start (args
, arg0
);
50 argv
[i
] = va_arg (args
, const char *);
51 while (argv
[i
++] != NULL
);
52 envp
= va_arg (args
, const char * const *);
54 return spawnve (_P_OVERLAY
, path
, (char * const *) argv
, envp
);
58 execlp (const char *file
, const char *arg0
, ...)
62 const char *argv
[1024];
65 va_start (args
, arg0
);
69 argv
[i
] = va_arg (args
, const char *);
70 while (argv
[i
++] != NULL
);
72 return spawnve (_P_OVERLAY
| _P_PATH_TYPE_EXEC
,
73 find_exec (file
, buf
, "PATH", FE_NNF
) ?: "",
74 (char * const *) argv
, environ
);
78 execv (const char *path
, char * const *argv
)
80 return spawnve (_P_OVERLAY
, path
, argv
, environ
);
84 execve (const char *path
, char *const argv
[], char *const envp
[])
86 return spawnve (_P_OVERLAY
, path
, argv
, envp
);
88 EXPORT_ALIAS (execve
, _execve
) /* For newlib */
91 execvp (const char *file
, char * const *argv
)
95 return spawnve (_P_OVERLAY
| _P_PATH_TYPE_EXEC
,
96 find_exec (file
, buf
, "PATH", FE_NNF
) ?: "",
101 execvpe (const char *file
, char * const *argv
, char *const *envp
)
105 return spawnve (_P_OVERLAY
| _P_PATH_TYPE_EXEC
,
106 find_exec (file
, buf
, "PATH", FE_NNF
) ?: "",
111 fexecve (int fd
, char * const *argv
, char *const *envp
)
113 cygheap_fdget
cfd (fd
);
116 syscall_printf ("-1 = fexecve (%d, %p, %p)", fd
, argv
, envp
);
120 return spawnve (_P_OVERLAY
, cfd
->pc
.get_win32 (), argv
, envp
);