diff options
author | Eli Zaretskii <eliz@gnu.org> | 2010-07-09 11:10:04 +0000 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2010-07-09 11:10:04 +0000 |
commit | 4e4d8f246f82d492fb71bc599813016ef97be397 (patch) | |
tree | cc083fe16c68e8634a8d8b7054a5b34253993a55 /job.c | |
parent | 8a0f9d7b429b32b106d8f46d32c8d5213683fbda (diff) | |
download | gunmake-4e4d8f246f82d492fb71bc599813016ef97be397.tar.gz |
job.c (pid2str) [WINDOWS32]: Don't use %Id with GCC < 4.x.
(exec_command) [WINDOWS32]: Use pid2str instead of non-portable
%Id.
main.c (handle_runtime_exceptions): Use %p to print addresses,
to DTRT on both 32-bit and 64-bit hosts. Savannah bug #27809.
job.c (w32_kill, start_job_command, create_batch_file): Use
pid_t for process IDs and intptr_t for the 1st arg of
_open_osfhandle.
function.c (windows32_openpipe): Use pid_t for process IDs and
intptr_t for the 1st arg of _open_osfhandle.
(func_shell): Use pid_t for process IDs.
main.c (main) [WINDOWS32]: Pacify the compiler.
config.h.W32.template (pid_t): Add a definition for 64-bit
Windows builds that don't use GCC.
Savannah bug #27809. Patch by Ozkan Sezer <sezeroz@gmail.com>
Diffstat (limited to 'job.c')
-rw-r--r-- | job.c | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -192,7 +192,7 @@ static const char * pid2str (pid_t pid) { static char pidstring[100]; -#ifdef WINDOWS32 +#if defined(WINDOWS32) && __GNUC__ > 3 sprintf (pidstring, "%Id", pid); #else sprintf (pidstring, "%lu", (unsigned long) pid); @@ -247,7 +247,7 @@ unsigned int jobserver_tokens = 0; * The macro which references this function is defined in make.h. */ int -w32_kill(int pid, int sig) +w32_kill(pid_t pid, int sig) { return ((process_kill((HANDLE)pid, sig) == TRUE) ? 0 : -1); } @@ -315,7 +315,7 @@ create_batch_file (char const *base, int unixy, int *fd) const unsigned final_size = path_size + size + 1; char *const path = xmalloc (final_size); memcpy (path, temp_path, final_size); - *fd = _open_osfhandle ((long)h, 0); + *fd = _open_osfhandle ((intptr_t)h, 0); if (unixy) { char *p; @@ -1393,7 +1393,7 @@ start_job_command (struct child *child) hPID = process_easy(argv, child->environment); if (hPID != INVALID_HANDLE_VALUE) - child->pid = (int) hPID; + child->pid = (pid_t) hPID; else { int i; unblock_sigs(); @@ -2068,9 +2068,14 @@ exec_command (char **argv, char **envp) if (hWaitPID == hPID) break; else + { + char *pidstr = xstrdup (pid2str ((DWORD_PTR)hWaitPID)); + fprintf(stderr, - _("make reaped child pid %Iu, still waiting for pid %Iu\n"), - (DWORD_PTR)hWaitPID, (DWORD_PTR)hPID); + _("make reaped child pid %s, still waiting for pid %s\n"), + pidstr, pid2str ((DWORD_PTR)hPID)); + free (pidstr); + } } /* return child's exit code as our exit code */ |