Merged from gcc head revision 146001.

2009-04-13  Ozkan Sezer  <sezeroz@gmail.com>

        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.
This commit is contained in:
Kai Tietz 2009-04-13 10:48:27 +00:00
parent 2e80c30680
commit 587c6b96ef
6 changed files with 23 additions and 12 deletions

View File

@ -1,3 +1,14 @@
2009-04-13 Ozkan Sezer <sezeroz@gmail.com>
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 <apatard@mandriva.com> 2009-04-07 Arnaud Patard <apatard@mandriva.com>
* libiberty/configure.ac: Fix Linux/MIPS matching rule. * libiberty/configure.ac: Fix Linux/MIPS matching rule.

View File

@ -160,7 +160,7 @@ pex_run_in_environment (struct pex_obj *obj, int flags, const char *executable,
int outname_allocated; int outname_allocated;
int p[2]; int p[2];
int toclose; int toclose;
long pid; pid_t pid;
in = -1; in = -1;
out = -1; out = -1;
@ -345,7 +345,7 @@ pex_run_in_environment (struct pex_obj *obj, int flags, const char *executable,
goto error_exit; goto error_exit;
++obj->count; ++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; obj->children[obj->count - 1] = pid;
return NULL; return NULL;

View File

@ -70,7 +70,7 @@ struct pex_obj
/* Number of child processes. */ /* Number of child processes. */
int count; int count;
/* PIDs of child processes; array allocated using malloc. */ /* PIDs of child processes; array allocated using malloc. */
long *children; pid_t *children;
/* Exit statuses of child processes; array allocated using malloc. */ /* Exit statuses of child processes; array allocated using malloc. */
int *status; int *status;
/* Time used by child processes; array allocated using malloc. */ /* 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 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 is 1 if this is called via pex_free. ERRMSG and ERR are as in
fork. Return 0 on success, -1 on error. */ 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 */, struct pex_time * /* time */, int /* done */,
const char ** /* errmsg */, int * /* err */); const char ** /* errmsg */, int * /* err */);
/* Create a pipe (only called if PEX_USE_PIPES is set) storing two /* Create a pipe (only called if PEX_USE_PIPES is set) storing two

View File

@ -49,7 +49,7 @@ static pid_t pex_djgpp_exec_child (struct pex_obj *, int, const char *,
int, int, int, int, int, int, int, int,
const char **, int *); const char **, int *);
static int pex_djgpp_close (struct pex_obj *, 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 *); int, const char **, int *);
/* The list of functions we pass to the common routines. */ /* 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 has already completed, and we just need to return the exit
status. */ status. */
static int static pid_t
pex_djgpp_wait (struct pex_obj *obj, pid_t pid, int *status, pex_djgpp_wait (struct pex_obj *obj, pid_t pid, int *status,
struct pex_time *time, int done ATTRIBUTE_UNUSED, struct pex_time *time, int done ATTRIBUTE_UNUSED,
const char **errmsg ATTRIBUTE_UNUSED, const char **errmsg ATTRIBUTE_UNUSED,

View File

@ -59,7 +59,7 @@ static pid_t pex_msdos_exec_child (struct pex_obj *, int, const char *,
int, int, int, int, int, int, int, int,
int, const char **, int *); int, const char **, int *);
static int pex_msdos_close (struct pex_obj *, 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 *); int, const char **, int *);
static void pex_msdos_cleanup (struct pex_obj *); 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 has already completed, and we just need to return the exit
status. */ status. */
static int static pid_t
pex_msdos_wait (struct pex_obj *obj, pid_t pid, int *status, pex_msdos_wait (struct pex_obj *obj, pid_t pid, int *status,
struct pex_time *time, int done ATTRIBUTE_UNUSED, struct pex_time *time, int done ATTRIBUTE_UNUSED,
const char **errmsg ATTRIBUTE_UNUSED, const char **errmsg ATTRIBUTE_UNUSED,

View File

@ -84,7 +84,7 @@ static pid_t pex_win32_exec_child (struct pex_obj *, int, const char *,
int, int, int, int, int, int, int, int,
const char **, int *); const char **, int *);
static int pex_win32_close (struct pex_obj *, 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 *); struct pex_time *, int, const char **, int *);
static int pex_win32_pipe (struct pex_obj *, int *, int); static int pex_win32_pipe (struct pex_obj *, int *, int);
static FILE *pex_win32_fdopenr (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); dwCreationFlags, si, pi);
if (executable1 != newex) if (executable1 != newex)
free ((char *) newex); free ((char *) newex);
if ((long) pid < 0) if (pid == (pid_t) -1)
{ {
newex = msys_rootify (executable1); newex = msys_rootify (executable1);
if (newex != 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; errno = save_errno;
return pid; 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* status == 3. We fix the status code to conform to the usual WIF*
macros. Note that WIFSIGNALED will never be true under CRTDLL. */ 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, pex_win32_wait (struct pex_obj *obj ATTRIBUTE_UNUSED, pid_t pid,
int *status, struct pex_time *time, int done ATTRIBUTE_UNUSED, int *status, struct pex_time *time, int done ATTRIBUTE_UNUSED,
const char **errmsg, int *err) const char **errmsg, int *err)