* 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().
This commit is contained in:
parent
6027d26d8b
commit
528060195c
|
@ -1,3 +1,26 @@
|
||||||
|
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>
|
2004-02-02 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
Throughout, change name from set_inheritance to set_no_inheritance to
|
Throughout, change name from set_inheritance to set_no_inheritance to
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* child_info.h: shared child info for cygwin
|
/* 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.
|
This file is part of Cygwin.
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ enum
|
||||||
|
|
||||||
#define EXEC_MAGIC_SIZE sizeof(child_info)
|
#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
|
/* NOTE: Do not make gratuitous changes to the names or organization of the
|
||||||
below class. The layout is checksummed to determine compatibility between
|
below class. The layout is checksummed to determine compatibility between
|
||||||
|
@ -88,8 +88,6 @@ public:
|
||||||
child_info_spawn (): moreinfo (NULL) {}
|
child_info_spawn (): moreinfo (NULL) {}
|
||||||
~child_info_spawn ()
|
~child_info_spawn ()
|
||||||
{
|
{
|
||||||
if (parent)
|
|
||||||
CloseHandle (parent);
|
|
||||||
if (moreinfo)
|
if (moreinfo)
|
||||||
{
|
{
|
||||||
if (moreinfo->old_title)
|
if (moreinfo->old_title)
|
||||||
|
|
|
@ -703,9 +703,8 @@ dll_crt0_0 ()
|
||||||
envp = spawn_info->moreinfo->envp;
|
envp = spawn_info->moreinfo->envp;
|
||||||
envc = spawn_info->moreinfo->envc;
|
envc = spawn_info->moreinfo->envc;
|
||||||
envp = spawn_info->moreinfo->envp;
|
envp = spawn_info->moreinfo->envp;
|
||||||
cygheap->fdtab.fixup_after_exec (spawn_info->parent);
|
cygheap->fdtab.fixup_after_exec ();
|
||||||
signal_fixup_after_exec ();
|
signal_fixup_after_exec ();
|
||||||
CloseHandle (spawn_info->parent);
|
|
||||||
if (spawn_info->moreinfo->old_title)
|
if (spawn_info->moreinfo->old_title)
|
||||||
{
|
{
|
||||||
old_title = strcpy (title_buf, spawn_info->moreinfo->old_title);
|
old_title = strcpy (title_buf, spawn_info->moreinfo->old_title);
|
||||||
|
|
|
@ -659,7 +659,7 @@ dtable::set_file_pointers_for_exec ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dtable::fixup_after_exec (HANDLE parent)
|
dtable::fixup_after_exec ()
|
||||||
{
|
{
|
||||||
first_fd_for_open = 0;
|
first_fd_for_open = 0;
|
||||||
fhandler_base *fh;
|
fhandler_base *fh;
|
||||||
|
@ -676,7 +676,7 @@ dtable::fixup_after_exec (HANDLE parent)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fh->fixup_after_exec (parent);
|
fh->fixup_after_exec ();
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
SetStdHandle (std_consts[i], fh->get_io_handle ());
|
SetStdHandle (std_consts[i], fh->get_io_handle ());
|
||||||
else if (i <= 2)
|
else if (i <= 2)
|
||||||
|
|
|
@ -67,7 +67,7 @@ public:
|
||||||
void release (int fd);
|
void release (int fd);
|
||||||
void init_std_file_from_handle (int fd, HANDLE handle);
|
void init_std_file_from_handle (int fd, HANDLE handle);
|
||||||
int dup2 (int oldfd, int newfd);
|
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]; }
|
inline fhandler_base *&operator [](int fd) const { return fds[fd]; }
|
||||||
select_record *select_read (int fd, select_record *s);
|
select_record *select_read (int fd, select_record *s);
|
||||||
select_record *select_write (int fd, select_record *s);
|
select_record *select_write (int fd, select_record *s);
|
||||||
|
|
|
@ -211,7 +211,7 @@ class fhandler_base
|
||||||
|
|
||||||
virtual void fixup_before_fork_exec (DWORD) {}
|
virtual void fixup_before_fork_exec (DWORD) {}
|
||||||
virtual void fixup_after_fork (HANDLE);
|
virtual void fixup_after_fork (HANDLE);
|
||||||
virtual void fixup_after_exec (HANDLE) {}
|
virtual void fixup_after_exec () {}
|
||||||
|
|
||||||
bool get_symlink_p () { return FHISSETF (SYMLINK); }
|
bool get_symlink_p () { return FHISSETF (SYMLINK); }
|
||||||
void set_symlink_p (int val) { FHCONDSETF (val, 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);
|
void set_close_on_exec (int val);
|
||||||
virtual void fixup_before_fork_exec (DWORD);
|
virtual void fixup_before_fork_exec (DWORD);
|
||||||
void fixup_after_fork (HANDLE);
|
void fixup_after_fork (HANDLE);
|
||||||
void fixup_after_exec (HANDLE);
|
void fixup_after_exec ();
|
||||||
bool need_fixup_before () const {return true;}
|
bool need_fixup_before () const {return true;}
|
||||||
|
|
||||||
select_record *select_read (select_record *s);
|
select_record *select_read (select_record *s);
|
||||||
|
@ -467,7 +467,7 @@ public:
|
||||||
int dup (fhandler_base *child);
|
int dup (fhandler_base *child);
|
||||||
int ioctl (unsigned int cmd, void *);
|
int ioctl (unsigned int cmd, void *);
|
||||||
void fixup_after_fork (HANDLE);
|
void fixup_after_fork (HANDLE);
|
||||||
void fixup_after_exec (HANDLE);
|
void fixup_after_exec ();
|
||||||
bool hit_eof ();
|
bool hit_eof ();
|
||||||
void set_eof () {broken_pipe = true;}
|
void set_eof () {broken_pipe = true;}
|
||||||
HANDLE get_guard () const {return guard;}
|
HANDLE get_guard () const {return guard;}
|
||||||
|
@ -539,7 +539,7 @@ class fhandler_dev_raw: public fhandler_base
|
||||||
int ioctl (unsigned int cmd, void *buf);
|
int ioctl (unsigned int cmd, void *buf);
|
||||||
|
|
||||||
void fixup_after_fork (HANDLE);
|
void fixup_after_fork (HANDLE);
|
||||||
void fixup_after_exec (HANDLE);
|
void fixup_after_exec ();
|
||||||
};
|
};
|
||||||
|
|
||||||
class fhandler_dev_floppy: public fhandler_dev_raw
|
class fhandler_dev_floppy: public fhandler_dev_raw
|
||||||
|
@ -676,7 +676,7 @@ class fhandler_serial: public fhandler_base
|
||||||
void dump ();
|
void dump ();
|
||||||
int is_tty () { return 1; }
|
int is_tty () { return 1; }
|
||||||
void fixup_after_fork (HANDLE parent);
|
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
|
/* We maintain a pgrp so that tcsetpgrp and tcgetpgrp work, but we
|
||||||
don't use it for permissions checking. fhandler_tty_slave does
|
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 DWORD __acquire_output_mutex (const char *fn, int ln, DWORD ms) {return 1;}
|
||||||
virtual void __release_output_mutex (const char *fn, int ln) {}
|
virtual void __release_output_mutex (const char *fn, int ln) {}
|
||||||
void fixup_after_fork (HANDLE);
|
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);
|
void echo_erase (int force = 0);
|
||||||
virtual _off64_t lseek (_off64_t, int);
|
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_read (select_record *s);
|
||||||
select_record *select_write (select_record *s);
|
select_record *select_write (select_record *s);
|
||||||
select_record *select_except (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 set_close_on_exec (int val);
|
||||||
void fixup_after_fork (HANDLE parent);
|
void fixup_after_fork (HANDLE parent);
|
||||||
void set_input_state ();
|
void set_input_state ();
|
||||||
|
@ -1106,7 +1106,7 @@ class fhandler_dev_dsp : public fhandler_base
|
||||||
int close (void);
|
int close (void);
|
||||||
int dup (fhandler_base *child);
|
int dup (fhandler_base *child);
|
||||||
void dump (void);
|
void dump (void);
|
||||||
void fixup_after_exec (HANDLE);
|
void fixup_after_exec ();
|
||||||
};
|
};
|
||||||
|
|
||||||
class fhandler_virtual : public fhandler_base
|
class fhandler_virtual : public fhandler_base
|
||||||
|
@ -1136,7 +1136,7 @@ class fhandler_virtual : public fhandler_base
|
||||||
int close (void);
|
int close (void);
|
||||||
int __stdcall fstat (struct stat *buf) __attribute__ ((regparm (2)));
|
int __stdcall fstat (struct stat *buf) __attribute__ ((regparm (2)));
|
||||||
virtual bool fill_filebuf ();
|
virtual bool fill_filebuf ();
|
||||||
void fixup_after_exec (HANDLE);
|
void fixup_after_exec ();
|
||||||
};
|
};
|
||||||
|
|
||||||
class fhandler_proc: public fhandler_virtual
|
class fhandler_proc: public fhandler_virtual
|
||||||
|
|
|
@ -1785,7 +1785,7 @@ set_console_title (char *title)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fhandler_console::fixup_after_exec (HANDLE)
|
fhandler_console::fixup_after_exec ()
|
||||||
{
|
{
|
||||||
HANDLE h = get_handle ();
|
HANDLE h = get_handle ();
|
||||||
HANDLE oh = get_output_handle ();
|
HANDLE oh = get_output_handle ();
|
||||||
|
|
|
@ -646,7 +646,7 @@ fhandler_dev_dsp::dump ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fhandler_dev_dsp::fixup_after_exec (HANDLE)
|
fhandler_dev_dsp::fixup_after_exec ()
|
||||||
{
|
{
|
||||||
/* FIXME: Is there a better way to do this? */
|
/* FIXME: Is there a better way to do this? */
|
||||||
s_audio = new (audio_buf) Audio;
|
s_audio = new (audio_buf) Audio;
|
||||||
|
|
|
@ -508,7 +508,7 @@ fhandler_dev_raw::fixup_after_fork (HANDLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fhandler_dev_raw::fixup_after_exec (HANDLE)
|
fhandler_dev_raw::fixup_after_exec ()
|
||||||
{
|
{
|
||||||
if (devbufsiz > 1L)
|
if (devbufsiz > 1L)
|
||||||
devbuf = new char [devbufsiz];
|
devbuf = new char [devbufsiz];
|
||||||
|
|
|
@ -1031,7 +1031,7 @@ fhandler_serial::fixup_after_fork (HANDLE parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fhandler_serial::fixup_after_exec (HANDLE)
|
fhandler_serial::fixup_after_exec ()
|
||||||
{
|
{
|
||||||
overlapped_setup ();
|
overlapped_setup ();
|
||||||
debug_printf ("io_status.hEvent %p", io_status.hEvent);
|
debug_printf ("io_status.hEvent %p", io_status.hEvent);
|
||||||
|
|
|
@ -303,11 +303,11 @@ fhandler_socket::fixup_after_fork (HANDLE parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fhandler_socket::fixup_after_exec (HANDLE parent)
|
fhandler_socket::fixup_after_exec ()
|
||||||
{
|
{
|
||||||
debug_printf ("here");
|
debug_printf ("here");
|
||||||
if (!get_close_on_exec ())
|
if (!get_close_on_exec ())
|
||||||
fixup_after_fork (parent);
|
fixup_after_fork (NULL);
|
||||||
#if 0
|
#if 0
|
||||||
else if (!winsock2_active)
|
else if (!winsock2_active)
|
||||||
closesocket (get_socket ());
|
closesocket (get_socket ());
|
||||||
|
|
|
@ -37,7 +37,7 @@ fhandler_virtual::~fhandler_virtual ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fhandler_virtual::fixup_after_exec (HANDLE)
|
fhandler_virtual::fixup_after_exec ()
|
||||||
{
|
{
|
||||||
if (filebuf)
|
if (filebuf)
|
||||||
filebuf = NULL;
|
filebuf = NULL;
|
||||||
|
|
|
@ -123,7 +123,7 @@ fhandler_pipe::hit_eof ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fhandler_pipe::fixup_after_exec (HANDLE parent)
|
fhandler_pipe::fixup_after_exec ()
|
||||||
{
|
{
|
||||||
if (read_state)
|
if (read_state)
|
||||||
{
|
{
|
||||||
|
@ -140,7 +140,7 @@ fhandler_pipe::fixup_after_fork (HANDLE parent)
|
||||||
fork_fixup (parent, guard, "guard");
|
fork_fixup (parent, guard, "guard");
|
||||||
if (writepipe_exists)
|
if (writepipe_exists)
|
||||||
fork_fixup (parent, writepipe_exists, "guard");
|
fork_fixup (parent, writepipe_exists, "guard");
|
||||||
fixup_after_exec (parent);
|
fixup_after_exec ();
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -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,
|
init_child_info (chtype, &ciresrv, (mode == _P_OVERLAY) ? myself->pid : 1,
|
||||||
subproc_ready);
|
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 = (cygheap_exec_info *) ccalloc (HEAP_1_EXEC, 1, sizeof (cygheap_exec_info));
|
||||||
ciresrv.moreinfo->old_title = NULL;
|
ciresrv.moreinfo->old_title = NULL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue