diff options
author | cvs2svn <> | 2002-09-22 16:04:16 +0400 |
---|---|---|
committer | cvs2svn <> | 2002-09-22 16:04:16 +0400 |
commit | b9fbe9492e000511d0b2b7db6b81c0fc98ab6f80 (patch) | |
tree | 9bc675d4928360fc4998eb5a43727fd1a4ce427d /winsup/cygwin/exec.cc | |
parent | 9783ce28caf426c5ab39d1d6aefa31cfdb1b8234 (diff) |
This commit was manufactured by cvs2svn to create tag 'ZZ-cygwin_daemon_merge-new_HEAD
-cygwin_daemon_merge-new_HEAD'.
Sprout from cygwin_daemon 2002-01-02 00:06:36 UTC cvs2svn 'This commit was manufactured by cvs2svn to create branch 'cygwin_daemon'.'
Cherrypick from cygwin_daemon 2002-02-25 17:47:52 UTC cvs2svn 'This commit was manufactured by cvs2svn to create branch 'cygwin_daemon'.':
winsup/cygwin/how-spawn-works.txt
winsup/cygwin/wsock_event.h
Cherrypick from cygwin_daemon 2002-06-06 15:35:10 UTC cvs2svn 'This commit was manufactured by cvs2svn to create branch 'cygwin_daemon'.':
winsup/cygwin/include/netinet/udp.h
winsup/cygwin/stackdump.sgml
Cherrypick from cygwin_daemon 2002-01-17 10:39:38 UTC cvs2svn 'This commit was manufactured by cvs2svn to create branch 'cygwin_daemon'.':
winsup/cygwin/libc/fnmatch.c
Cherrypick from cygwin_daemon 2002-07-03 20:31:40 UTC cvs2svn 'This commit was manufactured by cvs2svn to create branch 'cygwin_daemon'.':
winsup/cygwin/include/sys/statfs.h
Cherrypick from cygwin_daemon 2002-09-04 15:17:25 UTC cvs2svn 'This commit was manufactured by cvs2svn to create branch 'cygwin_daemon'.':
winsup/cygwin/how-autoload-works.txt
Cherrypick from master 2002-09-22 12:04:15 UTC Conrad Scott <conrad.scott@dsl.pipex.com> '2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>':
winsup/cygserver/threaded_queue.cc
winsup/cygserver/woutsup.h
winsup/cygwin/CYGWIN_LICENSE
winsup/cygwin/ChangeLog
winsup/cygwin/ChangeLog-1998
winsup/cygwin/ChangeLog-1999
winsup/cygwin/ChangeLog-2000
winsup/cygwin/Makefile.in
winsup/cygwin/assert.cc
winsup/cygwin/autoload.cc
winsup/cygwin/child_info.h
winsup/cygwin/configure
winsup/cygwin/configure.in
winsup/cygwin/cygerrno.h
winsup/cygwin/cygheap.cc
winsup/cygwin/cygheap.h
winsup/cygwin/cygmagic
winsup/cygwin/cygmalloc.h
winsup/cygwin/cygrun.c
winsup/cygwin/cygserver.cc
winsup/cygwin/cygserver_client.cc
winsup/cygwin/cygserver_ipc.h
winsup/cygwin/cygserver_process.cc
winsup/cygwin/cygserver_shm.cc
winsup/cygwin/cygserver_shm.h
winsup/cygwin/cygserver_transport.cc
winsup/cygwin/cygserver_transport_pipes.cc
winsup/cygwin/cygserver_transport_sockets.cc
winsup/cygwin/cygthread.cc
winsup/cygwin/cygthread.h
winsup/cygwin/cygwin.din
winsup/cygwin/cygwin.sc
winsup/cygwin/dcrt0.cc
winsup/cygwin/debug.cc
winsup/cygwin/debug.h
winsup/cygwin/dir.cc
winsup/cygwin/dlfcn.cc
winsup/cygwin/dll_init.cc
winsup/cygwin/dll_init.h
winsup/cygwin/dlmalloc.c
winsup/cygwin/dtable.cc
winsup/cygwin/dtable.h
winsup/cygwin/environ.cc
winsup/cygwin/environ.h
winsup/cygwin/errno.cc
winsup/cygwin/exceptions.cc
winsup/cygwin/exec.cc
winsup/cygwin/external.cc
winsup/cygwin/fcntl.cc
winsup/cygwin/fhandler.cc
winsup/cygwin/fhandler.h
winsup/cygwin/fhandler_clipboard.cc
winsup/cygwin/fhandler_console.cc
winsup/cygwin/fhandler_disk_file.cc
winsup/cygwin/fhandler_dsp.cc
winsup/cygwin/fhandler_floppy.cc
winsup/cygwin/fhandler_mem.cc
winsup/cygwin/fhandler_proc.cc
winsup/cygwin/fhandler_process.cc
winsup/cygwin/fhandler_random.cc
winsup/cygwin/fhandler_raw.cc
winsup/cygwin/fhandler_registry.cc
winsup/cygwin/fhandler_serial.cc
winsup/cygwin/fhandler_socket.cc
winsup/cygwin/fhandler_tape.cc
winsup/cygwin/fhandler_termios.cc
winsup/cygwin/fhandler_tty.cc
winsup/cygwin/fhandler_virtual.cc
winsup/cygwin/fhandler_windows.cc
winsup/cygwin/fhandler_zero.cc
winsup/cygwin/fork.cc
winsup/cygwin/glob.c
winsup/cygwin/gmon.c
winsup/cygwin/grp.cc
winsup/cygwin/heap.cc
winsup/cygwin/heap.h
winsup/cygwin/hires.h
winsup/cygwin/how-cygheap-works.txt
winsup/cygwin/how-fhandlers-work.txt
winsup/cygwin/how-signals-work.txt
winsup/cygwin/how-to-debug-cygwin.txt
winsup/cygwin/include/cygwin/acl.h
winsup/cygwin/include/cygwin/cygserver.h
winsup/cygwin/include/cygwin/cygserver_process.h
winsup/cygwin/include/cygwin/cygserver_transport.h
winsup/cygwin/include/cygwin/cygserver_transport_pipes.h
winsup/cygwin/include/cygwin/cygserver_transport_sockets.h
winsup/cygwin/include/cygwin/grp.h
winsup/cygwin/include/cygwin/if.h
winsup/cygwin/include/cygwin/ipc.h
winsup/cygwin/include/cygwin/msg.h
winsup/cygwin/include/cygwin/mtio.h
winsup/cygwin/include/cygwin/sem.h
winsup/cygwin/include/cygwin/shm.h
winsup/cygwin/include/cygwin/socket.h
winsup/cygwin/include/cygwin/stat.h
winsup/cygwin/include/cygwin/types.h
winsup/cygwin/include/cygwin/version.h
winsup/cygwin/include/fnmatch.h
winsup/cygwin/include/getopt.h
winsup/cygwin/include/glob.h
winsup/cygwin/include/limits.h
winsup/cygwin/include/netdb.h
winsup/cygwin/include/netinet/ip.h
winsup/cygwin/include/netinet/tcp.h
winsup/cygwin/include/pthread.h
winsup/cygwin/include/sys/cygwin.h
winsup/cygwin/include/sys/ioctl.h
winsup/cygwin/include/sys/mount.h
winsup/cygwin/include/sys/resource.h
winsup/cygwin/include/sys/socket.h
winsup/cygwin/include/sys/soundcard.h
winsup/cygwin/include/sys/strace.h
winsup/cygwin/include/sys/sysmacros.h
winsup/cygwin/include/sys/termios.h
winsup/cygwin/include/sys/uio.h
winsup/cygwin/include/sys/un.h
winsup/cygwin/include/sys/vfs.h
winsup/cygwin/init.cc
winsup/cygwin/ioctl.cc
winsup/cygwin/ipc.cc
winsup/cygwin/lib/cygwin_crt0.c
winsup/cygwin/lib/dll_main.cc
winsup/cygwin/lib/getopt.c
winsup/cygwin/localtime.cc
winsup/cygwin/malloc.cc
winsup/cygwin/malloc_wrapper.cc
winsup/cygwin/miscfuncs.cc
winsup/cygwin/mkvers.sh
winsup/cygwin/mmap.cc
winsup/cygwin/msg.cc
winsup/cygwin/net.cc
winsup/cygwin/ntdll.h
winsup/cygwin/ntea.cc
winsup/cygwin/passwd.cc
winsup/cygwin/path.cc
winsup/cygwin/path.h
winsup/cygwin/perthread.h
winsup/cygwin/pinfo.cc
winsup/cygwin/pinfo.h
winsup/cygwin/pipe.cc
winsup/cygwin/poll.cc
winsup/cygwin/pthread.cc
winsup/cygwin/pwdgrp.h
winsup/cygwin/regex/regcomp.c
winsup/cygwin/registry.cc
winsup/cygwin/resource.cc
winsup/cygwin/safe_memory.h
winsup/cygwin/sched.cc
winsup/cygwin/sec_acl.cc
winsup/cygwin/sec_helper.cc
winsup/cygwin/security.cc
winsup/cygwin/security.h
winsup/cygwin/select.cc
winsup/cygwin/sem.cc
winsup/cygwin/shared.cc
winsup/cygwin/shared_info.h
winsup/cygwin/shm.cc
winsup/cygwin/signal.cc
winsup/cygwin/sigproc.cc
winsup/cygwin/sigproc.h
winsup/cygwin/smallprint.c
winsup/cygwin/spawn.cc
winsup/cygwin/speclib
winsup/cygwin/strace.cc
winsup/cygwin/sync.cc
winsup/cygwin/sync.h
winsup/cygwin/syscalls.cc
winsup/cygwin/sysconf.cc
winsup/cygwin/syslog.cc
winsup/cygwin/termios.cc
winsup/cygwin/thread.cc
winsup/cygwin/thread.h
winsup/cygwin/threaded_queue.cc
winsup/cygwin/threaded_queue.h
winsup/cygwin/times.cc
winsup/cygwin/tty.cc
winsup/cygwin/tty.h
winsup/cygwin/uinfo.cc
winsup/cygwin/uname.cc
winsup/cygwin/wait.cc
winsup/cygwin/winbase.h
winsup/cygwin/wincap.cc
winsup/cygwin/wincap.h
winsup/cygwin/window.cc
winsup/cygwin/winsup.h
winsup/cygwin/winver.rc
winsup/cygwin/woutsup.h
Delete:
winsup/cygwin/include/cygwin/ip.h
winsup/cygwin/include/sys/ipc.h
winsup/cygwin/include/sys/shm.h
winsup/cygwin/include/wchar.h
winsup/cygwin/lib/_cygwin_S_IEXEC.cc
winsup/cygwin/regexp/regerror.c
winsup/cygwin/regexp/regexp.3
winsup/cygwin/regexp/regexp.c
winsup/cygwin/regexp/regsub.c
winsup/cygwin/shortcut.c
winsup/cygwin/shortcut.h
winsup/cygwin/test.c
Diffstat (limited to 'winsup/cygwin/exec.cc')
-rw-r--r-- | winsup/cygwin/exec.cc | 152 |
1 files changed, 20 insertions, 132 deletions
diff --git a/winsup/cygwin/exec.cc b/winsup/cygwin/exec.cc index 228aa69b0..942b79d83 100644 --- a/winsup/cygwin/exec.cc +++ b/winsup/cygwin/exec.cc @@ -1,6 +1,6 @@ /* exec.cc: exec system call support. - Copyright 1996, 1997, 1998, 2000, 2001 Red Hat, Inc. + Copyright 1996, 1997, 1998, 2000, 2001, 2002 Red Hat, Inc. This file is part of Cygwin. @@ -17,27 +17,24 @@ details. */ #include "security.h" #include "fhandler.h" #include "path.h" -#include "sync.h" -#include "sigproc.h" #include "pinfo.h" #include "environ.h" +#include "cygerrno.h" /* This is called _execve and not execve because the real execve is defined in libc/posix/execve.c. It calls us. */ -extern "C" -int +extern "C" int _execve (const char *path, char *const argv[], char *const envp[]) { static char *const empty_env[] = { 0 }; MALLOC_CHECK; if (!envp) envp = empty_env; - return _spawnve (NULL, _P_OVERLAY, path, argv, envp); + return spawnve (_P_OVERLAY, path, argv, envp); } -extern "C" -int +extern "C" int execl (const char *path, const char *arg0, ...) { int i; @@ -55,131 +52,18 @@ execl (const char *path, const char *arg0, ...) return _execve (path, (char * const *) argv, cur_environ ()); } -extern "C" -int +extern "C" int execv (const char *path, char * const *argv) { MALLOC_CHECK; return _execve (path, (char * const *) argv, cur_environ ()); } -/* the same as a standard exec() calls family, but with NT security support */ - -extern "C" -pid_t -sexecve (HANDLE hToken, const char *path, const char *const argv[], - const char *const envp[]) -{ - _spawnve (hToken, _P_OVERLAY, path, argv, envp); - return -1; -} - -extern "C" -int -sexecl (HANDLE hToken, const char *path, const char *arg0, ...) -{ - int i; - va_list args; - const char *argv[1024]; - - va_start (args, arg0); - argv[0] = arg0; - i = 1; - - do - argv[i] = va_arg (args, const char *); - while (argv[i++] != NULL); - - va_end (args); - - MALLOC_CHECK; - return sexecve (hToken, path, (char * const *) argv, cur_environ ()); -} - -extern "C" -int -sexecle (HANDLE hToken, const char *path, const char *arg0, ...) -{ - int i; - va_list args; - const char * const *envp; - const char *argv[1024]; - - va_start (args, arg0); - argv[0] = arg0; - i = 1; - - do - argv[i] = va_arg (args, const char *); - while (argv[i++] != NULL); - - envp = va_arg (args, const char * const *); - va_end (args); - - MALLOC_CHECK; - return sexecve(hToken, path, (char * const *) argv, (char * const *) envp); -} - -extern "C" -int -sexeclp (HANDLE hToken, const char *path, const char *arg0, ...) -{ - int i; - va_list args; - const char *argv[1024]; - - va_start (args, arg0); - argv[0] = arg0; - i = 1; - - do - argv[i] = va_arg (args, const char *); - while (argv[i++] != NULL); - - va_end (args); - - MALLOC_CHECK; - return sexecvpe (hToken, path, (const char * const *) argv, cur_environ ()); -} - -extern "C" -int -sexeclpe (HANDLE hToken, const char *path, const char *arg0, ...) -{ - int i; - va_list args; - const char * const *envp; - const char *argv[1024]; - - va_start (args, arg0); - argv[0] = arg0; - i = 1; - - do - argv[i] = va_arg (args, const char *); - while (argv[i++] != NULL); - - envp = va_arg (args, const char * const *); - va_end (args); - - MALLOC_CHECK; - return sexecvpe (hToken, path, argv, envp); -} - -extern "C" -int -sexecv (HANDLE hToken, const char *path, const char * const *argv) +extern "C" pid_t +sexecve_is_bad () { - MALLOC_CHECK; - return sexecve (hToken, path, argv, cur_environ ()); -} - -extern "C" -int -sexecp (HANDLE hToken, const char *path, const char * const *argv) -{ - MALLOC_CHECK; - return sexecvpe (hToken, path, argv, cur_environ ()); + set_errno (ENOSYS); + return 0; } /* @@ -199,12 +83,16 @@ strccpy (char *s1, const char **s2, char c) return s1; } -extern "C" -int -sexecvpe (HANDLE hToken, const char *file, const char * const *argv, - const char *const *envp) +extern "C" int +execvp (const char *path, char * const *argv) { path_conv buf; - MALLOC_CHECK; - return sexecve (hToken, find_exec (file, buf), argv, envp); + return execv (find_exec (path, buf), argv); +} + +extern "C" int +execvpe (const char *path, char * const *argv, char *const *envp) +{ + path_conv buf; + return execve (find_exec (path, buf), argv, envp); } |