Perform whitespace cleanup throughout.

* dcrt0.cc (signal_shift_subtract): Eliminate ancient backwards compatibility.
(check_sanity_and_sync): Ditto.
* winsup.h (SIGTOMASK): Ditto.  Just use constant in signal calculation.
* include/cygwin/version: Remove backwards signal mask compatibility define.
* path.cc (symlink_info::check_sysfile): Cosmetic change.
* registry.cc (get_registry_hive_path): Remove unneeded variable.
* exceptions.cc (handle_sigsuspend): Eliminate thread signal mask and use
either main sigmask or current thread sigmask.
(set_process_mask): Ditto.
(sighold): Ditto.
(sigrelse): Ditto.
(sigset): Ditto.
(set_process_mask_delta): Ditto.
(_cygtls::call_signal_handler): Ditto.
* fhandler_process.cc (format_process_status): Ditto.
* fhandler_termios.cc (fhandler_termios::bg_check): Ditto.
* pinfo.h (class pinfo): Ditto.
* select.cc (pselect): Ditto.
* signal.cc (sigprocmask): Ditto.
(abort): Ditto.
(sigpause): Ditto.
(sigsend): Ditto.
(wait_sig): Ditto.
* thread.h (pthread::parent_tls): New member.
* thread.cc (pthread::pthread): Record parent_tls here.
(pthread::thread_init_wrapper): Initialize sigmask from parent thread.
This commit is contained in:
Christopher Faylor 2008-02-15 17:53:11 +00:00
parent d039978069
commit 70300fdb1c
45 changed files with 315 additions and 315 deletions

View File

@ -1,3 +1,40 @@
2008-02-15 Christopher Faylor <me+cygwin@cgf.cx>
Perform whitespace cleanup throughout.
* dcrt0.cc (signal_shift_subtract): Eliminate ancient backwards
compatibility.
(check_sanity_and_sync): Ditto.
* winsup.h (SIGTOMASK): Ditto. Just use constant in signal
calculation.
* include/cygwin/version: Remove backwards signal mask compatibility
define.
* path.cc (symlink_info::check_sysfile): Cosmetic change.
* registry.cc (get_registry_hive_path): Remove unneeded variable.
* exceptions.cc (handle_sigsuspend): Eliminate thread signal mask and
use either main sigmask or current thread sigmask.
(set_process_mask): Ditto.
(sighold): Ditto.
(sigrelse): Ditto.
(sigset): Ditto.
(set_process_mask_delta): Ditto.
(_cygtls::call_signal_handler): Ditto.
* fhandler_process.cc (format_process_status): Ditto.
* fhandler_termios.cc (fhandler_termios::bg_check): Ditto.
* pinfo.h (class pinfo): Ditto.
* select.cc (pselect): Ditto.
* signal.cc (sigprocmask): Ditto.
(abort): Ditto.
(sigpause): Ditto.
(sigsend): Ditto.
(wait_sig): Ditto.
* thread.h (pthread::parent_tls): New member.
* thread.cc (pthread::pthread): Record parent_tls here.
(pthread::thread_init_wrapper): Initialize sigmask from parent thread.
2008-02-14 Corinna Vinschen <corinna@vinschen.de>
* cygheap.cc (cwcsdup): New function.

View File

@ -74,14 +74,6 @@ _cygtls NO_COPY *_main_tls;
bool NO_COPY cygwin_finished_initializing;
/* Used in SIGTOMASK for generating a bit for insertion into a sigset_t.
This is subtracted from the signal number prior to shifting the bit.
In older versions of cygwin, the signal was used as-is to shift the
bit for masking. So, we'll temporarily detect this and set it to zero
for programs that are linked using older cygwins. This is just a stopgap
measure to allow an orderly transfer to the new, correct sigmask method. */
unsigned NO_COPY int signal_shift_subtract = 1;
MTinterface _mtinterf;
bool NO_COPY _cygwin_testing;
@ -443,10 +435,6 @@ check_sanity_and_sync (per_process *p)
if (p->api_major > cygwin_version.api_major)
api_fatal ("cygwin DLL and APP are out of sync -- API version mismatch %d > %d",
p->api_major, cygwin_version.api_major);
if (CYGWIN_VERSION_DLL_MAKE_COMBINED (p->dll_major, p->dll_minor) <=
CYGWIN_VERSION_DLL_BAD_SIGNAL_MASK)
signal_shift_subtract = 0;
}
child_info NO_COPY *child_proc_info = NULL;

View File

@ -682,9 +682,9 @@ handle_sigsuspend (sigset_t tempmask)
return -1;
}
sigset_t oldmask = myself->getsigmask (); // Remember for restoration
sigset_t oldmask = _my_tls.sigmask; // Remember for restoration
set_signal_mask (tempmask, myself->getsigmask ());
set_signal_mask (tempmask, _my_tls.sigmask);
sigproc_printf ("oldmask %p, newmask %p", oldmask, tempmask);
pthread_testcancel ();
@ -995,8 +995,7 @@ ctrl_c_handler (DWORD type)
extern "C" void __stdcall
set_process_mask (sigset_t newmask)
{
set_signal_mask (newmask, myself->getsigmask ());
sigproc_printf ("mask now %p\n", myself->getsigmask ());
set_signal_mask (newmask, _my_tls.sigmask);
}
extern "C" int
@ -1010,9 +1009,9 @@ sighold (int sig)
return -1;
}
mask_sync.acquire (INFINITE);
sigset_t mask = myself->getsigmask ();
sigset_t mask = _my_tls.sigmask;
sigaddset (&mask, sig);
set_signal_mask (mask, myself->getsigmask ());
set_signal_mask (mask, _my_tls.sigmask);
mask_sync.release ();
return 0;
}
@ -1028,9 +1027,9 @@ sigrelse (int sig)
return -1;
}
mask_sync.acquire (INFINITE);
sigset_t mask = myself->getsigmask ();
sigset_t mask = _my_tls.sigmask;
sigdelset (&mask, sig);
set_signal_mask (mask, myself->getsigmask ());
set_signal_mask (mask, _my_tls.sigmask);
mask_sync.release ();
return 0;
}
@ -1050,7 +1049,7 @@ sigset (int sig, _sig_func_ptr func)
}
mask_sync.acquire (INFINITE);
sigset_t mask = myself->getsigmask ();
sigset_t mask = _my_tls.sigmask;
/* If sig was in the signal mask return SIG_HOLD, otherwise return the
previous disposition. */
if (sigismember (&mask, sig))
@ -1068,7 +1067,7 @@ sigset (int sig, _sig_func_ptr func)
signal (sig, func);
sigdelset (&mask, sig);
}
set_signal_mask (mask, myself->getsigmask ());
set_signal_mask (mask, _my_tls.sigmask);
mask_sync.release ();
return prev;
}
@ -1090,11 +1089,11 @@ set_process_mask_delta ()
if (_my_tls.deltamask & SIG_NONMASKABLE)
oldmask = _my_tls.oldmask; /* from handle_sigsuspend */
else
oldmask = myself->getsigmask ();
oldmask = _my_tls.sigmask;
newmask = (oldmask | _my_tls.deltamask) & ~SIG_NONMASKABLE;
sigproc_printf ("oldmask %p, newmask %p, deltamask %p", oldmask, newmask,
_my_tls.deltamask);
myself->setsigmask (newmask);
_my_tls.sigmask = newmask;
mask_sync.release ();
return oldmask;
}
@ -1362,7 +1361,7 @@ _cygtls::call_signal_handler ()
sigact (thissig, &thissi, NULL);
}
incyg = 1;
set_signal_mask (this_oldmask, myself->getsigmask ());
set_signal_mask (this_oldmask, _my_tls.sigmask);
if (this_errno >= 0)
set_errno (this_errno);
}

View File

@ -22,6 +22,7 @@ details. */
#include "dtable.h"
#include "cygheap.h"
#include "ntdll.h"
#include "cygtls.h"
#include <sys/param.h>
#include <assert.h>
#include <sys/sysmacros.h>
@ -812,7 +813,7 @@ format_process_status (_pinfo *p, char *destbuf, size_t maxsize)
p->gid, p->gid, p->gid, p->gid,
vmsize >> 10, 0, vmrss >> 10, vmdata >> 10, 0,
vmtext >> 10, vmlib >> 10,
0, 0, p->getsigmask ()
0, 0, _my_tls.sigmask
);
}

View File

@ -156,7 +156,7 @@ fhandler_termios::bg_check (int sig)
int pgid_gone = !pid_exists (myself->pgid);
int sigs_ignored =
((void *) global_sigs[sig].sa_handler == (void *) SIG_IGN) ||
(myself->getsigmask () & SIGTOMASK (sig));
(_main_tls->sigmask & SIGTOMASK (sig));
if (pgid_gone)
goto setEIO;

View File

@ -62,8 +62,6 @@ details. */
/* Every version of cygwin <= this uses an old, incorrect method
to determine signal masks. */
#define CYGWIN_VERSION_DLL_BAD_SIGNAL_MASK 19005
#define CYGWIN_VERSION_USER_API_VERSION_COMBINED \
CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor)

View File

@ -30,9 +30,7 @@ details. */
#include <sys/cygwin.h>
/***********************************************************************
*
write_record: Translates a Windows DNS record into a compressed record
* write_record: Translates a Windows DNS record into a compressed record
***********************************************************************/
#define PUTDOMAIN(d,p)\

View File

@ -608,9 +608,7 @@ int res_mkquery (int op, const char * dnameptr, int qclass, int qtype,
}
/*****************************************************************
*
res_query()
* res_query()
*****************************************************************/
int res_nquery( res_state statp, const char * DomName, int Class, int Type,
@ -640,9 +638,7 @@ int res_query( const char * DomName, int Class, int Type, unsigned char * AnsPtr
}
/*****************************************************************
*
res_querydomain()
* res_querydomain()
*****************************************************************/
int res_nquerydomain( res_state statp, const char * Name, const char * DomName,
int Class, int Type, unsigned char * AnsPtr, int AnsLength)
@ -746,9 +742,7 @@ int res_search( const char * DomName, int Class, int Type,
}
/*****************************************************************
*
dn_expand
* dn_expand
*****************************************************************/
int dn_expand(const unsigned char *msg, const unsigned char *eomorig,

View File

@ -3313,10 +3313,7 @@ symlink_info::check_sysfile (HANDLE h)
set_error (EIO);
}
else if (io.Information > SYMLINK_MAX + 1)
{
debug_printf ("symlink string too long");
}
else
res = posixify (srcbuf);
}

View File

@ -96,16 +96,6 @@ public:
inline void set_has_pgid_children (bool val) {has_pgid_children = val;}
inline sigset_t& getsigmask ()
{
return sig_mask;
}
inline void setsigmask (sigset_t mask)
{
sig_mask = mask;
}
commune_result commune_request (__uint32_t, ...);
bool alive ();
fhandler_pipe *pipe_fhandler (HANDLE, size_t &);
@ -128,8 +118,6 @@ public:
HANDLE sendsig;
HANDLE exec_sendsig;
DWORD exec_dwProcessId;
private:
sigset_t sig_mask;
public:
HANDLE wr_proc_pipe;
DWORD wr_proc_pipe_owner;

View File

@ -115,7 +115,6 @@ pipe_handler (LPVOID in_ps)
return 0;
}
pipesync::pipesync (HANDLE f, DWORD is_reader):
reader (false), ret_handle (NULL)
{

View File

@ -221,7 +221,6 @@ get_registry_hive_path (const PWCHAR name, PWCHAR path)
if (!RegOpenKeyExW (HKEY_LOCAL_MACHINE, key, 0, KEY_READ, &hkey))
{
WCHAR buf[NT_MAX_PATH];
WCHAR tmp[NT_MAX_PATH];
DWORD type, siz;
path[0] = L'\0';

View File

@ -160,7 +160,7 @@ pselect(int maxfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
const struct timespec *ts, const sigset_t *set)
{
struct timeval tv;
sigset_t oldset = myself->getsigmask ();
sigset_t oldset = _my_tls.sigmask;
myfault efault;
if (efault.faulted (EFAULT))
@ -171,11 +171,11 @@ pselect(int maxfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
tv.tv_usec = ts->tv_nsec / 1000;
}
if (set)
set_signal_mask (*set, myself->getsigmask ());
set_signal_mask (*set, _my_tls.sigmask);
int ret = cygwin_select (maxfds, readfds, writefds, exceptfds,
ts ? &tv : NULL);
if (set)
set_signal_mask (oldset, myself->getsigmask ());
set_signal_mask (oldset, _my_tls.sigmask);
return ret;
}

View File

@ -147,7 +147,7 @@ usleep (useconds_t useconds)
extern "C" int
sigprocmask (int how, const sigset_t *set, sigset_t *oldset)
{
return handle_sigprocmask (how, set, oldset, myself->getsigmask ());
return handle_sigprocmask (how, set, oldset, _my_tls.sigmask);
}
int __stdcall
@ -342,7 +342,7 @@ abort (void)
sigset_t sig_mask;
sigfillset (&sig_mask);
sigdelset (&sig_mask, SIGABRT);
set_signal_mask (sig_mask, myself->getsigmask ());
set_signal_mask (sig_mask, _my_tls.sigmask);
raise (SIGABRT);
_my_tls.call_signal_handler (); /* Call any signal handler */
@ -485,7 +485,7 @@ sigpause (int signal_mask)
extern "C" int
pause (void)
{
return handle_sigsuspend (myself->getsigmask ());
return handle_sigsuspend (_my_tls.sigmask);
}
extern "C" int

View File

@ -663,7 +663,7 @@ sig_send (_pinfo *p, siginfo_t& si, _cygtls *tls)
else if (si.si_signo == __SIGPENDING)
pack.mask = &pending;
else if (si.si_signo == __SIGFLUSH || si.si_signo > 0)
pack.mask = &myself->getsigmask ();
pack.mask = &_my_tls.sigmask;
else
pack.mask = NULL;
@ -1118,7 +1118,7 @@ pending_signals::add (sigpacket& pack)
return;
se = sigs + pack.si.si_signo;
*se = pack;
se->mask = &myself->getsigmask ();
se->mask = &pack.tls->sigmask;
se->next = NULL;
if (end)
end->next = se;
@ -1199,7 +1199,7 @@ wait_sig (VOID *)
sigset_t dummy_mask;
if (!pack.mask)
{
dummy_mask = myself->getsigmask ();
dummy_mask = _main_tls->sigmask;
pack.mask = &dummy_mask;
}
@ -1218,7 +1218,7 @@ wait_sig (VOID *)
unsigned bit;
sigq.reset ();
while ((q = sigq.next ()))
if (myself->getsigmask () & (bit = SIGTOMASK (q->si.si_signo)))
if (pack.tls->sigmask & (bit = SIGTOMASK (q->si.si_signo)))
*pack.mask |= bit;
break;
case __SIGHOLD:

View File

@ -376,6 +376,7 @@ pthread::pthread ():verifyable_object (PTHREAD_MAGIC), win32_obj_id (0),
{
if (this != pthread_null::get_null_pthread ())
threads.insert (this);
parent_tls = &_my_tls;
}
pthread::~pthread ()
@ -1738,6 +1739,7 @@ pthread::thread_init_wrapper (void *arg)
// if thread is detached force cleanup on exit
if (thread->attr.joinable == PTHREAD_CREATE_DETACHED && thread->joiner == NULL)
thread->joiner = thread;
_my_tls.sigmask = thread->parent_tls->sigmask;
thread->mutex.unlock ();
thread_printf ("started thread %p %p %p %p %p %p", arg, &_my_tls.local_clib,

View File

@ -434,6 +434,7 @@ private:
DWORD thread_id;
__pthread_cleanup_handler *cleanup_stack;
pthread_mutex mutex;
_cygtls *parent_tls;
void suspend_except_self ();
void resume ();

View File

@ -179,8 +179,7 @@ extern HANDLE tty_mutex;
})
/* Convert a signal to a signal mask */
#define SIGTOMASK(sig) (1 << ((sig) - signal_shift_subtract))
extern unsigned int signal_shift_subtract;
#define SIGTOMASK(sig) (1 << ((sig) - 1))
extern int __api_fatal_exit_val;
#define set_api_fatal_return(n) do {extern int __api_fatal_exit_val; __api_fatal_exit_val = (n);} while (0)