* external.cc (cygwin_internal): Initialize various internal settings if
required to allow use of some things from user loaded DLL. (CW_STRACE_ON): Add new feature. (CW_CYGWIN_PID_TO_WINPID): Ditto. * pinfo.cc (set_myself): Call "strace.hello" to initiate possible strace session. (pinfo::init): Guard against dereferencing uninitialized myself. * sigproc.cc (wait_sig): Call strace.hello() when __SIGTRACE "signal" received. * strace.cc (strace::hello): New method. * wincap.cc (wincapc::init): Avoid initializing if already initialized. * wincap.h (wincapc::wincapc): New method. * include/sys/cygwin.h: Add new CW_ enums. Kludge typedefs of {g,u}id_t if required. * strace.h (strace::hello): Declare new method.
This commit is contained in:
@@ -26,6 +26,8 @@ details. */
|
||||
#include "path.h"
|
||||
#include "dtable.h"
|
||||
#include "cygheap.h"
|
||||
#include "wincap.h"
|
||||
#include "heap.h"
|
||||
|
||||
static external_pinfo *
|
||||
fillout_pinfo (pid_t pid, int winpid)
|
||||
@@ -121,6 +123,16 @@ cygwin_internal (cygwin_getinfo_types t, ...)
|
||||
{
|
||||
va_list arg;
|
||||
va_start (arg, t);
|
||||
if (t != CW_USER_DATA)
|
||||
{
|
||||
wincap.init ();
|
||||
if (!myself)
|
||||
{
|
||||
memory_init ();
|
||||
malloc_init ();
|
||||
set_myself (1);
|
||||
}
|
||||
}
|
||||
|
||||
switch (t)
|
||||
{
|
||||
@@ -194,6 +206,26 @@ cygwin_internal (cygwin_getinfo_types t, ...)
|
||||
# undef cr
|
||||
}
|
||||
|
||||
case CW_STRACE_ON:
|
||||
{
|
||||
pid_t pid = va_arg (arg, pid_t);
|
||||
pinfo p (pid);
|
||||
if (p)
|
||||
{
|
||||
sig_send (p, __SIGSTRACE);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
set_errno (ESRCH);
|
||||
return (DWORD) -1;
|
||||
}
|
||||
}
|
||||
case CW_CYGWIN_PID_TO_WINPID:
|
||||
{
|
||||
pinfo p (va_arg (arg, pid_t));
|
||||
return p ? p->dwProcessId : 0;
|
||||
}
|
||||
default:
|
||||
return (DWORD) -1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user