aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2008-12-20 17:32:31 +0000
committerChristopher Faylor <me@cgf.cx>2008-12-20 17:32:31 +0000
commit9ac421686a3a77943e12c1f7399ff79d06619a3d (patch)
treebb68435b0baa447b263a9c2a2b0b9d5e9e766a0e
parente9982f2a2b1b43489985b071adc86c90ccbbfcb0 (diff)
downloadnewlib-9ac421686a3a77943e12c1f7399ff79d06619a3d.zip
newlib-9ac421686a3a77943e12c1f7399ff79d06619a3d.tar.gz
newlib-9ac421686a3a77943e12c1f7399ff79d06619a3d.tar.bz2
* 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.
-rw-r--r--winsup/cygwin/ChangeLog9
-rw-r--r--winsup/cygwin/dcrt0.cc4
-rw-r--r--winsup/cygwin/pinfo.cc24
-rw-r--r--winsup/cygwin/pinfo.h4
4 files changed, 25 insertions, 16 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 276b120..13499c0 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -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.
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index ccdedc6..961e605 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -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;
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index d5b3bc0..fd555c9 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -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;
diff --git a/winsup/cygwin/pinfo.h b/winsup/cygwin/pinfo.h
index 4f7f79b..5351595 100644
--- a/winsup/cygwin/pinfo.h
+++ b/winsup/cygwin/pinfo.h
@@ -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