diff options
author | Christopher Faylor <me@cgf.cx> | 2008-02-13 17:21:05 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2008-02-13 17:21:05 +0000 |
commit | b40597cb2e915d2703b258a04a45292f2d1ed4ed (patch) | |
tree | 8a2ba5405cc2d678c9cfeec43fc44249da551130 | |
parent | a9414ca6d8cd5c3adc84ae1a522f0e2c8eb3bcae (diff) | |
download | newlib-b40597cb2e915d2703b258a04a45292f2d1ed4ed.zip newlib-b40597cb2e915d2703b258a04a45292f2d1ed4ed.tar.gz newlib-b40597cb2e915d2703b258a04a45292f2d1ed4ed.tar.bz2 |
* syscalls.cc (_isatty): Define as an alias to isatty to override newlib
version.
* thread.cc (pthread_kill): Deal with signal 0 as per POSIX and also avoid
manipulating an invalid thread.
-rw-r--r-- | winsup/cygwin/ChangeLog | 8 | ||||
-rw-r--r-- | winsup/cygwin/syscalls.cc | 1 | ||||
-rw-r--r-- | winsup/cygwin/thread.cc | 20 |
3 files changed, 27 insertions, 2 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index c1d8353..77ed6e5 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,11 @@ +2008-02-13 Christopher Faylor <me+cygwin@cgf.cx> + + * syscalls.cc (_isatty): Define as an alias to isatty to override + newlib version. + + * thread.cc (pthread_kill): Deal with signal 0 as per POSIX and also + avoid manipulating an invalid thread. + 2008-02-13 Corinna Vinschen <corinna@vinschen.de> * posix.sgml: Move llrint, llrintf, llrintl, lrintl, rintl, wcstol, diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 1f5bc5f..6e58b6a 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -999,6 +999,7 @@ isatty (int fd) syscall_printf ("%d = isatty (%d)", res, fd); return res; } +EXPORT_ALIAS (isatty, _isatty) /* Under NT, try to make a hard link using backup API. If that fails or we are Win 95, just copy the file. diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index d78bbbb..7e52e3b 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -2640,8 +2640,24 @@ pthread_kill (pthread_t thread, int sig) si.si_code = SI_USER; si.si_pid = myself->pid; si.si_uid = myself->uid; - thread->cygtls->set_threadkill (); - int rval = sig ? sig_send (NULL, si, thread->cygtls) : 0; + int rval; + if (!thread->valid) + rval = ESRCH; + else if (sig) + { + thread->cygtls->set_threadkill (); + rval = sig_send (NULL, si, thread->cygtls); + } + else + switch (WaitForSingleObject (thread->win32_obj_id, 0)) + { + case WAIT_TIMEOUT: + rval = 0; + break; + default: + rval = ESRCH; + break; + } // unlock myself return rval; |