From: Kai Tietz Date: Mon, 13 Apr 2009 10:48:27 +0000 (+0000) Subject: Merged from gcc head revision 146001. X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=587c6b96efe8a88472fb2f24f09d0e93d60e2242;p=deliverable%2Fbinutils-gdb.git Merged from gcc head revision 146001. 2009-04-13 Ozkan Sezer PR target/39397 * pex-common.h (struct pex_obj): Store pid values as pid_t, not as long (members *children and (*wait)) * pex-common.c (pex_run_in_environment): Likewise. * pex-win32.c (pex_win32_wait): Return pid_t and properly check returned pid value. * pex-djgpp.c (pex_djgpp_wait): Return pid_t. * pex-msdos.c (pex_msdos_wait): Likewise. --- diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 2e0a27c66a..c58f635514 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,14 @@ +2009-04-13 Ozkan Sezer + + PR target/39397 + * pex-common.h (struct pex_obj): Store pid values as pid_t, + not as long (members *children and (*wait)) + * pex-common.c (pex_run_in_environment): Likewise. + * pex-win32.c (pex_win32_wait): Return pid_t and properly check + returned pid value. + * pex-djgpp.c (pex_djgpp_wait): Return pid_t. + * pex-msdos.c (pex_msdos_wait): Likewise. + 2009-04-07 Arnaud Patard * libiberty/configure.ac: Fix Linux/MIPS matching rule. diff --git a/libiberty/pex-common.c b/libiberty/pex-common.c index 7f355365ed..9a9fe24195 100644 --- a/libiberty/pex-common.c +++ b/libiberty/pex-common.c @@ -160,7 +160,7 @@ pex_run_in_environment (struct pex_obj *obj, int flags, const char *executable, int outname_allocated; int p[2]; int toclose; - long pid; + pid_t pid; in = -1; out = -1; @@ -345,7 +345,7 @@ pex_run_in_environment (struct pex_obj *obj, int flags, const char *executable, goto error_exit; ++obj->count; - obj->children = XRESIZEVEC (long, obj->children, obj->count); + obj->children = XRESIZEVEC (pid_t, obj->children, obj->count); obj->children[obj->count - 1] = pid; return NULL; diff --git a/libiberty/pex-common.h b/libiberty/pex-common.h index 5b7bfcc03e..af338e6a34 100644 --- a/libiberty/pex-common.h +++ b/libiberty/pex-common.h @@ -70,7 +70,7 @@ struct pex_obj /* Number of child processes. */ int count; /* PIDs of child processes; array allocated using malloc. */ - long *children; + pid_t *children; /* Exit statuses of child processes; array allocated using malloc. */ int *status; /* Time used by child processes; array allocated using malloc. */ @@ -126,7 +126,7 @@ struct pex_funcs and time in *TIME (if it is not null). CHILD is from fork. DONE is 1 if this is called via pex_free. ERRMSG and ERR are as in fork. Return 0 on success, -1 on error. */ - int (*wait) (struct pex_obj *, pid_t /* child */, int * /* status */, + pid_t (*wait) (struct pex_obj *, pid_t /* child */, int * /* status */, struct pex_time * /* time */, int /* done */, const char ** /* errmsg */, int * /* err */); /* Create a pipe (only called if PEX_USE_PIPES is set) storing two diff --git a/libiberty/pex-djgpp.c b/libiberty/pex-djgpp.c index bd279380da..0721139954 100644 --- a/libiberty/pex-djgpp.c +++ b/libiberty/pex-djgpp.c @@ -49,7 +49,7 @@ static pid_t pex_djgpp_exec_child (struct pex_obj *, int, const char *, int, int, int, int, const char **, int *); static int pex_djgpp_close (struct pex_obj *, int); -static int pex_djgpp_wait (struct pex_obj *, pid_t, int *, struct pex_time *, +static pid_t pex_djgpp_wait (struct pex_obj *, pid_t, int *, struct pex_time *, int, const char **, int *); /* The list of functions we pass to the common routines. */ @@ -276,7 +276,7 @@ pex_djgpp_exec_child (struct pex_obj *obj, int flags, const char *executable, has already completed, and we just need to return the exit status. */ -static int +static pid_t pex_djgpp_wait (struct pex_obj *obj, pid_t pid, int *status, struct pex_time *time, int done ATTRIBUTE_UNUSED, const char **errmsg ATTRIBUTE_UNUSED, diff --git a/libiberty/pex-msdos.c b/libiberty/pex-msdos.c index ab4d736429..4b77bf655f 100644 --- a/libiberty/pex-msdos.c +++ b/libiberty/pex-msdos.c @@ -59,7 +59,7 @@ static pid_t pex_msdos_exec_child (struct pex_obj *, int, const char *, int, int, int, int, int, const char **, int *); static int pex_msdos_close (struct pex_obj *, int); -static int pex_msdos_wait (struct pex_obj *, pid_t, int *, struct pex_time *, +static pid_t pex_msdos_wait (struct pex_obj *, pid_t, int *, struct pex_time *, int, const char **, int *); static void pex_msdos_cleanup (struct pex_obj *); @@ -282,7 +282,7 @@ pex_msdos_exec_child (struct pex_obj *obj, int flags, const char *executable, has already completed, and we just need to return the exit status. */ -static int +static pid_t pex_msdos_wait (struct pex_obj *obj, pid_t pid, int *status, struct pex_time *time, int done ATTRIBUTE_UNUSED, const char **errmsg ATTRIBUTE_UNUSED, diff --git a/libiberty/pex-win32.c b/libiberty/pex-win32.c index 5897866347..3f37751936 100644 --- a/libiberty/pex-win32.c +++ b/libiberty/pex-win32.c @@ -84,7 +84,7 @@ static pid_t pex_win32_exec_child (struct pex_obj *, int, const char *, int, int, int, int, const char **, int *); static int pex_win32_close (struct pex_obj *, int); -static int pex_win32_wait (struct pex_obj *, pid_t, int *, +static pid_t pex_win32_wait (struct pex_obj *, pid_t, int *, struct pex_time *, int, const char **, int *); static int pex_win32_pipe (struct pex_obj *, int *, int); static FILE *pex_win32_fdopenr (struct pex_obj *, int, int); @@ -705,7 +705,7 @@ spawn_script (const char *executable, char *const *argv, dwCreationFlags, si, pi); if (executable1 != newex) free ((char *) newex); - if ((long) pid < 0) + if (pid == (pid_t) -1) { newex = msys_rootify (executable1); if (newex != executable1) @@ -722,7 +722,7 @@ spawn_script (const char *executable, char *const *argv, } } } - if ((long) pid < 0) + if (pid == (pid_t) -1) errno = save_errno; return pid; } @@ -840,7 +840,7 @@ pex_win32_exec_child (struct pex_obj *obj ATTRIBUTE_UNUSED, int flags, status == 3. We fix the status code to conform to the usual WIF* macros. Note that WIFSIGNALED will never be true under CRTDLL. */ -static int +static pid_t pex_win32_wait (struct pex_obj *obj ATTRIBUTE_UNUSED, pid_t pid, int *status, struct pex_time *time, int done ATTRIBUTE_UNUSED, const char **errmsg, int *err)