* pinfo.h (pinfo::thisproc): Declare. Rename from set_myself.
* pinfo.cc (pinfo::thisproc): Define. Rename from set_myself. Set procinfo to NULL to avoid confusing subsequent init. (pinfo_init): Accommodate set_myself -> pinfo::thisproc rename. * dcrt0.cc (child_info_fork::handle_fork): Ditto. (child_info_spawn::handle_spawn): Ditto.
This commit is contained in:
		| @@ -1,3 +1,12 @@ | ||||
| 2008-12-20  Christopher Faylor  <me+cygwin@cgf.cx> | ||||
|  | ||||
| 	* pinfo.h (pinfo::thisproc): Declare.  Rename from set_myself. | ||||
| 	* pinfo.cc (pinfo::thisproc): Define.  Rename from set_myself.  Set | ||||
| 	procinfo to NULL to avoid confusing subsequent init. | ||||
| 	(pinfo_init): Accommodate set_myself -> pinfo::thisproc rename. | ||||
| 	* dcrt0.cc (child_info_fork::handle_fork): Ditto. | ||||
| 	(child_info_spawn::handle_spawn): Ditto. | ||||
|  | ||||
| 2008-12-20  Corinna Vinschen  <corinna@vinschen.de> | ||||
|  | ||||
| 	* pwdgrp.h (pwdgrp::refresh): Fix indentation. | ||||
|   | ||||
| @@ -626,7 +626,7 @@ child_info_fork::handle_fork () | ||||
| { | ||||
|   cygheap_fixup_in_child (false); | ||||
|   memory_init (); | ||||
|   set_myself (NULL); | ||||
|   myself.thisproc (NULL); | ||||
|   myself->uid = cygheap->user.real_uid; | ||||
|   myself->gid = cygheap->user.real_gid; | ||||
|  | ||||
| @@ -657,7 +657,7 @@ child_info_spawn::handle_spawn () | ||||
|       !DuplicateHandle (hMainProc, moreinfo->myself_pinfo, hMainProc, &h, 0, | ||||
| 			FALSE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE)) | ||||
|     h = NULL; | ||||
|   set_myself (h); | ||||
|   myself.thisproc (h); | ||||
|   __argc = moreinfo->argc; | ||||
|   __argv = moreinfo->argv; | ||||
|   envp = moreinfo->envp; | ||||
|   | ||||
| @@ -52,28 +52,30 @@ bool is_toplevel_proc; | ||||
|    _pinfo for this "pid" if h != NULL. */ | ||||
|  | ||||
| void __stdcall | ||||
| set_myself (HANDLE h) | ||||
| pinfo::thisproc (HANDLE h) | ||||
| { | ||||
|   procinfo = NULL; | ||||
|  | ||||
|   if (!h) | ||||
|     cygheap->pid = cygwin_pid (myself_initial.pid); | ||||
|  | ||||
|   myself.init (cygheap->pid, PID_IN_USE, h ?: INVALID_HANDLE_VALUE); | ||||
|   myself->process_state |= PID_IN_USE; | ||||
|   myself->dwProcessId = myself_initial.pid; | ||||
|   strcpy (myself->progname, myself_initial.progname); | ||||
|   init (cygheap->pid, PID_IN_USE, h ?: INVALID_HANDLE_VALUE); | ||||
|   procinfo->process_state |= PID_IN_USE; | ||||
|   procinfo->dwProcessId = myself_initial.pid; | ||||
|   strcpy (procinfo->progname, myself_initial.progname); | ||||
|   strace.hello (); | ||||
|   debug_printf ("myself->dwProcessId %u", myself->dwProcessId); | ||||
|   debug_printf ("myself->dwProcessId %u", procinfo->dwProcessId); | ||||
|   if (h) | ||||
|     { | ||||
|       /* here if execed */ | ||||
|       static pinfo NO_COPY myself_identity; | ||||
|       myself_identity.init (cygwin_pid (myself->dwProcessId), PID_EXECED, NULL); | ||||
|       myself->exec_sendsig = NULL; | ||||
|       myself->exec_dwProcessId = 0; | ||||
|       myself_identity.init (cygwin_pid (procinfo->dwProcessId), PID_EXECED, NULL); | ||||
|       procinfo->exec_sendsig = NULL; | ||||
|       procinfo->exec_dwProcessId = 0; | ||||
|     } | ||||
|   else if (!child_proc_info)	/* child_proc_info is only set when this process | ||||
| 				   was started by another cygwin process */ | ||||
|     myself->start_time = time (NULL); /* Register our starting time. */ | ||||
|     procinfo->start_time = time (NULL); /* Register our starting time. */ | ||||
|   else if (cygheap->pid_handle) | ||||
|     { | ||||
|       ForceCloseHandle (cygheap->pid_handle); | ||||
| @@ -96,7 +98,7 @@ pinfo_init (char **envp, int envc) | ||||
|     { | ||||
|       /* Invent our own pid.  */ | ||||
|  | ||||
|       set_myself (NULL); | ||||
|       myself.thisproc (NULL); | ||||
|       myself->ppid = 1; | ||||
|       myself->pgid = myself->sid = myself->pid; | ||||
|       myself->ctty = -1; | ||||
|   | ||||
| @@ -112,8 +112,6 @@ public: | ||||
|   bool __stdcall exists () __attribute__ ((regparm (1))); | ||||
|   const char *_ctty (char *); | ||||
|  | ||||
|   friend void __stdcall set_myself (HANDLE); | ||||
|  | ||||
|   /* signals */ | ||||
|   HANDLE sendsig; | ||||
|   HANDLE exec_sendsig; | ||||
| @@ -147,6 +145,7 @@ public: | ||||
|   pinfo (_pinfo *x): procinfo (x), hProcess (NULL) {} | ||||
|   pinfo (pid_t n) : rd_proc_pipe (NULL), hProcess (NULL) {init (n, 0, NULL);} | ||||
|   pinfo (pid_t n, DWORD flag) : rd_proc_pipe (NULL), hProcess (NULL), waiter_ready (0), wait_thread (NULL) {init (n, flag, NULL);} | ||||
|   void thisproc (HANDLE) __attribute__ ((regparm (2))); | ||||
|   void release (); | ||||
|   int wait () __attribute__ ((regparm (1))); | ||||
|   ~pinfo () | ||||
| @@ -222,7 +221,6 @@ cygwin_pid (pid_t pid) | ||||
| } | ||||
|  | ||||
| void __stdcall pinfo_init (char **, int); | ||||
| void __stdcall set_myself (HANDLE h); | ||||
| extern pinfo myself; | ||||
|  | ||||
| #define _P_VFORK 0 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user