Change name from commune_recv to commune_process throughout. Change name from

commune_send to commune_request throughout.
* pinfo.h (PICOM_EXTRASTR): New flag.
(PICOM_FIFO): Define with new flag.
(_pinfo::hello_pid): Delete.
(_pinfo::tothem): Delete.
(_pinfo::fromthem): Delete.
(_pinfo::commune_process): Rename from commune_recv.  Add a siginfo_t argument
to declaration.
(_pinfo::commune_request): Rename from commune_send.  Change DWORD to
__uint32_t in declaration.
* pinfo.cc (_pinfo::commune_process): Rename from commune_recv.  Add siginfo_t
argument.  Use information from argument rather than reading from another pipe.
Synchronize with other process's commune event.
(_pinfo::commune_request): Rename from commune_send.  Change DWORD to __uint32
in argument.  Fill out information in new siginfo_t element and rely on
extended operation of sig_send rather than trying to deal with synchronization
issues here.  Use process handle and read pipe information filled out by
sig_send to gather information from the other process.
* sigproc.cc (sig_send): Take special action if "communing" to ensure
synchronization with the other process and to return information about the
other process to the caller.
(talktome): Accept a siginfo_t and handle arguments.  Read additional
information from the signal pipe when _si_commune._si_code has the
PICOM_EXTRASTR flag set.
(wait_sig): Pass the transmitted siginfo_t struct and the pipe handle to
talktome.  Close pipe read handle as soon as possible after we detect that
we're exiting.
This commit is contained in:
Christopher Faylor
2005-09-28 22:56:47 +00:00
parent 503490bb9f
commit 0730fa0763
6 changed files with 219 additions and 249 deletions

View File

@@ -22,8 +22,9 @@ struct commune_result
enum picom
{
PICOM_EXTRASTR = 0x80000000,
PICOM_CMDLINE = 1,
PICOM_FIFO = 2,
PICOM_FIFO = PICOM_EXTRASTR | 2,
PICOM_CWD = 3,
PICOM_ROOT = 4,
PICOM_FDS = 5,
@@ -57,9 +58,8 @@ public:
pid_t ppid;
/* dwProcessId contains the processid used for sending signals. It
* will be reset in a child process when it is capable of receiving
* signals.
*/
will be reset in a child process when it is capable of receiving
signals. */
DWORD dwProcessId;
/* Used to spawn a child for fork(), among other things. */
@@ -87,11 +87,6 @@ public:
/* Non-zero if process was stopped by a signal. */
char stopsig;
/* commune */
pid_t hello_pid;
HANDLE tothem;
HANDLE fromthem;
inline void set_has_pgid_children ()
{
if (pgid == pid)
@@ -110,10 +105,10 @@ public:
sig_mask = mask;
}
void commune_recv ();
commune_result commune_send (DWORD, ...);
void commune_process (siginfo_t&);
commune_result commune_request (__uint32_t, ...);
bool alive ();
fhandler_pipe *pipe_fhandler (HANDLE hdl, size_t &);
fhandler_pipe *pipe_fhandler (HANDLE, size_t &);
char *fd (int fd, size_t &);
char *fds (size_t &);
char *root (size_t &);
@@ -156,7 +151,6 @@ public:
HANDLE hProcess;
CRITICAL_SECTION _lock;
bool waiter_ready;
/* Handle associated with initial Windows pid which started it all. */
class cygthread *wait_thread;
void init (pid_t, DWORD, HANDLE) __attribute__ ((regparm(3)));
pinfo () {}