* Merge in cygwin-64bit-branch.
This commit is contained in:
@@ -120,7 +120,7 @@ pinfo::status_exit (DWORD x)
|
||||
char posix_prog[NT_MAX_PATH];
|
||||
path_conv pc;
|
||||
if (!procinfo)
|
||||
pc.check ("/dev/null");
|
||||
pc.check ("/dev/null");
|
||||
else
|
||||
{
|
||||
UNICODE_STRING uc;
|
||||
@@ -128,7 +128,8 @@ pinfo::status_exit (DWORD x)
|
||||
pc.check (&uc, PC_NOWARN);
|
||||
}
|
||||
mount_table->conv_to_posix_path (pc.get_win32 (), posix_prog, 1);
|
||||
small_printf ("%s: error while loading shared libraries: %s: cannot open shared object file: No such file or directory\n",
|
||||
small_printf ("%s: error while loading shared libraries: %s: cannot "
|
||||
"open shared object file: No such file or directory\n",
|
||||
posix_prog, find_first_notloaded_dll (pc));
|
||||
x = 127 << 8;
|
||||
}
|
||||
@@ -144,7 +145,7 @@ pinfo::status_exit (DWORD x)
|
||||
x = SIGILL;
|
||||
break;
|
||||
default:
|
||||
debug_printf ("*** STATUS_%p\n", x);
|
||||
debug_printf ("*** STATUS_%y\n", x);
|
||||
x = 127 << 8;
|
||||
}
|
||||
return EXITCODE_SET | x;
|
||||
@@ -174,7 +175,7 @@ pinfo::maybe_set_exit_code_from_windows ()
|
||||
GetExitCodeProcess (hProcess, &x);
|
||||
set_exit_code (x);
|
||||
}
|
||||
sigproc_printf ("pid %d, exit value - old %p, windows %p, cygwin %p",
|
||||
sigproc_printf ("pid %d, exit value - old %y, windows %y, cygwin %y",
|
||||
self->pid, oexitcode, x, self->exitcode);
|
||||
}
|
||||
|
||||
@@ -208,7 +209,7 @@ pinfo::exit (DWORD n)
|
||||
int exitcode = self->exitcode & 0xffff;
|
||||
if (!self->cygstarted)
|
||||
exitcode = ((exitcode & 0xff) << 8) | ((exitcode >> 8) & 0xff);
|
||||
sigproc_printf ("Calling ExitProcess n %p, exitcode %p", n, exitcode);
|
||||
sigproc_printf ("Calling ExitProcess n %y, exitcode %y", n, exitcode);
|
||||
if (!TerminateProcess (GetCurrentProcess (), exitcode))
|
||||
system_printf ("TerminateProcess failed, %E");
|
||||
ExitProcess (exitcode);
|
||||
@@ -324,7 +325,7 @@ pinfo::init (pid_t n, DWORD flag, HANDLE h0)
|
||||
if (procinfo->process_state & PID_EXECED)
|
||||
{
|
||||
pid_t realpid = procinfo->pid;
|
||||
debug_printf ("execed process windows pid %d, cygwin pid %d", n, realpid);
|
||||
debug_printf ("execed process windows pid %u, cygwin pid %d", n, realpid);
|
||||
if (realpid == n)
|
||||
api_fatal ("retrieval of execed process info for pid %d failed due to recursion.", n);
|
||||
|
||||
@@ -389,9 +390,9 @@ pinfo::set_acl()
|
||||
RtlCreateSecurityDescriptor (&sd, SECURITY_DESCRIPTOR_REVISION);
|
||||
status = RtlSetDaclSecurityDescriptor (&sd, TRUE, acl_buf, FALSE);
|
||||
if (!NT_SUCCESS (status))
|
||||
debug_printf ("RtlSetDaclSecurityDescriptor %p", status);
|
||||
debug_printf ("RtlSetDaclSecurityDescriptor %y", status);
|
||||
else if ((status = NtSetSecurityObject (h, DACL_SECURITY_INFORMATION, &sd)))
|
||||
debug_printf ("NtSetSecurityObject %p", status);
|
||||
debug_printf ("NtSetSecurityObject %y", status);
|
||||
}
|
||||
|
||||
pinfo::pinfo (HANDLE parent, pinfo_minimal& from, pid_t pid):
|
||||
@@ -441,7 +442,7 @@ bool
|
||||
_pinfo::set_ctty (fhandler_termios *fh, int flags)
|
||||
{
|
||||
tty_min& tc = *fh->tc ();
|
||||
debug_printf ("old %s, ctty device number %p, tc.ntty device number %p flags & O_NOCTTY %p", __ctty (), ctty, tc.ntty, flags & O_NOCTTY);
|
||||
debug_printf ("old %s, ctty device number %y, tc.ntty device number %y flags & O_NOCTTY %y", __ctty (), ctty, tc.ntty, flags & O_NOCTTY);
|
||||
if (fh && &tc && (ctty <= 0 || ctty == tc.ntty) && !(flags & O_NOCTTY))
|
||||
{
|
||||
ctty = tc.ntty;
|
||||
@@ -641,7 +642,7 @@ commune_process (void *arg)
|
||||
{
|
||||
DWORD res = WaitForSingleObject (process_sync, 5000);
|
||||
if (res != WAIT_OBJECT_0)
|
||||
sigproc_printf ("WFSO failed - %d, %E", res);
|
||||
sigproc_printf ("WFSO failed - %u, %E", res);
|
||||
else
|
||||
sigproc_printf ("synchronized with pid %d", si.si_pid);
|
||||
ForceCloseHandle (process_sync);
|
||||
@@ -688,7 +689,7 @@ _pinfo::commune_request (__uint32_t code, ...)
|
||||
va_end (args);
|
||||
|
||||
char name_buf[MAX_PATH];
|
||||
request_sync = CreateSemaphore (&sec_none_nih, 0, LONG_MAX,
|
||||
request_sync = CreateSemaphore (&sec_none_nih, 0, INT32_MAX,
|
||||
shared_name (name_buf, "commune", myself->pid));
|
||||
if (!request_sync)
|
||||
goto err;
|
||||
@@ -702,7 +703,7 @@ _pinfo::commune_request (__uint32_t code, ...)
|
||||
goto err;
|
||||
}
|
||||
|
||||
size_t n;
|
||||
DWORD n;
|
||||
switch (code)
|
||||
{
|
||||
case PICOM_CMDLINE:
|
||||
@@ -711,7 +712,7 @@ _pinfo::commune_request (__uint32_t code, ...)
|
||||
case PICOM_FDS:
|
||||
case PICOM_FD:
|
||||
case PICOM_PIPE_FHANDLER:
|
||||
if (!ReadPipeOverlapped (fromthem, &n, sizeof n, &nr, 500L)
|
||||
if (!ReadPipeOverlapped (fromthem, &n, sizeof n, &nr, 1000L)
|
||||
|| nr != sizeof n)
|
||||
{
|
||||
__seterrno ();
|
||||
@@ -724,7 +725,7 @@ _pinfo::commune_request (__uint32_t code, ...)
|
||||
res.s = (char *) cmalloc_abort (HEAP_COMMUNE, n);
|
||||
char *p;
|
||||
for (p = res.s;
|
||||
n && ReadPipeOverlapped (fromthem, p, n, &nr, 500L);
|
||||
n && ReadPipeOverlapped (fromthem, p, n, &nr, 1000L);
|
||||
p += nr, n -= nr)
|
||||
continue;
|
||||
if (n)
|
||||
@@ -999,7 +1000,7 @@ pinfo::wait ()
|
||||
else
|
||||
{
|
||||
wait_thread = h;
|
||||
sigproc_printf ("created tracking thread for pid %d, winpid %p, rd_proc_pipe %p",
|
||||
sigproc_printf ("created tracking thread for pid %d, winpid %y, rd_proc_pipe %p",
|
||||
(*this)->pid, (*this)->dwProcessId, rd_proc_pipe);
|
||||
}
|
||||
|
||||
@@ -1254,11 +1255,11 @@ winpids::enum_processes (bool winpid)
|
||||
if (winpid)
|
||||
{
|
||||
static DWORD szprocs;
|
||||
static PSYSTEM_PROCESSES procs;
|
||||
static PSYSTEM_PROCESS_INFORMATION procs;
|
||||
|
||||
if (!szprocs)
|
||||
{
|
||||
procs = (PSYSTEM_PROCESSES)
|
||||
procs = (PSYSTEM_PROCESS_INFORMATION)
|
||||
malloc (sizeof (*procs) + (szprocs = 200 * sizeof (*procs)));
|
||||
if (!procs)
|
||||
{
|
||||
@@ -1271,16 +1272,16 @@ winpids::enum_processes (bool winpid)
|
||||
for (;;)
|
||||
{
|
||||
status =
|
||||
NtQuerySystemInformation (SystemProcessesAndThreadsInformation,
|
||||
NtQuerySystemInformation (SystemProcessInformation,
|
||||
procs, szprocs, NULL);
|
||||
if (NT_SUCCESS (status))
|
||||
break;
|
||||
|
||||
if (status == STATUS_INFO_LENGTH_MISMATCH)
|
||||
{
|
||||
PSYSTEM_PROCESSES new_p;
|
||||
PSYSTEM_PROCESS_INFORMATION new_p;
|
||||
|
||||
new_p = (PSYSTEM_PROCESSES)
|
||||
new_p = (PSYSTEM_PROCESS_INFORMATION)
|
||||
realloc (procs, szprocs += 200 * sizeof (*procs));
|
||||
if (!new_p)
|
||||
{
|
||||
@@ -1292,30 +1293,30 @@ winpids::enum_processes (bool winpid)
|
||||
}
|
||||
else
|
||||
{
|
||||
system_printf ("error %p reading system process information",
|
||||
system_printf ("error %y reading system process information",
|
||||
status);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
PSYSTEM_PROCESSES px = procs;
|
||||
PSYSTEM_PROCESS_INFORMATION px = procs;
|
||||
for (;;)
|
||||
{
|
||||
if (px->ProcessId)
|
||||
if (px->UniqueProcessId)
|
||||
{
|
||||
bool do_add = true;
|
||||
for (unsigned i = 0; i < cygwin_pid_nelem; ++i)
|
||||
if (pidlist[i] == px->ProcessId)
|
||||
if (pidlist[i] == (uintptr_t) px->UniqueProcessId)
|
||||
{
|
||||
do_add = false;
|
||||
break;
|
||||
}
|
||||
if (do_add)
|
||||
add (nelem, true, px->ProcessId);
|
||||
add (nelem, true, (DWORD) (uintptr_t) px->UniqueProcessId);
|
||||
}
|
||||
if (!px->NextEntryDelta)
|
||||
if (!px->NextEntryOffset)
|
||||
break;
|
||||
px = (PSYSTEM_PROCESSES) ((char *) px + px->NextEntryDelta);
|
||||
px = (PSYSTEM_PROCESS_INFORMATION) ((char *) px + px->NextEntryOffset);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user