diff options
author | Christopher Faylor <me@cgf.cx> | 2000-08-23 14:56:28 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2000-08-23 14:56:28 +0000 |
commit | e1cf4ae80c43bd50e0e8f156d61d948d2947d295 (patch) | |
tree | 6ad8ee4a9dc7d7439d949a6531b050f74d00bc83 /winsup/cygwin | |
parent | c19e7ba723bb4246a375b41678c2b730718d00e4 (diff) | |
download | newlib-e1cf4ae80c43bd50e0e8f156d61d948d2947d295.zip newlib-e1cf4ae80c43bd50e0e8f156d61d948d2947d295.tar.gz newlib-e1cf4ae80c43bd50e0e8f156d61d948d2947d295.tar.bz2 |
Revert previous erroneous checkin.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r-- | winsup/cygwin/dcrt0.cc | 11 | ||||
-rw-r--r-- | winsup/cygwin/pinfo.cc | 21 | ||||
-rw-r--r-- | winsup/cygwin/pinfo.h | 10 | ||||
-rw-r--r-- | winsup/cygwin/shared.h | 1 | ||||
-rw-r--r-- | winsup/cygwin/spawn.cc | 4 | ||||
-rw-r--r-- | winsup/cygwin/winsup.h | 1 |
6 files changed, 12 insertions, 36 deletions
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index ff43312..fa0f4dd 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -666,7 +666,7 @@ dll_crt0_1 () // should be blocked. if (mypid) - set_myself ((pid_t) mypid, NULL); + set_myself ((pid_t) mypid); (void) SetErrorMode (SEM_FAILCRITICALERRORS); @@ -834,7 +834,6 @@ _dll_crt0 () DuplicateHandle (hMainProc, GetCurrentThread (), hMainProc, &hMainThread, 0, FALSE, DUPLICATE_SAME_ACCESS); - HANDLE h; GetStartupInfo (&si); if (si.cbReserved2 >= EXEC_MAGIC_SIZE && memcmp (ciresrv->zero, zeros, sizeof (zeros)) == 0) @@ -869,14 +868,6 @@ _dll_crt0 () case PROC_EXEC: case PROC_SPAWN: info = si.lpReserved2 + ciresrv->cb; - if (child_proc_info->myself_pinfo && - DuplicateHandle (hMainProc, child_proc_info->myself_pinfo, - hMainProc, &h, 0, 0, - DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE)) - { - set_myself (mypid, h); - mypid = 0; - } break; case PROC_FORK: case PROC_FORK1: diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index 0d52ec9..347015b 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -30,17 +30,17 @@ static pinfo NO_COPY myself_identity ((_pinfo *)&pinfo_dummy); This is done once when the dll is first loaded. */ void __stdcall -set_myself (pid_t pid, HANDLE h) +set_myself (pid_t pid) { DWORD winpid = GetCurrentProcessId (); if (pid == 1) pid = cygwin_pid (winpid); - myself.init (pid, 1, h); + myself.init (pid, 1); myself->dwProcessId = winpid; myself->process_state |= PID_IN_USE; myself->start_time = time (NULL); /* Register our starting time. */ pid_t myself_cyg_pid = cygwin_pid (myself->dwProcessId); - if (pid != myself_cyg_pid && parent_alive) + if (pid != myself_cyg_pid) myself_identity.init (myself_cyg_pid, PID_EXECED); char buf[30]; @@ -95,7 +95,7 @@ pinfo_init (LPBYTE info) { /* Invent our own pid. */ - set_myself (1, NULL); + set_myself (1); myself->ppid = 1; myself->pgid = myself->sid = myself->pid; myself->ctty = -1; @@ -197,7 +197,7 @@ _pinfo::record_death () } void -pinfo::init (pid_t n, DWORD create, HANDLE in_h) +pinfo::init (pid_t n, DWORD create) { if (n == myself->pid) { @@ -217,12 +217,7 @@ pinfo::init (pid_t n, DWORD create, HANDLE in_h) else mapsize = sizeof (_pinfo); - if (in_h) - { - h = in_h; - created = 0; - } - else if (!create) + if (!create) { /* CGF FIXME -- deal with inheritance after an exec */ h = OpenFileMappingA (FILE_MAP_READ | FILE_MAP_WRITE, FALSE, mapname); @@ -230,7 +225,7 @@ pinfo::init (pid_t n, DWORD create, HANDLE in_h) } else { - h = CreateFileMapping ((HANDLE) 0xffffffff, &sec_all_nih, + h = CreateFileMapping ((HANDLE) 0xffffffff, &sec_none_nih, PAGE_READWRITE, 0, mapsize, mapname); created = h && GetLastError () != ERROR_ALREADY_EXISTS; } @@ -243,13 +238,11 @@ pinfo::init (pid_t n, DWORD create, HANDLE in_h) return; } - ProtectHandle1 (h, pinfo_shared_handle); child = (_pinfo *) MapViewOfFile (h, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 0); if (child->process_state & PID_EXECED) { pid_t realpid = child->pid; - debug_printf ("execed process windows pid %d, cygwin pid %d", n, realpid); release (); if (realpid == n) api_fatal ("retrieval of execed process info for pid %d failed due to recursion.", n); diff --git a/winsup/cygwin/pinfo.h b/winsup/cygwin/pinfo.h index f846598..b8ee914 100644 --- a/winsup/cygwin/pinfo.h +++ b/winsup/cygwin/pinfo.h @@ -117,7 +117,7 @@ class pinfo _pinfo *child; int destroy; public: - void init (pid_t n, DWORD create = 0, HANDLE h = NULL); + void init (pid_t n, DWORD create = 0); pinfo () {} pinfo (_pinfo *x): child (x) {} pinfo (pid_t n) {init (n);} @@ -127,7 +127,7 @@ public: if (h) { UnmapViewOfFile (child); - ForceCloseHandle1 (h, pinfo_shared_handle); + CloseHandle (h); h = NULL; } } @@ -145,9 +145,7 @@ public: int operator == (char *x) const {return (char *) child == x;} _pinfo *operator * () const {return child;} operator _pinfo * () const {return child;} - // operator bool () const {return (int) h;} void remember () {destroy = 0; proc_subproc (PROC_ADDCHILD, (DWORD) this);} - HANDLE shared_handle () {return h;} }; #define ISSTATE(p, f) (!!((p)->process_state & f)) @@ -170,7 +168,5 @@ cygwin_pid (pid_t pid) { return (pid_t) (os_being_run == winNT) ? pid : -(int) pid; } - -void __stdcall pinfo_init (BYTE *); -void __stdcall set_myself (pid_t pid, HANDLE h = NULL); +void __stdcall pinfo_init (PBYTE); extern pinfo myself; diff --git a/winsup/cygwin/shared.h b/winsup/cygwin/shared.h index 1671d0d..2a8e9a6 100644 --- a/winsup/cygwin/shared.h +++ b/winsup/cygwin/shared.h @@ -67,7 +67,6 @@ public: HANDLE shared_h; HANDLE console_h; HANDLE parent_alive; // handle of thread used to track children - HANDLE myself_pinfo; }; class child_info_fork: public child_info diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index b43746c..940f8d1 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -494,10 +494,6 @@ skip_arg_parsing: } init_child_info (chtype, ciresrv, (mode == _P_OVERLAY) ? myself->pid : 1, spr); - if (mode != _P_OVERLAY || - !DuplicateHandle (hMainProc, myself.shared_handle (), hMainProc, &ciresrv->myself_pinfo, 0, - TRUE, DUPLICATE_SAME_ACCESS)) - ciresrv->myself_pinfo = NULL; LPBYTE resrv = si.lpReserved2 + sizeof *ciresrv; # undef ciresrv diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h index 5612669..be151e7 100644 --- a/winsup/cygwin/winsup.h +++ b/winsup/cygwin/winsup.h @@ -283,6 +283,7 @@ long __stdcall to_time_t (FILETIME * ptr); int __stdcall lock_pinfo_for_update (DWORD timeout); #endif void unlock_pinfo (void); +void _stdcall set_myself (pid_t pid); /* Retrieve a security descriptor that allows all access */ SECURITY_DESCRIPTOR *__stdcall get_null_sd (void); |