From 4eb5175d905a233eea5651489a1f9698159b9c67 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Tue, 14 Feb 2012 19:08:20 +0000 Subject: [PATCH] * pinfo.cc (_pinfo::set_ctty): Revert 2012-02-07 change to skip function if tty in question == our ctty. * syscalls.cc (setsid): Avoid two function calls. * dtable.cc (dtable::dup_worker): Remove debugging. * init.cc (search_for): Calculate for every new process rather than using shared value. (threadfunc_ix): Fill in for ever new process rather than sing shared value. --- winsup/cygwin/ChangeLog | 14 ++++++++++++++ winsup/cygwin/dtable.cc | 12 ++---------- winsup/cygwin/init.cc | 4 ++-- winsup/cygwin/pinfo.cc | 6 ++---- winsup/cygwin/syscalls.cc | 4 ++-- 5 files changed, 22 insertions(+), 18 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 80803f0b7..95cb0dd72 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,17 @@ +2012-02-14 Christopher Faylor + + * pinfo.cc (_pinfo::set_ctty): Revert 2012-02-07 change to skip + function if tty in question == our ctty. + + * syscalls.cc (setsid): Avoid two function calls. + + * dtable.cc (dtable::dup_worker): Remove debugging. + + * init.cc (search_for): Calculate for every new process rather than + using shared value. + (threadfunc_ix): Fill in for ever new process rather than sing shared + value. + 2012-02-14 Corinna Vinschen * fhandler_disk_file.cc (fhandler_cygdrive::fstat): Don't bother to diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index f152b82a3..e06936c6a 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -677,16 +677,8 @@ dtable::dup_worker (fhandler_base *oldfh, int flags) /* The O_CLOEXEC flag enforces close-on-exec behaviour. */ newfh->set_close_on_exec (!!(flags & O_CLOEXEC)); - debug_printf ("duped '%s' old %p, new %p", oldfh->get_name (), oldfh->get_io_handle (), newfh->get_io_handle ()); -#ifdef DEBUGGING - debug_printf ("duped output_handles old %p, new %p", - oldfh->get_output_handle (), - newfh->get_output_handle ()); - if (oldfh->archetype) - debug_printf ("duped output_handles archetype old %p, archetype new %p", - oldfh->archetype->get_output_handle (), - newfh->archetype->get_output_handle ()); -#endif /*DEBUGGING*/ + debug_printf ("duped '%s' old %p, new %p", oldfh->get_name (), + oldfh->get_io_handle (), newfh->get_io_handle ()); } } return newfh; diff --git a/winsup/cygwin/init.cc b/winsup/cygwin/init.cc index 5b0416125..c8d4d02db 100644 --- a/winsup/cygwin/init.cc +++ b/winsup/cygwin/init.cc @@ -16,8 +16,8 @@ details. */ static DWORD _my_oldfunc; -static char *search_for __attribute__((section (".cygwin_dll_common"), shared)) = (char *) cygthread::stub; -unsigned threadfunc_ix[8] __attribute__((section (".cygwin_dll_common"), shared)); +static char *search_for = (char *) cygthread::stub; +unsigned threadfunc_ix[8]; static bool dll_finished_loading; #define OLDFUNC_OFFSET -1 diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index 04c6b64c8..2615e32ac 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -435,7 +435,7 @@ _pinfo::set_ctty (fhandler_termios *fh, int flags) { tty_min& tc = *fh->tc (); debug_printf ("old %s, ctty device number %p, tc.ntty device number %p flags & O_NOCTTY %p", __ctty (), ctty, tc.ntty, flags & O_NOCTTY); - if (fh && &tc && (ctty <= 0 || ctty != tc.ntty) && !(flags & O_NOCTTY)) + if (fh && &tc && (ctty <= 0 || ctty == tc.ntty) && !(flags & O_NOCTTY)) { ctty = tc.ntty; if (cygheap->ctty != fh->archetype) @@ -463,9 +463,7 @@ _pinfo::set_ctty (fhandler_termios *fh, int flags) __ctty (), sid, pid, pgid, tc.getpgid (), tc.getsid ()); if (!cygwin_finished_initializing && !myself->cygstarted && pgid == pid && tc.getpgid () && tc.getsid ()) - { - pgid = tc.getpgid (); - } + pgid = tc.getpgid (); /* May actually need to do this: diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 539f3716f..8cdadb2d7 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -1016,8 +1016,8 @@ setsid (void) else { myself->ctty = -2; - myself->sid = getpid (); - myself->pgid = getpid (); + myself->sid = myself->pid; + myself->pgid = myself->pid; if (cygheap->ctty) cygheap->close_ctty (); syscall_printf ("sid %d, pgid %d, %s", myself->sid, myself->pgid, myctty ());