diff options
author | Christopher Faylor <me@cgf.cx> | 2004-02-03 00:00:07 +0300 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2004-02-03 00:00:07 +0300 |
commit | 528060195ca6c38619782fc51a89a4585b816f03 (patch) | |
tree | 2650abdaf1261256490a480d841a61f8edea7c72 /winsup/cygwin | |
parent | 6027d26d8b829833f716743acfb6881bb4236627 (diff) |
* fhandler.h (*::fixup_after_exec): Eliminate unused handle argument.
* fhandler.h (dtable::fixup_after_exec): Eliminate unused handle argument.
* dcrt0.cc (dll_crt0_1): Reflect elimination of unused handle argument to
fixup_after_exec.
* dtable.cc (dtable::fixup_after_exec): Ditto.
* fhandler_console.cc (fhandler_console::fixup_after_exec): Ditto.
* fhandler_dsp.cc (fhandler_dsp::fixup_after_exec): Ditto.
* fhandler_raw.cc (fhandler_raw::fixup_after_exec): Ditto.
* fhandler_socket.cc (fhandler_socket::fixup_after_exec): Ditto.
* fhandler_virtual.cc (fhandler_virtual::fixup_after_exec): Ditto.
* pipe.cc (fhandler_pipe::fixup_after_exec): Ditto.
* spawn.cc (spawn_guts): Do not set ciresrv.parent.
* child_info.h (child_info_spawn::~child_info_spawn): Do not close parent.
Update CURR_CHILD_INFO_MAGIC.
* dcrt0.cc (dll_crt0_0): Do not close spawn_info->parent. Pass NULL to
cygheap->fdtab.fixup_after_exec().
Diffstat (limited to 'winsup/cygwin')
-rw-r--r-- | winsup/cygwin/ChangeLog | 23 | ||||
-rw-r--r-- | winsup/cygwin/child_info.h | 6 | ||||
-rw-r--r-- | winsup/cygwin/dcrt0.cc | 3 | ||||
-rw-r--r-- | winsup/cygwin/dtable.cc | 4 | ||||
-rw-r--r-- | winsup/cygwin/dtable.h | 2 | ||||
-rw-r--r-- | winsup/cygwin/fhandler.h | 18 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_console.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_dsp.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_raw.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_serial.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_socket.cc | 4 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_virtual.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/pipe.cc | 4 | ||||
-rw-r--r-- | winsup/cygwin/spawn.cc | 9 |
14 files changed, 48 insertions, 35 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 87d4ee565..9413511a7 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,28 @@ 2004-02-02 Christopher Faylor <cgf@redhat.com> + * fhandler.h (*::fixup_after_exec): Eliminate unused handle argument. + * fhandler.h (dtable::fixup_after_exec): Eliminate unused handle + argument. + * dcrt0.cc (dll_crt0_1): Reflect elimination of unused handle argument + to fixup_after_exec. + * dtable.cc (dtable::fixup_after_exec): Ditto. + * fhandler_console.cc (fhandler_console::fixup_after_exec): Ditto. + * fhandler_dsp.cc (fhandler_dsp::fixup_after_exec): Ditto. + * fhandler_raw.cc (fhandler_raw::fixup_after_exec): Ditto. + * fhandler_socket.cc (fhandler_socket::fixup_after_exec): Ditto. + * fhandler_virtual.cc (fhandler_virtual::fixup_after_exec): Ditto. + * pipe.cc (fhandler_pipe::fixup_after_exec): Ditto. + +2004-02-02 Pierre Humblet <pierre.humblet@ieee.org> + + * spawn.cc (spawn_guts): Do not set ciresrv.parent. + * child_info.h (child_info_spawn::~child_info_spawn): Do not close + parent. Update CURR_CHILD_INFO_MAGIC. + * dcrt0.cc (dll_crt0_0): Do not close spawn_info->parent. Pass NULL to + cygheap->fdtab.fixup_after_exec(). + +2004-02-02 Christopher Faylor <cgf@redhat.com> + Throughout, change name from set_inheritance to set_no_inheritance to better reflect input arguments of this function. diff --git a/winsup/cygwin/child_info.h b/winsup/cygwin/child_info.h index da14cc2b5..4088477fc 100644 --- a/winsup/cygwin/child_info.h +++ b/winsup/cygwin/child_info.h @@ -1,6 +1,6 @@ /* child_info.h: shared child info for cygwin - Copyright 2000, 2001, 2002 Red Hat, Inc. + Copyright 2000, 2001, 2002, 2003, 2004 Red Hat, Inc. This file is part of Cygwin. @@ -29,7 +29,7 @@ enum #define EXEC_MAGIC_SIZE sizeof(child_info) -#define CURR_CHILD_INFO_MAGIC 0x1e4c5751U +#define CURR_CHILD_INFO_MAGIC 0x4239088U /* NOTE: Do not make gratuitous changes to the names or organization of the below class. The layout is checksummed to determine compatibility between @@ -88,8 +88,6 @@ public: child_info_spawn (): moreinfo (NULL) {} ~child_info_spawn () { - if (parent) - CloseHandle (parent); if (moreinfo) { if (moreinfo->old_title) diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 0cc5b96c6..a53a27cd1 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -703,9 +703,8 @@ dll_crt0_0 () envp = spawn_info->moreinfo->envp; envc = spawn_info->moreinfo->envc; envp = spawn_info->moreinfo->envp; - cygheap->fdtab.fixup_after_exec (spawn_info->parent); + cygheap->fdtab.fixup_after_exec (); signal_fixup_after_exec (); - CloseHandle (spawn_info->parent); if (spawn_info->moreinfo->old_title) { old_title = strcpy (title_buf, spawn_info->moreinfo->old_title); diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index e7e6f1732..255278978 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -659,7 +659,7 @@ dtable::set_file_pointers_for_exec () } void -dtable::fixup_after_exec (HANDLE parent) +dtable::fixup_after_exec () { first_fd_for_open = 0; fhandler_base *fh; @@ -676,7 +676,7 @@ dtable::fixup_after_exec (HANDLE parent) } else { - fh->fixup_after_exec (parent); + fh->fixup_after_exec (); if (i == 0) SetStdHandle (std_consts[i], fh->get_io_handle ()); else if (i <= 2) diff --git a/winsup/cygwin/dtable.h b/winsup/cygwin/dtable.h index 16aefa5d2..5732ed531 100644 --- a/winsup/cygwin/dtable.h +++ b/winsup/cygwin/dtable.h @@ -67,7 +67,7 @@ public: void release (int fd); void init_std_file_from_handle (int fd, HANDLE handle); int dup2 (int oldfd, int newfd); - void fixup_after_exec (HANDLE); + void fixup_after_exec (); inline fhandler_base *&operator [](int fd) const { return fds[fd]; } select_record *select_read (int fd, select_record *s); select_record *select_write (int fd, select_record *s); diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 409695022..13b8a5e7c 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -211,7 +211,7 @@ class fhandler_base virtual void fixup_before_fork_exec (DWORD) {} virtual void fixup_after_fork (HANDLE); - virtual void fixup_after_exec (HANDLE) {} + virtual void fixup_after_exec () {} bool get_symlink_p () { return FHISSETF (SYMLINK); } void set_symlink_p (int val) { FHCONDSETF (val, SYMLINK); } @@ -424,7 +424,7 @@ class fhandler_socket: public fhandler_base void set_close_on_exec (int val); virtual void fixup_before_fork_exec (DWORD); void fixup_after_fork (HANDLE); - void fixup_after_exec (HANDLE); + void fixup_after_exec (); bool need_fixup_before () const {return true;} select_record *select_read (select_record *s); @@ -467,7 +467,7 @@ public: int dup (fhandler_base *child); int ioctl (unsigned int cmd, void *); void fixup_after_fork (HANDLE); - void fixup_after_exec (HANDLE); + void fixup_after_exec (); bool hit_eof (); void set_eof () {broken_pipe = true;} HANDLE get_guard () const {return guard;} @@ -539,7 +539,7 @@ class fhandler_dev_raw: public fhandler_base int ioctl (unsigned int cmd, void *buf); void fixup_after_fork (HANDLE); - void fixup_after_exec (HANDLE); + void fixup_after_exec (); }; class fhandler_dev_floppy: public fhandler_dev_raw @@ -676,7 +676,7 @@ class fhandler_serial: public fhandler_base void dump (); int is_tty () { return 1; } void fixup_after_fork (HANDLE parent); - void fixup_after_exec (HANDLE); + void fixup_after_exec (); /* We maintain a pgrp so that tcsetpgrp and tcgetpgrp work, but we don't use it for permissions checking. fhandler_tty_slave does @@ -721,7 +721,7 @@ class fhandler_termios: public fhandler_base virtual DWORD __acquire_output_mutex (const char *fn, int ln, DWORD ms) {return 1;} virtual void __release_output_mutex (const char *fn, int ln) {} void fixup_after_fork (HANDLE); - void fixup_after_exec (HANDLE parent) { fixup_after_fork (parent); } + void fixup_after_exec () { fixup_after_fork (NULL); } void echo_erase (int force = 0); virtual _off64_t lseek (_off64_t, int); }; @@ -853,7 +853,7 @@ class fhandler_console: public fhandler_termios select_record *select_read (select_record *s); select_record *select_write (select_record *s); select_record *select_except (select_record *s); - void fixup_after_exec (HANDLE); + void fixup_after_exec (); void set_close_on_exec (int val); void fixup_after_fork (HANDLE parent); void set_input_state (); @@ -1106,7 +1106,7 @@ class fhandler_dev_dsp : public fhandler_base int close (void); int dup (fhandler_base *child); void dump (void); - void fixup_after_exec (HANDLE); + void fixup_after_exec (); }; class fhandler_virtual : public fhandler_base @@ -1136,7 +1136,7 @@ class fhandler_virtual : public fhandler_base int close (void); int __stdcall fstat (struct stat *buf) __attribute__ ((regparm (2))); virtual bool fill_filebuf (); - void fixup_after_exec (HANDLE); + void fixup_after_exec (); }; class fhandler_proc: public fhandler_virtual diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index 9355f5933..2afb595d3 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -1785,7 +1785,7 @@ set_console_title (char *title) } void -fhandler_console::fixup_after_exec (HANDLE) +fhandler_console::fixup_after_exec () { HANDLE h = get_handle (); HANDLE oh = get_output_handle (); diff --git a/winsup/cygwin/fhandler_dsp.cc b/winsup/cygwin/fhandler_dsp.cc index 3c577a89e..2726ea4bf 100644 --- a/winsup/cygwin/fhandler_dsp.cc +++ b/winsup/cygwin/fhandler_dsp.cc @@ -646,7 +646,7 @@ fhandler_dev_dsp::dump () } void -fhandler_dev_dsp::fixup_after_exec (HANDLE) +fhandler_dev_dsp::fixup_after_exec () { /* FIXME: Is there a better way to do this? */ s_audio = new (audio_buf) Audio; diff --git a/winsup/cygwin/fhandler_raw.cc b/winsup/cygwin/fhandler_raw.cc index eb721a7e8..2e6714321 100644 --- a/winsup/cygwin/fhandler_raw.cc +++ b/winsup/cygwin/fhandler_raw.cc @@ -508,7 +508,7 @@ fhandler_dev_raw::fixup_after_fork (HANDLE) } void -fhandler_dev_raw::fixup_after_exec (HANDLE) +fhandler_dev_raw::fixup_after_exec () { if (devbufsiz > 1L) devbuf = new char [devbufsiz]; diff --git a/winsup/cygwin/fhandler_serial.cc b/winsup/cygwin/fhandler_serial.cc index c5e1f6d98..7934224d7 100644 --- a/winsup/cygwin/fhandler_serial.cc +++ b/winsup/cygwin/fhandler_serial.cc @@ -1031,7 +1031,7 @@ fhandler_serial::fixup_after_fork (HANDLE parent) } void -fhandler_serial::fixup_after_exec (HANDLE) +fhandler_serial::fixup_after_exec () { overlapped_setup (); debug_printf ("io_status.hEvent %p", io_status.hEvent); diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 4285c87e5..6173460ef 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -303,11 +303,11 @@ fhandler_socket::fixup_after_fork (HANDLE parent) } void -fhandler_socket::fixup_after_exec (HANDLE parent) +fhandler_socket::fixup_after_exec () { debug_printf ("here"); if (!get_close_on_exec ()) - fixup_after_fork (parent); + fixup_after_fork (NULL); #if 0 else if (!winsock2_active) closesocket (get_socket ()); diff --git a/winsup/cygwin/fhandler_virtual.cc b/winsup/cygwin/fhandler_virtual.cc index 74d25bd6f..bada27cfb 100644 --- a/winsup/cygwin/fhandler_virtual.cc +++ b/winsup/cygwin/fhandler_virtual.cc @@ -37,7 +37,7 @@ fhandler_virtual::~fhandler_virtual () } void -fhandler_virtual::fixup_after_exec (HANDLE) +fhandler_virtual::fixup_after_exec () { if (filebuf) filebuf = NULL; diff --git a/winsup/cygwin/pipe.cc b/winsup/cygwin/pipe.cc index 9f9909910..e46eb7b72 100644 --- a/winsup/cygwin/pipe.cc +++ b/winsup/cygwin/pipe.cc @@ -123,7 +123,7 @@ fhandler_pipe::hit_eof () } void -fhandler_pipe::fixup_after_exec (HANDLE parent) +fhandler_pipe::fixup_after_exec () { if (read_state) { @@ -140,7 +140,7 @@ fhandler_pipe::fixup_after_fork (HANDLE parent) fork_fixup (parent, guard, "guard"); if (writepipe_exists) fork_fixup (parent, writepipe_exists, "guard"); - fixup_after_exec (parent); + fixup_after_exec (); } int diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 653fdd5e1..e5246b8d0 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -397,14 +397,7 @@ spawn_guts (const char * prog_arg, const char *const *argv, init_child_info (chtype, &ciresrv, (mode == _P_OVERLAY) ? myself->pid : 1, subproc_ready); - if (!DuplicateHandle (hMainProc, hMainProc, hMainProc, &ciresrv.parent, 0, 1, - DUPLICATE_SAME_ACCESS)) - { - system_printf ("couldn't create handle to myself for child, %E"); - return -1; - } - - VerifyHandle (ciresrv.parent); + ciresrv.moreinfo = (cygheap_exec_info *) ccalloc (HEAP_1_EXEC, 1, sizeof (cygheap_exec_info)); ciresrv.moreinfo->old_title = NULL; |