* autoload.cc (timeBeginPeriod): Autoload.

* dcrt0.cc (dll_crt0_1): Use timeBeginPeriod to set default resolution to 1 ms.
* pinfo.cc (pinfo::thisproc): Set ppid for redirected _pinfo blocks too.
(pinfo::init): Avoid using VirtualQuery.  Just rely on the assumption that
procinfo will be populated.
* pinfo.h (_pinfo::ppid): Move into redirected block.
This commit is contained in:
Christopher Faylor 2013-12-18 04:28:46 +00:00
parent 13621d2ef8
commit e9da9dfb94
5 changed files with 18 additions and 11 deletions

View File

@ -1,3 +1,13 @@
2013-12-17 Christopher Faylor <me.cygwin2013@cgf.cx>
* autoload.cc (timeBeginPeriod): Autoload.
* dcrt0.cc (dll_crt0_1): Use timeBeginPeriod to set default resolution
to 1 ms.
* pinfo.cc (pinfo::thisproc): Set ppid for redirected _pinfo blocks too.
(pinfo::init): Avoid using VirtualQuery. Just rely on the assumption that
procinfo will be populated.
* pinfo.h (_pinfo::ppid): Move into redirected block.
2013-12-17 Christopher Faylor <me.cygwin2013@cgf.cx> 2013-12-17 Christopher Faylor <me.cygwin2013@cgf.cx>
* external.cc (fillout_pinfo): Remove nonsensical loop. * external.cc (fillout_pinfo): Remove nonsensical loop.

View File

@ -643,6 +643,7 @@ LoadDLLfunc (SetParent, 8, user32)
LoadDLLfunc (SetProcessWindowStation, 4, user32) LoadDLLfunc (SetProcessWindowStation, 4, user32)
LoadDLLfunc (SetThreadDesktop, 4, user32) LoadDLLfunc (SetThreadDesktop, 4, user32)
LoadDLLfunc (timeBeginPeriod, 4, winmm)
LoadDLLfuncEx3 (waveInAddBuffer, 12, winmm, 1, 0, 1) LoadDLLfuncEx3 (waveInAddBuffer, 12, winmm, 1, 0, 1)
LoadDLLfuncEx3 (waveInClose, 4, winmm, 1, 0, 1) LoadDLLfuncEx3 (waveInClose, 4, winmm, 1, 0, 1)
LoadDLLfuncEx3 (waveInGetNumDevs, 0, winmm, 1, 0, 1) LoadDLLfuncEx3 (waveInGetNumDevs, 0, winmm, 1, 0, 1)

View File

@ -836,6 +836,7 @@ dll_crt0_1 (void *)
{ {
extern void initial_setlocale (); extern void initial_setlocale ();
timeBeginPeriod (1);
_my_tls.incyg++; _my_tls.incyg++;
/* Inherit "parent" exec'ed process sigmask */ /* Inherit "parent" exec'ed process sigmask */
if (spawn_info && !in_forkee) if (spawn_info && !in_forkee)

View File

@ -77,6 +77,7 @@ pinfo::thisproc (HANDLE h)
myself_identity.init (cygwin_pid (procinfo->dwProcessId), PID_EXECED, NULL); myself_identity.init (cygwin_pid (procinfo->dwProcessId), PID_EXECED, NULL);
procinfo->exec_sendsig = NULL; procinfo->exec_sendsig = NULL;
procinfo->exec_dwProcessId = 0; procinfo->exec_dwProcessId = 0;
myself_identity->ppid = procinfo->pid;
} }
} }
@ -317,14 +318,9 @@ pinfo::init (pid_t n, DWORD flag, HANDLE h0)
If the block has been allocated with PINFO_REDIR_SIZE but not yet If the block has been allocated with PINFO_REDIR_SIZE but not yet
updated with a PID_EXECED state then we'll retry. */ updated with a PID_EXECED state then we'll retry. */
if (!created && !(flag & PID_NEW)) if (!created && !(flag & PID_NEW))
{ /* If not populated, wait 2 seconds for procinfo to become populated */
MEMORY_BASIC_INFORMATION mbi; for (int i = 0; i < 2000 && !procinfo->ppid; i++)
for (int i = 0; i < 1000 && !procinfo->ppid; i++) Sleep (1);
Sleep (0);
if (procinfo->exists () && VirtualQuery (procinfo, &mbi, sizeof (mbi))
&& mbi.RegionSize < sizeof (_pinfo))
goto loop;
}
if (!created && createit && (procinfo->process_state & PID_REAPED)) if (!created && createit && (procinfo->process_state & PID_REAPED))
{ {

View File

@ -50,6 +50,8 @@ public:
constants in <sys/cygwin.h>. */ constants in <sys/cygwin.h>. */
DWORD process_state; DWORD process_state;
pid_t ppid; /* Parent process id. */
DWORD exitcode; /* set when process exits */ DWORD exitcode; /* set when process exits */
#define PINFO_REDIR_SIZE ((char *) &myself.procinfo->exitcode - (char *) myself.procinfo) #define PINFO_REDIR_SIZE ((char *) &myself.procinfo->exitcode - (char *) myself.procinfo)
@ -57,9 +59,6 @@ public:
/* > 0 if started by a cygwin process */ /* > 0 if started by a cygwin process */
DWORD cygstarted; DWORD cygstarted;
/* Parent process id. */
pid_t ppid;
/* dwProcessId contains the processid used for sending signals. It /* dwProcessId contains the processid used for sending signals. It
will be reset in a child process when it is capable of receiving will be reset in a child process when it is capable of receiving
signals. */ signals. */