mirror of
https://github.com/mirror/make.git
synced 2025-02-04 08:40:27 +08:00
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>
This commit is contained in:
parent
8a0f9d7b42
commit
4e4d8f246f
20
ChangeLog
20
ChangeLog
@ -1,3 +1,23 @@
|
|||||||
|
2010-07-09 Eli Zaretskii <eliz@gnu.org>
|
||||||
|
|
||||||
|
* 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>
|
||||||
|
|
||||||
2010-07-06 Paul Smith <psmith@gnu.org>
|
2010-07-06 Paul Smith <psmith@gnu.org>
|
||||||
|
|
||||||
* main.c (main): Set a default value of "-c" for .SHELLFLAGS.
|
* main.c (main): Set a default value of "-c" for .SHELLFLAGS.
|
||||||
|
12
function.c
12
function.c
@ -1434,7 +1434,7 @@ int shell_function_pid = 0, shell_function_completed;
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
windows32_openpipe (int *pipedes, int *pid_p, char **command_argv, char **envp)
|
windows32_openpipe (int *pipedes, pid_t *pid_p, char **command_argv, char **envp)
|
||||||
{
|
{
|
||||||
SECURITY_ATTRIBUTES saAttr;
|
SECURITY_ATTRIBUTES saAttr;
|
||||||
HANDLE hIn;
|
HANDLE hIn;
|
||||||
@ -1489,13 +1489,13 @@ windows32_openpipe (int *pipedes, int *pid_p, char **command_argv, char **envp)
|
|||||||
process_register(hProcess);
|
process_register(hProcess);
|
||||||
|
|
||||||
/* set the pid for returning to caller */
|
/* set the pid for returning to caller */
|
||||||
*pid_p = (int) hProcess;
|
*pid_p = (pid_t) hProcess;
|
||||||
|
|
||||||
/* set up to read data from child */
|
/* set up to read data from child */
|
||||||
pipedes[0] = _open_osfhandle((long) hChildOutRd, O_RDONLY);
|
pipedes[0] = _open_osfhandle((intptr_t) hChildOutRd, O_RDONLY);
|
||||||
|
|
||||||
/* this will be closed almost right away */
|
/* this will be closed almost right away */
|
||||||
pipedes[1] = _open_osfhandle((long) hChildOutWr, O_APPEND);
|
pipedes[1] = _open_osfhandle((intptr_t) hChildOutWr, O_APPEND);
|
||||||
} else {
|
} else {
|
||||||
/* reap/cleanup the failed process */
|
/* reap/cleanup the failed process */
|
||||||
process_cleanup(hProcess);
|
process_cleanup(hProcess);
|
||||||
@ -1510,7 +1510,7 @@ windows32_openpipe (int *pipedes, int *pid_p, char **command_argv, char **envp)
|
|||||||
|
|
||||||
/* set status for return */
|
/* set status for return */
|
||||||
pipedes[0] = pipedes[1] = -1;
|
pipedes[0] = pipedes[1] = -1;
|
||||||
*pid_p = -1;
|
*pid_p = (pid_t)-1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1594,7 +1594,7 @@ func_shell (char *o, char **argv, const char *funcname UNUSED)
|
|||||||
const char *error_prefix;
|
const char *error_prefix;
|
||||||
char **envp;
|
char **envp;
|
||||||
int pipedes[2];
|
int pipedes[2];
|
||||||
int pid;
|
pid_t pid;
|
||||||
|
|
||||||
#ifndef __MSDOS__
|
#ifndef __MSDOS__
|
||||||
/* Construct the argument list. */
|
/* Construct the argument list. */
|
||||||
|
17
job.c
17
job.c
@ -192,7 +192,7 @@ static const char *
|
|||||||
pid2str (pid_t pid)
|
pid2str (pid_t pid)
|
||||||
{
|
{
|
||||||
static char pidstring[100];
|
static char pidstring[100];
|
||||||
#ifdef WINDOWS32
|
#if defined(WINDOWS32) && __GNUC__ > 3
|
||||||
sprintf (pidstring, "%Id", pid);
|
sprintf (pidstring, "%Id", pid);
|
||||||
#else
|
#else
|
||||||
sprintf (pidstring, "%lu", (unsigned long) pid);
|
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.
|
* The macro which references this function is defined in make.h.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
w32_kill(int pid, int sig)
|
w32_kill(pid_t pid, int sig)
|
||||||
{
|
{
|
||||||
return ((process_kill((HANDLE)pid, sig) == TRUE) ? 0 : -1);
|
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;
|
const unsigned final_size = path_size + size + 1;
|
||||||
char *const path = xmalloc (final_size);
|
char *const path = xmalloc (final_size);
|
||||||
memcpy (path, temp_path, final_size);
|
memcpy (path, temp_path, final_size);
|
||||||
*fd = _open_osfhandle ((long)h, 0);
|
*fd = _open_osfhandle ((intptr_t)h, 0);
|
||||||
if (unixy)
|
if (unixy)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
@ -1393,7 +1393,7 @@ start_job_command (struct child *child)
|
|||||||
hPID = process_easy(argv, child->environment);
|
hPID = process_easy(argv, child->environment);
|
||||||
|
|
||||||
if (hPID != INVALID_HANDLE_VALUE)
|
if (hPID != INVALID_HANDLE_VALUE)
|
||||||
child->pid = (int) hPID;
|
child->pid = (pid_t) hPID;
|
||||||
else {
|
else {
|
||||||
int i;
|
int i;
|
||||||
unblock_sigs();
|
unblock_sigs();
|
||||||
@ -2068,9 +2068,14 @@ exec_command (char **argv, char **envp)
|
|||||||
if (hWaitPID == hPID)
|
if (hWaitPID == hPID)
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
char *pidstr = xstrdup (pid2str ((DWORD_PTR)hWaitPID));
|
||||||
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
_("make reaped child pid %Iu, still waiting for pid %Iu\n"),
|
_("make reaped child pid %s, still waiting for pid %s\n"),
|
||||||
(DWORD_PTR)hWaitPID, (DWORD_PTR)hPID);
|
pidstr, pid2str ((DWORD_PTR)hPID));
|
||||||
|
free (pidstr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return child's exit code as our exit code */
|
/* return child's exit code as our exit code */
|
||||||
|
22
main.c
22
main.c
@ -681,24 +681,24 @@ handle_runtime_exceptions( struct _EXCEPTION_POINTERS *exinfo )
|
|||||||
if (! ISDB (DB_VERBOSE))
|
if (! ISDB (DB_VERBOSE))
|
||||||
{
|
{
|
||||||
sprintf(errmsg,
|
sprintf(errmsg,
|
||||||
_("%s: Interrupt/Exception caught (code = 0x%lx, addr = 0x%lx)\n"),
|
_("%s: Interrupt/Exception caught (code = 0x%lx, addr = 0x%p)\n"),
|
||||||
prg, exrec->ExceptionCode, (DWORD)exrec->ExceptionAddress);
|
prg, exrec->ExceptionCode, exrec->ExceptionAddress);
|
||||||
fprintf(stderr, errmsg);
|
fprintf(stderr, errmsg);
|
||||||
exit(255);
|
exit(255);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(errmsg,
|
sprintf(errmsg,
|
||||||
_("\nUnhandled exception filter called from program %s\nExceptionCode = %lx\nExceptionFlags = %lx\nExceptionAddress = %lx\n"),
|
_("\nUnhandled exception filter called from program %s\nExceptionCode = %lx\nExceptionFlags = %lx\nExceptionAddress = 0x%p\n"),
|
||||||
prg, exrec->ExceptionCode, exrec->ExceptionFlags,
|
prg, exrec->ExceptionCode, exrec->ExceptionFlags,
|
||||||
(DWORD)exrec->ExceptionAddress);
|
exrec->ExceptionAddress);
|
||||||
|
|
||||||
if (exrec->ExceptionCode == EXCEPTION_ACCESS_VIOLATION
|
if (exrec->ExceptionCode == EXCEPTION_ACCESS_VIOLATION
|
||||||
&& exrec->NumberParameters >= 2)
|
&& exrec->NumberParameters >= 2)
|
||||||
sprintf(&errmsg[strlen(errmsg)],
|
sprintf(&errmsg[strlen(errmsg)],
|
||||||
(exrec->ExceptionInformation[0]
|
(exrec->ExceptionInformation[0]
|
||||||
? _("Access violation: write operation at address %lx\n")
|
? _("Access violation: write operation at address 0x%p\n")
|
||||||
: _("Access violation: read operation at address %lx\n")),
|
: _("Access violation: read operation at address 0x%p\n")),
|
||||||
exrec->ExceptionInformation[1]);
|
(PVOID)exrec->ExceptionInformation[1]);
|
||||||
|
|
||||||
/* turn this on if we want to put stuff in the event log too */
|
/* turn this on if we want to put stuff in the event log too */
|
||||||
#ifdef USE_EVENT_LOG
|
#ifdef USE_EVENT_LOG
|
||||||
@ -967,8 +967,10 @@ main (int argc, char **argv, char **envp)
|
|||||||
|
|
||||||
/* Set up gettext/internationalization support. */
|
/* Set up gettext/internationalization support. */
|
||||||
setlocale (LC_ALL, "");
|
setlocale (LC_ALL, "");
|
||||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
/* The cast to void shuts up compiler warnings on systems that
|
||||||
textdomain (PACKAGE);
|
disable NLS. */
|
||||||
|
(void)bindtextdomain (PACKAGE, LOCALEDIR);
|
||||||
|
(void)textdomain (PACKAGE);
|
||||||
|
|
||||||
#ifdef POSIX
|
#ifdef POSIX
|
||||||
sigemptyset (&fatal_signal_set);
|
sigemptyset (&fatal_signal_set);
|
||||||
@ -1400,7 +1402,7 @@ main (int argc, char **argv, char **envp)
|
|||||||
/* WINDOWS32 chdir() doesn't work if the directory has a trailing '/'
|
/* WINDOWS32 chdir() doesn't work if the directory has a trailing '/'
|
||||||
But allow -C/ just in case someone wants that. */
|
But allow -C/ just in case someone wants that. */
|
||||||
{
|
{
|
||||||
char *p = dir + strlen (dir) - 1;
|
char *p = (char *)dir + strlen (dir) - 1;
|
||||||
while (p > dir && (p[0] == '/' || p[0] == '\\'))
|
while (p > dir && (p[0] == '/' || p[0] == '\\'))
|
||||||
--p;
|
--p;
|
||||||
p[1] = '\0';
|
p[1] = '\0';
|
||||||
|
Loading…
Reference in New Issue
Block a user