From 831d6fa520ed43d055924607a2d9be7fcc3813e9 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Wed, 30 Oct 2002 21:05:18 +0000 Subject: * external.cc (cygwin_internal): Implement CW_CMDLINE. * pinfo.h (SIGCOMMUNE): New signal type. (commune_result): New structure for commune functions. (picom): New enum for commune functions. (_pinfo::hello_pid): New. Pid who's communicating with me. (_pinfo::tothem): New. Handle of communicating pipe. (_pinfo::fromthem): Ditto. (_pinfo::commune_recv): Declare. (_pinfo::commune_send): Declare. (_pinfo::alive): Declare. (_pinfo::cmdline): Declare. (_pinfo::lock): Declare. * pinfo.cc (set_myself): Initialize new _pinfo lock. (_pinfo::alive): Define. Determines if process still exists. (_pinfo::commune_recv): Define. Receive info from another cooperating process. (_pinfo::commune_send): Define. Send info to another cooperating process. (_pinfo::cmdline): Define. Determine command line of a given process. * include/sys/cygwin.h (CW_CMDLINE): Define. *sigproc.cc (talktome): Communicate with any processes who want to talk to me. (wait_sig): Honor __SIGCOMMUNE. * fhandler.cc (fhandler_virtual::fixup_after_exec): Declare. * fhandler_proc.cc: Use malloc/free/realloc throughout rather than cmalloc since buffers don't need to be propagated to subprocesses. * fhandler_registry.cc: Ditto. * fhandler_virtual.cc: Ditto. (fhandler_virtual::fixup_after_exec): Define. * fhandler_process.cc: Ditto for malloc/free/realloc. (process_listin): Add "cmdline". (fhandler_process::fill_filebuf): Implement PROCESS_CMDLINE. * miscfuncs.cc (isalpha_array): New array populated with xor values for alpha characters to switch from one case to another. * string.h (cygwin_strcasematch): New asm implementation of case match. * string.h (cygwin_nstrcasematch): New asm implementation of counted case match. --- winsup/cygwin/pinfo.h | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'winsup/cygwin/pinfo.h') diff --git a/winsup/cygwin/pinfo.h b/winsup/cygwin/pinfo.h index dcb814bcc..fe36b5a27 100644 --- a/winsup/cygwin/pinfo.h +++ b/winsup/cygwin/pinfo.h @@ -16,7 +16,7 @@ enum { __SIGFLUSH = -2, __SIGSTRACE = -1, - __SIGUNUSED = 0, + __SIGCOMMUNE = 0, __SIGOFFSET = 2 }; @@ -25,6 +25,17 @@ enum #include #include "thread.h" +struct commune_result +{ + char *s; + int n; +}; + +enum picom +{ + PICOM_CMDLINE = 1 +}; + class _pinfo { public: @@ -81,6 +92,11 @@ public: /* Non-zero if process was stopped by a signal. */ char stopsig; + + /* commune */ + pid_t hello_pid; + HANDLE tothem; + HANDLE fromthem; void exit (UINT n, bool norecord = 0) __attribute__ ((noreturn, regparm(2))); @@ -119,12 +135,19 @@ public: } inline void setthread2signal (void *thr) {thread2signal = (pthread *) thr;} + void commune_recv (); + commune_result commune_send (DWORD); + bool alive (); + char *cmdline (size_t &); + + friend void __stdcall set_myself (pid_t, HANDLE); private: struct sigaction sigs[NSIG]; sigset_t sig_mask; /* one set for everything to ignore. */ LONG _sigtodo[NSIG + __SIGOFFSET]; - pthread *thread2signal; // NULL means means thread any other means a pthread + pthread *thread2signal; // NULL means thread any other means a pthread + CRITICAL_SECTION lock; }; class pinfo -- cgit v1.2.3