Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2004-12-05 22:41:26 +0300
committerChristopher Faylor <me@cgf.cx>2004-12-05 22:41:26 +0300
commit54dd79bb44d2180ab769558deab274c70391cca7 (patch)
tree344f9e32353901bd9274239beb32c35ad941e414 /winsup/cygwin/pinfo.h
parentd54b79d3514106b603a2811eadf9b265e2af90d3 (diff)
* sigproc.cc (mychild): Reimplement as list scan.
(proc_subproc): Don't mess with pinfo if it's myself. * child_info.h (child_info_types): Label enum for _PROC constants. (child_info::child_info): New constructor. (child_info::~child_info): New destructor. (child_info::sync): Declare new function. (child_info_fork::child_info_fork): New constructor. (child_info_spawn::child_info_spawn): Remove old constructor. (child_info_spawn::child_info_spawn): New constructor. * dcrt0.cc (dll_crt0_0): Use correct sizeof when doing sanity check on passed in child_info. Signal readiness to parent when not forking (and not spawning). * fork.cc (sync_with_child): Delete. (resume_child): Remove extra argument. (sync_with_parent): Use child_info method to sync with parent. (fork_child): Don't close fork_info->subproc_ready since that is now handled by the destructor. (fork_parent): Remove subproc_ready stuff. Use child_info sync method for waiting.. Set start time here for child. Rename "forked" to "child". (fork): Check ch.subproc_ready for validity here. * pinfo.h (_pinfo::exec_sendsig): Temp storage for exec stub which may be staying around to handle non-cygwin captive process. (_pinfo::exec_dwProcessId): Ditto. (_pinfo::_lock): Renamed from lock. (_pinfo::lock): New method. (_pinfo::unlock): Ditto. (_pinfo::initialize_lock): Ditto. * pinfo.cc (set_myself): Use initialize_lock method to initialize myself lock. Set "exec" fields in _pinfo to zero to indicate that we've started successfully. Set start time here when appropriate. (_pinfo::commune_send): Use pinfo lock/unlock methods. (proc_waiter): Remove special case for non-cywin processes. Reinstitute handling for PID_NOCLDSTOP. * sigproc.cc (proc_subproc): Set proper EAGAIN errno when process table is filled. (sig_send): Use exec_* fields from _pinfo for sending signals if the the _pinfo sendsig never materializes. (child_info::child_info): New constructor, renamed from init_child_info. Zeroes child_info structure and sets appropriate fields in structure based on chtype. (child_info::~child_info): New destructor. Closes subproc_ready if it exists. (child_info_fork::child_info_fork): New constructor. (child_info_spawn::child_info_spawn): New constructor. (child_info::ready): New function. Signals parent when child is ready. (child_info::sync): New function. Wait for child to signal us or process to die. (remove_proc): Remove closing of hProcess since this should now be handled shortly after process creation. * spawn.cc (spawn_guts): Use child_info_spawn constructor rather than init_child_info. Save exec_sendsig and exec_dwProcessId in execing _pinfo. Rely on child_info constructor to properly set parent_wr_proc_pipe in ciresrv. Revert to previous determination on whether to start a process in suspended mode. Remove reparenting stuff. Just keep a stub around if starting a non-cygwin process.
Diffstat (limited to 'winsup/cygwin/pinfo.h')
-rw-r--r--winsup/cygwin/pinfo.h24
1 files changed, 21 insertions, 3 deletions
diff --git a/winsup/cygwin/pinfo.h b/winsup/cygwin/pinfo.h
index e1d5d35f6..c249fe174 100644
--- a/winsup/cygwin/pinfo.h
+++ b/winsup/cygwin/pinfo.h
@@ -111,6 +111,8 @@ public:
/* signals */
HANDLE sendsig;
+ HANDLE exec_sendsig;
+ DWORD exec_dwProcessId;
private:
sigset_t sig_mask;
public:
@@ -132,14 +134,14 @@ class pinfo
public:
HANDLE rd_proc_pipe;
HANDLE hProcess;
- CRITICAL_SECTION lock;
+ CRITICAL_SECTION _lock;
/* Handle associated with initial Windows pid which started it all. */
HANDLE pid_handle;
void init (pid_t, DWORD, HANDLE = NULL) __attribute__ ((regparm(3)));
pinfo () {}
pinfo (_pinfo *x): procinfo (x), hProcess (NULL), pid_handle (NULL) {}
pinfo (pid_t n) : rd_proc_pipe (NULL), hProcess (NULL), pid_handle (NULL) {init (n, 0);}
- pinfo (pid_t n, DWORD flag) : rd_proc_pipe (NULL), hProcess (NULL), pid_handle (NULL) {init (n, flag);}
+ pinfo (pid_t n, DWORD flag) : rd_proc_pipe (NULL), hProcess (NULL), pid_handle (NULL) {init (n, flag);}
void release ();
int wait () __attribute__ ((regparm (1)));
~pinfo ()
@@ -147,7 +149,9 @@ public:
if (destroy && procinfo)
release ();
}
-
+ void initialize_lock () {InitializeCriticalSection (&_lock);}
+ void lock () {EnterCriticalSection (&_lock);}
+ void unlock () {LeaveCriticalSection (&_lock);}
_pinfo *operator -> () const {return procinfo;}
int operator == (pinfo *x) const {return x->procinfo == procinfo;}
int operator == (pinfo &x) const {return x.procinfo == procinfo;}
@@ -175,6 +179,20 @@ public:
void set_acl();
};
+class proc_pipe
+{
+ bool _closeem;
+public:
+ HANDLE in;
+ HANDLE out;
+ void set (bool);
+ proc_pipe (bool closeem) {set (closeem);}
+ proc_pipe () : _closeem (false), in (NULL), out (NULL) {};
+ void close () {_closeem = true;}
+ ~proc_pipe ();
+ int operator == (int x) {return (int) in == x;}
+};
+
#define ISSTATE(p, f) (!!((p)->process_state & f))
#define NOTSTATE(p, f) (!((p)->process_state & f))