* dtable.cc (dtable::release): Drop fixup_before handling.
(dtable::fixup_before_fork): Remove. (dtable::fixup_before_exec): Remove. * dtable.h (class dtable): Remove cnt_need_fixup_before member. (dtable::dtable): Accommodate above change. (dtable::dec_need_fixup_before): Remove. (dtable::inc_need_fixup_before): Remove. (dtable::need_fixup_before): Remove. (dtable::fixup_before_exec): Remove declaration. (dtable::fixup_before_fork): Ditto. * fhandler.h (fhandler_base::fixup_before_fork_exec): Remove. (fhandler_base::need_fixup_before): Remove. * fork.cc (frok::parent): Drop fixup_before handling. * spawn.cc (spawn_guts): Ditto.
This commit is contained in:
parent
7e2b8e7d2a
commit
7aefc1596d
|
@ -1,3 +1,20 @@
|
|||
2008-04-30 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* dtable.cc (dtable::release): Drop fixup_before handling.
|
||||
(dtable::fixup_before_fork): Remove.
|
||||
(dtable::fixup_before_exec): Remove.
|
||||
* dtable.h (class dtable): Remove cnt_need_fixup_before member.
|
||||
(dtable::dtable): Accommodate above change.
|
||||
(dtable::dec_need_fixup_before): Remove.
|
||||
(dtable::inc_need_fixup_before): Remove.
|
||||
(dtable::need_fixup_before): Remove.
|
||||
(dtable::fixup_before_exec): Remove declaration.
|
||||
(dtable::fixup_before_fork): Ditto.
|
||||
* fhandler.h (fhandler_base::fixup_before_fork_exec): Remove.
|
||||
(fhandler_base::need_fixup_before): Remove.
|
||||
* fork.cc (frok::parent): Drop fixup_before handling.
|
||||
* spawn.cc (spawn_guts): Ditto.
|
||||
|
||||
2008-04-30 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* mount.cc (is_unc_share): Allow \\?\ prefix as well. Enhance comment.
|
||||
|
|
|
@ -236,8 +236,6 @@ dtable::release (int fd)
|
|||
{
|
||||
if (!not_open (fd))
|
||||
{
|
||||
if (fds[fd]->need_fixup_before ())
|
||||
dec_need_fixup_before ();
|
||||
fhandler_base *arch = fds[fd]->archetype;
|
||||
delete fds[fd];
|
||||
if (arch && !arch->usecount)
|
||||
|
@ -672,22 +670,6 @@ dtable::select_except (int fd, select_record *s)
|
|||
return s;
|
||||
}
|
||||
|
||||
/* Function to walk the fd table after an exec and perform
|
||||
per-fhandler type fixups. */
|
||||
void
|
||||
dtable::fixup_before_fork (DWORD target_proc_id)
|
||||
{
|
||||
lock ();
|
||||
fhandler_base *fh;
|
||||
for (size_t i = 0; i < size; i++)
|
||||
if ((fh = fds[i]) != NULL)
|
||||
{
|
||||
debug_printf ("fd %d (%s)", i, fh->get_name ());
|
||||
fh->fixup_before_fork_exec (target_proc_id);
|
||||
}
|
||||
unlock ();
|
||||
}
|
||||
|
||||
void
|
||||
dtable::move_fd (int from, int to)
|
||||
{
|
||||
|
@ -696,20 +678,6 @@ dtable::move_fd (int from, int to)
|
|||
fds[from] = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
dtable::fixup_before_exec (DWORD target_proc_id)
|
||||
{
|
||||
lock ();
|
||||
fhandler_base *fh;
|
||||
for (size_t i = 0; i < size; i++)
|
||||
if ((fh = fds[i]) != NULL && !fh->close_on_exec ())
|
||||
{
|
||||
debug_printf ("fd %d (%s)", i, fh->get_name ());
|
||||
fh->fixup_before_fork_exec (target_proc_id);
|
||||
}
|
||||
unlock ();
|
||||
}
|
||||
|
||||
void
|
||||
dtable::set_file_pointers_for_exec ()
|
||||
{
|
||||
|
|
|
@ -28,30 +28,20 @@ class dtable
|
|||
unsigned farchetype;
|
||||
static const int initial_archetype_size = 8;
|
||||
int first_fd_for_open;
|
||||
int cnt_need_fixup_before;
|
||||
void lock () {lock_process::locker.acquire ();}
|
||||
void unlock () {lock_process::locker.release ();}
|
||||
public:
|
||||
size_t size;
|
||||
|
||||
dtable () : archetypes (NULL), narchetypes (0), farchetype (0), first_fd_for_open(3), cnt_need_fixup_before(0) {}
|
||||
dtable () : archetypes (NULL), narchetypes (0), farchetype (0), first_fd_for_open(3) {}
|
||||
void init () {first_fd_for_open = 3;}
|
||||
|
||||
void dec_need_fixup_before ()
|
||||
{ if (cnt_need_fixup_before > 0) --cnt_need_fixup_before; }
|
||||
void inc_need_fixup_before ()
|
||||
{ cnt_need_fixup_before++; }
|
||||
bool need_fixup_before ()
|
||||
{ return cnt_need_fixup_before > 0; }
|
||||
|
||||
void move_fd (int, int);
|
||||
int vfork_child_dup ();
|
||||
void vfork_parent_restore ();
|
||||
void vfork_child_fixup ();
|
||||
fhandler_base *dup_worker (fhandler_base *oldfh);
|
||||
int extend (int howmuch);
|
||||
void fixup_before_exec (DWORD win_proc_id);
|
||||
void fixup_before_fork (DWORD win_proc_id);
|
||||
void fixup_after_fork (HANDLE);
|
||||
inline int not_open (int fd)
|
||||
{
|
||||
|
|
|
@ -218,7 +218,6 @@ class fhandler_base
|
|||
return close_on_exec () ? &sec_none_nih : &sec_none;
|
||||
}
|
||||
|
||||
virtual void fixup_before_fork_exec (DWORD) {}
|
||||
virtual void fixup_after_fork (HANDLE);
|
||||
virtual void fixup_after_exec ();
|
||||
void create_read_state (LONG n)
|
||||
|
@ -263,7 +262,6 @@ class fhandler_base
|
|||
|
||||
/* fixup fd possibly non-inherited handles after fork */
|
||||
bool fork_fixup (HANDLE, HANDLE &, const char *);
|
||||
virtual bool need_fixup_before () const {return false;}
|
||||
|
||||
virtual int open (int, mode_t = 0);
|
||||
int open_fs (int, mode_t = 0);
|
||||
|
|
|
@ -310,13 +310,6 @@ frok::parent (volatile char * volatile stack_here)
|
|||
else
|
||||
c_flags |= DETACHED_PROCESS;
|
||||
|
||||
/* Some file types (currently only sockets) need extra effort in the
|
||||
parent after CreateProcess and before copying the datastructures
|
||||
to the child. So we have to start the child in suspend state,
|
||||
unfortunately, to avoid a race condition. */
|
||||
if (cygheap->fdtab.need_fixup_before ())
|
||||
c_flags |= CREATE_SUSPENDED;
|
||||
|
||||
/* Remember the address of the first loaded dll and decide
|
||||
if we need to load dlls. We do this here so that this
|
||||
information will be available in the parent and, when
|
||||
|
@ -389,14 +382,6 @@ frok::parent (volatile char * volatile stack_here)
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Fixup the parent datastructure if needed and resume the child's
|
||||
main thread. */
|
||||
if (c_flags & CREATE_SUSPENDED)
|
||||
{
|
||||
cygheap->fdtab.fixup_before_fork (pi.dwProcessId);
|
||||
ResumeThread (pi.hThread);
|
||||
}
|
||||
|
||||
CloseHandle (pi.hThread);
|
||||
|
||||
/* Protect the handle but name it similarly to the way it will
|
||||
|
|
|
@ -502,8 +502,7 @@ spawn_guts (const char *prog_arg, const char *const *argv,
|
|||
and before copying the datastructures to the child. So we have to start
|
||||
the child in suspend state, unfortunately, to avoid a race condition. */
|
||||
if (!newargv.win16_exe
|
||||
&& (!ch.iscygwin () || mode != _P_OVERLAY
|
||||
|| cygheap->fdtab.need_fixup_before ()))
|
||||
&& (!ch.iscygwin () || mode != _P_OVERLAY))
|
||||
c_flags |= CREATE_SUSPENDED;
|
||||
|
||||
/* When ruid != euid we create the new process under the current original
|
||||
|
@ -628,11 +627,6 @@ loop:
|
|||
if (!(c_flags & CREATE_SUSPENDED))
|
||||
strace.write_childpid (ch, pi.dwProcessId);
|
||||
|
||||
/* Fixup the parent data structures if needed and resume the child's
|
||||
main thread. */
|
||||
if (cygheap->fdtab.need_fixup_before ())
|
||||
cygheap->fdtab.fixup_before_exec (pi.dwProcessId);
|
||||
|
||||
if (mode != _P_OVERLAY)
|
||||
cygpid = cygwin_pid (pi.dwProcessId);
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue