diff options
Diffstat (limited to 'winsup/cygwin/pinfo.cc')
-rw-r--r-- | winsup/cygwin/pinfo.cc | 51 |
1 files changed, 47 insertions, 4 deletions
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index 5e04ea3da..ad65e59c1 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -668,6 +668,20 @@ commune_process (void *arg) sigproc_printf ("WritePipeOverlapped root failed, %E"); break; } + case PICOM_SIGINFO: + { + sigproc_printf ("processing PICOM_SIGINFO"); + commune_result cr; + sigpending (&cr.pnd); + cr.pnd = sig_send (myself, __SIGPENDINGALL, NULL); + cr.blk = cygheap->compute_sigblkmask (); + for (int sig = 1; sig < NSIG; ++sig) + if (global_sigs[sig].sa_handler == SIG_IGN) + cr.ign |= SIGTOMASK (sig); + if (!WritePipeOverlapped (tothem, &cr, sizeof cr, &nr, 1000L)) + sigproc_printf ("WritePipeOverlapped siginfo failed, %E"); + break; + } case PICOM_FDS: { sigproc_printf ("processing PICOM_FDS"); @@ -788,16 +802,13 @@ commune_result _pinfo::commune_request (__uint32_t code, ...) { DWORD nr; - commune_result res; + commune_result res = { 0 }; va_list args; siginfo_t si = {0}; HANDLE& hp = si._si_commune._si_process_handle; HANDLE& fromthem = si._si_commune._si_read_handle; HANDLE request_sync = NULL; - res.s = NULL; - res.n = 0; - if (!pid) { set_errno (ESRCH); @@ -877,6 +888,14 @@ _pinfo::commune_request (__uint32_t code, ...) res.n = p - res.s; } break; + case PICOM_SIGINFO: + if (!ReadPipeOverlapped (fromthem, &res, sizeof res, &nr, 1000L) + || nr != sizeof res) + { + __seterrno (); + goto err; + } + break; } goto out; @@ -996,6 +1015,30 @@ _pinfo::root (size_t& n) return s; } +int +_pinfo::siginfo (sigset_t &pnd, sigset_t &blk, sigset_t &ign) +{ + if (!pid) + return -1; + if (pid != myself->pid && !ISSTATE (this, PID_NOTCYGWIN)) + { + commune_result cr = commune_request (PICOM_SIGINFO); + pnd = cr.pnd; + blk = cr.blk; + ign = cr.ign; + } + else + { + pnd = sig_send (myself, __SIGPENDING, NULL); + blk = cygheap->compute_sigblkmask (); + ign = 0; + for (int sig = 1; sig < NSIG; ++sig) + if (global_sigs[sig].sa_handler == SIG_IGN) + ign |= SIGTOMASK (sig); + } + return -1; +} + static HANDLE open_commune_proc_parms (DWORD pid, PRTL_USER_PROCESS_PARAMETERS prupp) { |