* 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:
Christopher Faylor 2008-12-20 17:32:31 +00:00
parent e9982f2a2b
commit 9ac421686a
4 changed files with 25 additions and 16 deletions

View File

@ -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> 2008-12-20 Corinna Vinschen <corinna@vinschen.de>
* pwdgrp.h (pwdgrp::refresh): Fix indentation. * pwdgrp.h (pwdgrp::refresh): Fix indentation.

View File

@ -626,7 +626,7 @@ child_info_fork::handle_fork ()
{ {
cygheap_fixup_in_child (false); cygheap_fixup_in_child (false);
memory_init (); memory_init ();
set_myself (NULL); myself.thisproc (NULL);
myself->uid = cygheap->user.real_uid; myself->uid = cygheap->user.real_uid;
myself->gid = cygheap->user.real_gid; myself->gid = cygheap->user.real_gid;
@ -657,7 +657,7 @@ child_info_spawn::handle_spawn ()
!DuplicateHandle (hMainProc, moreinfo->myself_pinfo, hMainProc, &h, 0, !DuplicateHandle (hMainProc, moreinfo->myself_pinfo, hMainProc, &h, 0,
FALSE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE)) FALSE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
h = NULL; h = NULL;
set_myself (h); myself.thisproc (h);
__argc = moreinfo->argc; __argc = moreinfo->argc;
__argv = moreinfo->argv; __argv = moreinfo->argv;
envp = moreinfo->envp; envp = moreinfo->envp;

View File

@ -52,28 +52,30 @@ bool is_toplevel_proc;
_pinfo for this "pid" if h != NULL. */ _pinfo for this "pid" if h != NULL. */
void __stdcall void __stdcall
set_myself (HANDLE h) pinfo::thisproc (HANDLE h)
{ {
procinfo = NULL;
if (!h) if (!h)
cygheap->pid = cygwin_pid (myself_initial.pid); cygheap->pid = cygwin_pid (myself_initial.pid);
myself.init (cygheap->pid, PID_IN_USE, h ?: INVALID_HANDLE_VALUE); init (cygheap->pid, PID_IN_USE, h ?: INVALID_HANDLE_VALUE);
myself->process_state |= PID_IN_USE; procinfo->process_state |= PID_IN_USE;
myself->dwProcessId = myself_initial.pid; procinfo->dwProcessId = myself_initial.pid;
strcpy (myself->progname, myself_initial.progname); strcpy (procinfo->progname, myself_initial.progname);
strace.hello (); strace.hello ();
debug_printf ("myself->dwProcessId %u", myself->dwProcessId); debug_printf ("myself->dwProcessId %u", procinfo->dwProcessId);
if (h) if (h)
{ {
/* here if execed */ /* here if execed */
static pinfo NO_COPY myself_identity; static pinfo NO_COPY myself_identity;
myself_identity.init (cygwin_pid (myself->dwProcessId), PID_EXECED, NULL); myself_identity.init (cygwin_pid (procinfo->dwProcessId), PID_EXECED, NULL);
myself->exec_sendsig = NULL; procinfo->exec_sendsig = NULL;
myself->exec_dwProcessId = 0; procinfo->exec_dwProcessId = 0;
} }
else if (!child_proc_info) /* child_proc_info is only set when this process else if (!child_proc_info) /* child_proc_info is only set when this process
was started by another cygwin 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) else if (cygheap->pid_handle)
{ {
ForceCloseHandle (cygheap->pid_handle); ForceCloseHandle (cygheap->pid_handle);
@ -96,7 +98,7 @@ pinfo_init (char **envp, int envc)
{ {
/* Invent our own pid. */ /* Invent our own pid. */
set_myself (NULL); myself.thisproc (NULL);
myself->ppid = 1; myself->ppid = 1;
myself->pgid = myself->sid = myself->pid; myself->pgid = myself->sid = myself->pid;
myself->ctty = -1; myself->ctty = -1;

View File

@ -112,8 +112,6 @@ public:
bool __stdcall exists () __attribute__ ((regparm (1))); bool __stdcall exists () __attribute__ ((regparm (1)));
const char *_ctty (char *); const char *_ctty (char *);
friend void __stdcall set_myself (HANDLE);
/* signals */ /* signals */
HANDLE sendsig; HANDLE sendsig;
HANDLE exec_sendsig; HANDLE exec_sendsig;
@ -147,6 +145,7 @@ public:
pinfo (_pinfo *x): procinfo (x), hProcess (NULL) {} 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) : 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);} 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 (); void release ();
int wait () __attribute__ ((regparm (1))); int wait () __attribute__ ((regparm (1)));
~pinfo () ~pinfo ()
@ -222,7 +221,6 @@ cygwin_pid (pid_t pid)
} }
void __stdcall pinfo_init (char **, int); void __stdcall pinfo_init (char **, int);
void __stdcall set_myself (HANDLE h);
extern pinfo myself; extern pinfo myself;
#define _P_VFORK 0 #define _P_VFORK 0