diff options
author | Christopher Faylor <me@cgf.cx> | 2002-11-29 07:05:26 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2002-11-29 07:05:26 +0000 |
commit | 883bbc647820b396ff6929ae4d3cda329981a093 (patch) | |
tree | 9870d78924f4df51a52be1100d9ec93c938417f3 | |
parent | c0b813e5003809f9d93e3e1b646cb6c9114fe364 (diff) | |
download | newlib-883bbc647820b396ff6929ae4d3cda329981a093.zip newlib-883bbc647820b396ff6929ae4d3cda329981a093.tar.gz newlib-883bbc647820b396ff6929ae4d3cda329981a093.tar.bz2 |
* pinfo.h (winpids::set): Renamed from init.
(winpids::init): New declaration.
(winpids::cs): Ditto.
(winpids::winpids): Use set rather than init.
* external.cc (fillout_pinfo): Ditto.
* dcrt0.cc (dll_crt0_1): Call winpids::init.
* pinfo.cc (winpids::set): Renamed from init. Wrap calls in critical section.
(winpids::init): New function.
(winpids::cs): Define.
-rw-r--r-- | winsup/cygwin/ChangeLog | 13 | ||||
-rw-r--r-- | winsup/cygwin/dcrt0.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/external.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/pinfo.cc | 12 | ||||
-rw-r--r-- | winsup/cygwin/pinfo.h | 6 | ||||
-rw-r--r-- | winsup/cygwin/syscalls.cc | 2 |
6 files changed, 32 insertions, 5 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index e17bb5b..e3642bf 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,16 @@ +2002-11-29 Christopher Faylor <cgf@redhat.com> + + * pinfo.h (winpids::set): Renamed from init. + (winpids::init): New declaration. + (winpids::cs): Ditto. + (winpids::winpids): Use set rather than init. + * external.cc (fillout_pinfo): Ditto. + * dcrt0.cc (dll_crt0_1): Call winpids::init. + * pinfo.cc (winpids::set): Renamed from init. Wrap calls in critical + section. + (winpids::init): New function. + (winpids::cs): Define. + 2002-11-28 Christopher Faylor <cgf@redhat.com> * sigproc.cc (sig_dispatch_pending): Remove assertion. diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 6c6acbd..d42fbfa 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -569,6 +569,8 @@ dll_crt0_1 () mainthread.init ("mainthread"); // For use in determining if signals // should be blocked. + winpids::init (); + int envc = 0; char **envp = NULL; diff --git a/winsup/cygwin/external.cc b/winsup/cygwin/external.cc index 85f4032..582bb2a 100644 --- a/winsup/cygwin/external.cc +++ b/winsup/cygwin/external.cc @@ -43,7 +43,7 @@ fillout_pinfo (pid_t pid, int winpid) static unsigned int i; if (!pids.npids || !nextpid) { - pids.init (winpid); + pids.set (winpid); i = 0; } diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index 6feea64..75b71f2 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -613,12 +613,22 @@ winpids::enum9x (bool winpid) return nelem; } +NO_COPY CRITICAL_SECTION winpids::cs; + void -winpids::init (bool winpid) +winpids::set (bool winpid) { + EnterCriticalSection (&cs); npids = (this->*enum_processes) (winpid); if (pidlist) pidlist[npids] = 0; + LeaveCriticalSection (&cs); +} + +void +winpids::init () +{ + InitializeCriticalSection (&cs); } DWORD diff --git a/winsup/cygwin/pinfo.h b/winsup/cygwin/pinfo.h index fe36b5a..829a2c1 100644 --- a/winsup/cygwin/pinfo.h +++ b/winsup/cygwin/pinfo.h @@ -203,17 +203,19 @@ class winpids DWORD enumNT (bool winpid); DWORD enum9x (bool winpid); void add (DWORD& nelem, bool, DWORD pid); + static CRITICAL_SECTION cs; public: DWORD npids; inline void reset () { npids = 0; release (); } - void init (bool winpid); + void set (bool winpid); winpids (int): enum_processes (&winpids::enum_init) { reset (); } winpids (): pidlist (NULL), npidlist (0), pinfolist (NULL), - enum_processes (&winpids::enum_init), npids (0) { init (0); } + enum_processes (&winpids::enum_init), npids (0) { set (0); } inline DWORD& winpid (int i) const {return pidlist[i];} inline _pinfo *operator [] (int i) const {return (_pinfo *) pinfolist[i];} ~winpids (); void release (); + static void init (); }; extern __inline pid_t diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index edfa3ed..eff7394 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -339,7 +339,7 @@ getsid (pid_t pid) extern "C" ssize_t read (int fd, void *ptr, size_t len) { - const struct iovec iov = + const iovec iov = { iov_base: ptr, iov_len: len |