mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-30 02:50:25 +08:00
* sigproc.h (set_signal_mask): Remove default on second parameter and make pass
by reference. * signal.cc (abort): Accommodate change to set_signal_mask. * select.cc (pselect): Ditto. * exceptions.cc (handle_sigsuspend): Ditto. (ctrl_c_handler): Ditto. (sighold): Ditto. (sigrelse): Ditto. (set_process_mask_delta): Ditto. (_cygtls::call_signal_handler): Ditto. * fhandler_disk_file.cc (fhandler_disk_file::readdir): Return ENMFILE if __handle is not set. Set __handle to NULL when out of files. (fhandler_disk_file::rewinddir): Don't close handle if it's NULL. (fhandler_disk_file::closedir): Ditto.
This commit is contained in:
parent
3e4aef50dc
commit
db7f135b03
@ -1,3 +1,21 @@
|
||||
2005-08-23 Christopher Faylor <cgf@timesys.com>
|
||||
|
||||
* sigproc.h (set_signal_mask): Remove default on second parameter and
|
||||
make pass by reference.
|
||||
* signal.cc (abort): Accommodate change to set_signal_mask.
|
||||
* select.cc (pselect): Ditto.
|
||||
* exceptions.cc (handle_sigsuspend): Ditto.
|
||||
(ctrl_c_handler): Ditto.
|
||||
(sighold): Ditto.
|
||||
(sigrelse): Ditto.
|
||||
(set_process_mask_delta): Ditto.
|
||||
(_cygtls::call_signal_handler): Ditto.
|
||||
|
||||
* fhandler_disk_file.cc (fhandler_disk_file::readdir): Return ENMFILE
|
||||
if __handle is not set. Set __handle to NULL when out of files.
|
||||
(fhandler_disk_file::rewinddir): Don't close handle if it's NULL.
|
||||
(fhandler_disk_file::closedir): Ditto.
|
||||
|
||||
2005-08-22 Christopher Faylor <cgf@timesys.com>
|
||||
|
||||
* dir.cc (readdir_worker): Make static. Only add '.' and '..' when
|
||||
|
@ -592,7 +592,7 @@ handle_sigsuspend (sigset_t tempmask)
|
||||
{
|
||||
sigset_t oldmask = myself->getsigmask (); // Remember for restoration
|
||||
|
||||
set_signal_mask (tempmask, oldmask);
|
||||
set_signal_mask (tempmask, myself->getsigmask ());
|
||||
sigproc_printf ("oldmask %p, newmask %p", oldmask, tempmask);
|
||||
|
||||
pthread_testcancel ();
|
||||
@ -910,7 +910,7 @@ ctrl_c_handler (DWORD type)
|
||||
extern "C" void __stdcall
|
||||
set_process_mask (sigset_t newmask)
|
||||
{
|
||||
set_signal_mask (newmask);
|
||||
set_signal_mask (newmask, myself->getsigmask ());
|
||||
}
|
||||
|
||||
extern "C" int
|
||||
@ -926,7 +926,7 @@ sighold (int sig)
|
||||
mask_sync.acquire (INFINITE);
|
||||
sigset_t mask = myself->getsigmask ();
|
||||
sigaddset (&mask, sig);
|
||||
set_signal_mask (mask);
|
||||
set_signal_mask (mask, myself->getsigmask ());
|
||||
mask_sync.release ();
|
||||
return 0;
|
||||
}
|
||||
@ -944,7 +944,7 @@ sigrelse (int sig)
|
||||
mask_sync.acquire (INFINITE);
|
||||
sigset_t mask = myself->getsigmask ();
|
||||
sigdelset (&mask, sig);
|
||||
set_signal_mask (mask);
|
||||
set_signal_mask (mask, myself->getsigmask ());
|
||||
mask_sync.release ();
|
||||
return 0;
|
||||
}
|
||||
@ -973,14 +973,14 @@ set_process_mask_delta ()
|
||||
/* Set the signal mask for this process.
|
||||
Note that some signals are unmaskable, as in UNIX. */
|
||||
extern "C" void __stdcall
|
||||
set_signal_mask (sigset_t newmask, sigset_t oldmask)
|
||||
set_signal_mask (sigset_t newmask, sigset_t& oldmask)
|
||||
{
|
||||
mask_sync.acquire (INFINITE);
|
||||
newmask &= ~SIG_NONMASKABLE;
|
||||
sigset_t mask_bits = oldmask & ~newmask;
|
||||
sigproc_printf ("oldmask %p, newmask %p, mask_bits %p", oldmask, newmask,
|
||||
mask_bits);
|
||||
myself->setsigmask (newmask); // Set a new mask
|
||||
oldmask = newmask;
|
||||
if (mask_bits)
|
||||
sig_dispatch_pending (true);
|
||||
else
|
||||
@ -1225,7 +1225,7 @@ _cygtls::call_signal_handler ()
|
||||
sig = 0;
|
||||
sigfunc (thissig);
|
||||
incyg++;
|
||||
set_signal_mask (this_oldmask);
|
||||
set_signal_mask (this_oldmask, myself->getsigmask ());
|
||||
if (this_errno >= 0)
|
||||
set_errno (this_errno);
|
||||
}
|
||||
|
@ -1355,6 +1355,11 @@ fhandler_disk_file::readdir (DIR *dir, dirent *de)
|
||||
HANDLE handle;
|
||||
int res;
|
||||
|
||||
if (!dir->__handle)
|
||||
{
|
||||
res = ENMFILE;
|
||||
goto out;
|
||||
}
|
||||
if (dir->__handle == INVALID_HANDLE_VALUE && dir->__d_position == 0)
|
||||
{
|
||||
handle = FindFirstFileA (dir->__d_dirname, &buf);
|
||||
@ -1399,11 +1404,8 @@ fhandler_disk_file::readdir (DIR *dir, dirent *de)
|
||||
else
|
||||
{
|
||||
res = geterrno_from_win_error ();
|
||||
if (res != ENMFILE)
|
||||
{
|
||||
FindClose (dir->__handle);
|
||||
dir->__handle = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
FindClose (dir->__handle);
|
||||
dir->__handle = NULL;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
@ -1469,7 +1471,8 @@ fhandler_disk_file::rewinddir (DIR *dir)
|
||||
{
|
||||
if (dir->__handle != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
FindClose (dir->__handle);
|
||||
if (dir->__handle)
|
||||
FindClose (dir->__handle);
|
||||
dir->__handle = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
dir->__d_position = 0;
|
||||
@ -1479,8 +1482,8 @@ int
|
||||
fhandler_disk_file::closedir (DIR *dir)
|
||||
{
|
||||
int res = 0;
|
||||
if (dir->__handle != INVALID_HANDLE_VALUE &&
|
||||
FindClose (dir->__handle) == 0)
|
||||
if (dir->__handle && dir->__handle != INVALID_HANDLE_VALUE
|
||||
&& FindClose (dir->__handle) == 0)
|
||||
{
|
||||
__seterrno ();
|
||||
res = -1;
|
||||
|
@ -175,11 +175,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);
|
||||
set_signal_mask (*set, myself->getsigmask ());
|
||||
int ret = cygwin_select (maxfds, readfds, writefds, exceptfds,
|
||||
ts ? &tv : NULL);
|
||||
if (set)
|
||||
set_signal_mask (oldset);
|
||||
set_signal_mask (oldset, myself->getsigmask ());
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -329,7 +329,7 @@ abort (void)
|
||||
sigset_t sig_mask;
|
||||
sigfillset (&sig_mask);
|
||||
sigdelset (&sig_mask, SIGABRT);
|
||||
set_signal_mask (sig_mask);
|
||||
set_signal_mask (sig_mask, myself->getsigmask ());
|
||||
|
||||
raise (SIGABRT);
|
||||
_my_tls.call_signal_handler (); /* Call any signal handler */
|
||||
|
@ -56,7 +56,7 @@ extern HANDLE sigCONT;
|
||||
|
||||
void __stdcall sig_dispatch_pending (bool fast = false);
|
||||
#ifdef _PINFO_H
|
||||
extern "C" void __stdcall set_signal_mask (sigset_t newmask, sigset_t = myself->getsigmask ());
|
||||
extern "C" void __stdcall set_signal_mask (sigset_t newmask, sigset_t&);
|
||||
#endif
|
||||
int __stdcall handle_sigprocmask (int sig, const sigset_t *set,
|
||||
sigset_t *oldset, sigset_t& opmask)
|
||||
|
Loading…
x
Reference in New Issue
Block a user