* patch: libiberty pex for _WIN64
@ 2007-08-03 15:32 Kai Tietz
2007-08-03 16:02 ` Ian Lance Taylor
2007-08-03 23:16 ` Christopher Faylor
0 siblings, 2 replies; 8+ messages in thread
From: Kai Tietz @ 2007-08-03 15:32 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: gcc-patches, gdb-patches, binutils
[-- Attachment #1: Type: text/plain, Size: 1441 bytes --]
Ian,
Sorry, I missed to attach the patch 8)
I prepared a patch for pex using pid_t instead of the type 'long' for
system handles. This is necessary for _WIN64, because the long type isn't
wide enougth to hold a pointer for this ABI The type pid_t is always
defined by the configure in config.h if not defined by the header-set.
Therefore it seems to be the best way to make this run.
ChangeLog:
2007-08-03 Kai Tietz <kai.tietz@onevision.com>
* pex-common.h: (pex_funcs): Retyped wait and exec_child to pid_t.
* pex-djgpp.c: Likewise.
* pex-msdos.c: Likewise.
* pex-unix.c: Likewise.
* pex-win32.c: Likewise.
Cheers,
i.A. Kai Tietz
| (\_/) This is Bunny. Copy and paste Bunny
| (='.'=) into your signature to help him gain
| (")_(") world domination.
------------------------------------------------------------------------------------------
OneVision Software Entwicklungs GmbH & Co. KG
Dr.-Leo-Ritter-Straße 9 - 93049 Regensburg
Tel: +49.(0)941.78004.0 - Fax: +49.(0)941.78004.489 - www.OneVision.com
Commerzbank Regensburg - BLZ 750 400 62 - Konto 6011050
Handelsregister: HRA 6744, Amtsgericht Regensburg
Komplementärin: OneVision Software Entwicklungs Verwaltungs GmbH
Dr.-Leo-Ritter-Straße 9 – 93049 Regensburg
Handelsregister: HRB 8932, Amtsgericht Regensburg - Geschäftsführer:
Ulrike Döhler, Manuela Kluger
[-- Attachment #2: libi_pex.txt --]
[-- Type: text/plain, Size: 14737 bytes --]
Index: gcc/libiberty/pex-common.h
===================================================================
--- gcc.orig/libiberty/pex-common.h
+++ gcc/libiberty/pex-common.h
@@ -108,7 +108,7 @@ struct pex_funcs
closed in the child process. The function should handle the
PEX_STDERR_TO_STDOUT flag. Return >= 0 on success, or -1 on
error and set *ERRMSG and *ERR. */
- long (*exec_child) (struct pex_obj *, int /* flags */,
+ pid_t (*exec_child) (struct pex_obj *, int /* flags */,
const char */* executable */, char * const * /* argv */,
char * const * /* env */,
int /* in */, int /* out */, int /* errdes */,
@@ -120,7 +120,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 *, long /* child */, int * /* status */,
+ int (*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
Index: gcc/libiberty/pex-djgpp.c
===================================================================
--- gcc.orig/libiberty/pex-djgpp.c
+++ gcc/libiberty/pex-djgpp.c
@@ -44,12 +44,12 @@ extern int errno;
static int pex_djgpp_open_read (struct pex_obj *, const char *, int);
static int pex_djgpp_open_write (struct pex_obj *, const char *, int);
-static long pex_djgpp_exec_child (struct pex_obj *, int, const char *,
+static pid_t pex_djgpp_exec_child (struct pex_obj *, int, const char *,
char * const *, char * const *,
int, int, int, int,
const char **, int *);
static int pex_djgpp_close (struct pex_obj *, int);
-static int pex_djgpp_wait (struct pex_obj *, long, int *, struct pex_time *,
+static int 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. */
@@ -110,7 +110,7 @@ pex_djgpp_close (struct pex_obj *obj ATT
/* Execute a child. */
-static long
+static pid_t
pex_djgpp_exec_child (struct pex_obj *obj, int flags, const char *executable,
char * const * argv, char * const * env,
int in, int out, int errdes,
@@ -132,19 +132,19 @@ pex_djgpp_exec_child (struct pex_obj *ob
{
*err = errno;
*errmsg = "dup";
- return -1;
+ return (pid_t) -1;
}
if (dup2 (in, STDIN_FILE_NO) < 0)
{
*err = errno;
*errmsg = "dup2";
- return -1;
+ return (pid_t) -1;
}
if (close (in) < 0)
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
@@ -155,19 +155,19 @@ pex_djgpp_exec_child (struct pex_obj *ob
{
*err = errno;
*errmsg = "dup";
- return -1;
+ return (pid_t) -1;
}
if (dup2 (out, STDOUT_FILE_NO) < 0)
{
*err = errno;
*errmsg = "dup2";
- return -1;
+ return (pid_t) -1;
}
if (close (out) < 0)
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
@@ -179,14 +179,14 @@ pex_djgpp_exec_child (struct pex_obj *ob
{
*err = errno;
*errmsg = "dup";
- return -1;
+ return (pid_t) -1;
}
if (dup2 ((flags & PEX_STDERR_TO_STDOUT) != 0 ? STDOUT_FILE_NO : errdes,
STDERR_FILE_NO) < 0)
{
*err = errno;
*errmsg = "dup2";
- return -1;
+ return (pid_t) -1;
}
if (errdes != STDERR_FILE_NO)
{
@@ -194,7 +194,7 @@ pex_djgpp_exec_child (struct pex_obj *ob
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
}
@@ -218,13 +218,13 @@ pex_djgpp_exec_child (struct pex_obj *ob
{
*err = errno;
*errmsg = "dup2";
- return -1;
+ return (pid_t) -1;
}
if (close (org_in) < 0)
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
@@ -234,13 +234,13 @@ pex_djgpp_exec_child (struct pex_obj *ob
{
*err = errno;
*errmsg = "dup2";
- return -1;
+ return (pid_t) -1;
}
if (close (org_out) < 0)
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
@@ -251,13 +251,13 @@ pex_djgpp_exec_child (struct pex_obj *ob
{
*err = errno;
*errmsg = "dup2";
- return -1;
+ return (pid_t) -1;
}
if (close (org_errdes) < 0)
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
@@ -269,7 +269,7 @@ pex_djgpp_exec_child (struct pex_obj *ob
statuses[obj->count] = status;
obj->sysdep = (void *) statuses;
- return obj->count;
+ return (pid_t) obj->count;
}
/* Wait for a child process to complete. Actually the child process
@@ -277,7 +277,7 @@ pex_djgpp_exec_child (struct pex_obj *ob
status. */
static int
-pex_djgpp_wait (struct pex_obj *obj, long pid, int *status,
+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,
int *err ATTRIBUTE_UNUSED)
Index: gcc/libiberty/pex-msdos.c
===================================================================
--- gcc.orig/libiberty/pex-msdos.c
+++ gcc/libiberty/pex-msdos.c
@@ -54,12 +54,12 @@ struct pex_msdos
static int pex_msdos_open (struct pex_obj *, const char *, int);
static int pex_msdos_open (struct pex_obj *, const char *, int);
static int pex_msdos_fdindex (struct pex_msdos *, int);
-static long pex_msdos_exec_child (struct pex_obj *, int, const char *,
+static pid_t pex_msdos_exec_child (struct pex_obj *, int, const char *,
char * const *, char * const *,
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 *, long, int *, struct pex_time *,
+static int pex_msdos_wait (struct pex_obj *, pid_t, int *, struct pex_time *,
int, const char **, int *);
static void pex_msdos_cleanup (struct pex_obj *);
@@ -152,7 +152,7 @@ pex_msdos_close (struct pex_obj *obj, in
/* Execute a child. */
-static long
+static pid_t
pex_msdos_exec_child (struct pex_obj *obj, int flags, const char *executable,
char * const * argv, char * const * env, int in, int out,
int toclose ATTRIBUTE_UNUSED,
@@ -235,7 +235,7 @@ pex_msdos_exec_child (struct pex_obj *ob
free (scmd);
free (rf);
*errmsg = "cannot open temporary command file";
- return -1;
+ return (pid_t) -1;
}
for (i = 1; argv[i] != NULL; ++i)
@@ -262,7 +262,7 @@ pex_msdos_exec_child (struct pex_obj *ob
free (scmd);
free (rf);
*errmsg = "system";
- return -1;
+ return (pid_t) -1;
}
remove (rf);
@@ -275,7 +275,7 @@ pex_msdos_exec_child (struct pex_obj *ob
ms->statuses = XRESIZEVEC(int, ms->statuses, obj->count + 1);
ms->statuses[obj->count] = status;
- return obj->count;
+ return (pid_t) obj->count;
}
/* Wait for a child process to complete. Actually the child process
@@ -283,7 +283,7 @@ pex_msdos_exec_child (struct pex_obj *ob
status. */
static int
-pex_msdos_wait (struct pex_obj *obj, long pid, int *status,
+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,
int *err ATTRIBUTE_UNUSED)
Index: gcc/libiberty/pex-unix.c
===================================================================
--- gcc.orig/libiberty/pex-unix.c
+++ gcc/libiberty/pex-unix.c
@@ -269,12 +269,12 @@ static void pex_child_error (struct pex_
ATTRIBUTE_NORETURN;
static int pex_unix_open_read (struct pex_obj *, const char *, int);
static int pex_unix_open_write (struct pex_obj *, const char *, int);
-static long pex_unix_exec_child (struct pex_obj *, int, const char *,
+static pid_t pex_unix_exec_child (struct pex_obj *, int, const char *,
char * const *, char * const *,
int, int, int, int,
const char **, int *);
static int pex_unix_close (struct pex_obj *, int);
-static int pex_unix_wait (struct pex_obj *, long, int *, struct pex_time *,
+static int pex_unix_wait (struct pex_obj *, pid_t, int *, struct pex_time *,
int, const char **, int *);
static int pex_unix_pipe (struct pex_obj *, int *, int);
static FILE *pex_unix_fdopenr (struct pex_obj *, int, int);
@@ -355,7 +355,7 @@ pex_child_error (struct pex_obj *obj, co
extern char **environ;
-static long
+static pid_t
pex_unix_exec_child (struct pex_obj *obj, int flags, const char *executable,
char * const * argv, char * const * env,
int in, int out, int errdes,
@@ -384,7 +384,7 @@ pex_unix_exec_child (struct pex_obj *obj
case -1:
*err = errno;
*errmsg = VFORK_STRING;
- return -1;
+ return (pid_t) -1;
case 0:
/* Child process. */
@@ -435,7 +435,7 @@ pex_unix_exec_child (struct pex_obj *obj
}
/* NOTREACHED */
- return -1;
+ return (pid_t) -1;
default:
/* Parent process. */
@@ -445,7 +445,7 @@ pex_unix_exec_child (struct pex_obj *obj
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
if (out != STDOUT_FILE_NO)
@@ -454,7 +454,7 @@ pex_unix_exec_child (struct pex_obj *obj
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
if (errdes != STDERR_FILE_NO)
@@ -463,18 +463,18 @@ pex_unix_exec_child (struct pex_obj *obj
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
- return (long) pid;
+ return pid;
}
}
/* Wait for a child process to complete. */
static int
-pex_unix_wait (struct pex_obj *obj, long pid, int *status,
+pex_unix_wait (struct pex_obj *obj, pid_t pid, int *status,
struct pex_time *time, int done, const char **errmsg,
int *err)
{
Index: gcc/libiberty/pex-win32.c
===================================================================
--- gcc.orig/libiberty/pex-win32.c
+++ gcc/libiberty/pex-win32.c
@@ -79,12 +79,12 @@ backslashify (char *s)
static int pex_win32_open_read (struct pex_obj *, const char *, int);
static int pex_win32_open_write (struct pex_obj *, const char *, int);
-static long pex_win32_exec_child (struct pex_obj *, int, const char *,
+static pid_t pex_win32_exec_child (struct pex_obj *, int, const char *,
char * const *, char * const *,
int, int, int, int,
const char **, int *);
static int pex_win32_close (struct pex_obj *, int);
-static int pex_win32_wait (struct pex_obj *, long, int *,
+static int 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);
@@ -522,7 +522,7 @@ env_compare (const void *a_ptr, const vo
return c1 - c2;
}
-static long
+static pid_t
win32_spawn (const char *executable,
BOOL search,
char *const *argv,
@@ -597,7 +597,7 @@ win32_spawn (const char *executable,
free (full_executable);
- return -1;
+ return (pid_t) -1;
}
/* Clean up. */
@@ -606,7 +606,7 @@ win32_spawn (const char *executable,
if (env_block)
free (env_block);
- return (long) pi->hProcess;
+ return (pid_t) pi->hProcess;
error:
if (env_block)
@@ -616,17 +616,17 @@ win32_spawn (const char *executable,
if (full_executable)
free (full_executable);
- return -1;
+ return (pid_t) -1;
}
-static long
+static pid_t
spawn_script (const char *executable, char *const *argv,
char* const *env,
DWORD dwCreationFlags,
LPSTARTUPINFO si,
LPPROCESS_INFORMATION pi)
{
- int pid = -1;
+ pid_t pid = (pid_t) -1;
int save_errno = errno;
int fd = _open (executable, _O_RDONLY);
@@ -673,7 +673,7 @@ spawn_script (const char *executable, ch
dwCreationFlags, si, pi);
if (executable1 != newex)
free ((char *) newex);
- if (pid < 0)
+ if ((long) pid < 0)
{
newex = msys_rootify (executable1);
if (newex != executable1)
@@ -689,14 +689,14 @@ spawn_script (const char *executable, ch
}
}
}
- if (pid < 0)
+ if ((long) pid < 0)
errno = save_errno;
return pid;
}
/* Execute a child. */
-static long
+static pid_t
pex_win32_exec_child (struct pex_obj *obj ATTRIBUTE_UNUSED, int flags,
const char *executable, char * const * argv,
char* const* env,
@@ -705,7 +705,7 @@ pex_win32_exec_child (struct pex_obj *ob
const char **errmsg,
int *err)
{
- long pid;
+ pid_t pid;
HANDLE stdin_handle;
HANDLE stdout_handle;
HANDLE stderr_handle;
@@ -780,10 +780,10 @@ pex_win32_exec_child (struct pex_obj *ob
/* Create the child process. */
pid = win32_spawn (executable, (flags & PEX_SEARCH) != 0,
argv, env, dwCreationFlags, &si, &pi);
- if (pid == -1)
+ if (pid == (pid_t) -1)
pid = spawn_script (executable, argv, env, dwCreationFlags,
&si, &pi);
- if (pid == -1)
+ if (pid == (pid_t) -1)
{
*err = ENOENT;
*errmsg = "CreateProcess";
@@ -808,7 +808,7 @@ pex_win32_exec_child (struct pex_obj *ob
macros. Note that WIFSIGNALED will never be true under CRTDLL. */
static int
-pex_win32_wait (struct pex_obj *obj ATTRIBUTE_UNUSED, long pid,
+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)
{
@@ -883,7 +883,7 @@ main (int argc ATTRIBUTE_UNUSED, char **
char const *errmsg;
int err;
argv++;
- printf ("%ld\n", pex_win32_exec_child (NULL, PEX_SEARCH, argv[0], argv, NULL, 0, 0, 1, 2, &errmsg, &err));
+ printf ("%ld\n", (long) pex_win32_exec_child (NULL, PEX_SEARCH, argv[0], argv, NULL, 0, 0, 1, 2, &errmsg, &err));
exit (0);
}
#endif
=
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: patch: libiberty pex for _WIN64
2007-08-03 15:32 patch: libiberty pex for _WIN64 Kai Tietz
@ 2007-08-03 16:02 ` Ian Lance Taylor
2007-08-07 14:18 ` Kai Tietz
2007-08-03 23:16 ` Christopher Faylor
1 sibling, 1 reply; 8+ messages in thread
From: Ian Lance Taylor @ 2007-08-03 16:02 UTC (permalink / raw)
To: Kai Tietz; +Cc: gcc-patches, gdb-patches, binutils
Kai Tietz <Kai.Tietz@onevision.com> writes:
> 2007-08-03 Kai Tietz <kai.tietz@onevision.com>
>
> * pex-common.h: (pex_funcs): Retyped wait and exec_child to pid_t.
> * pex-djgpp.c: Likewise.
> * pex-msdos.c: Likewise.
> * pex-unix.c: Likewise.
> * pex-win32.c: Likewise.
This is OK if it passes bootstrap on a Unix or GNU/Linux system.
Thanks.
Ian
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: patch: libiberty pex for _WIN64
2007-08-03 15:32 patch: libiberty pex for _WIN64 Kai Tietz
2007-08-03 16:02 ` Ian Lance Taylor
@ 2007-08-03 23:16 ` Christopher Faylor
2007-08-04 8:44 ` Eli Zaretskii
1 sibling, 1 reply; 8+ messages in thread
From: Christopher Faylor @ 2007-08-03 23:16 UTC (permalink / raw)
To: Ian Lance Taylor, gdb-patches, binutils, gcc-patches, Kai Tietz
On Fri, Aug 03, 2007 at 05:31:39PM +0200, Kai Tietz wrote:
>Ian,
>
>Sorry, I missed to attach the patch 8)
>
>I prepared a patch for pex using pid_t instead of the type 'long' for
>system handles. This is necessary for _WIN64, because the long type isn't
>wide enougth to hold a pointer for this ABI The type pid_t is always
>defined by the configure in config.h if not defined by the header-set.
>Therefore it seems to be the best way to make this run.
>
>ChangeLog:
>
>2007-08-03 Kai Tietz <kai.tietz@onevision.com>
>
> * pex-common.h: (pex_funcs): Retyped wait and exec_child to pid_t.
> * pex-djgpp.c: Likewise.
> * pex-msdos.c: Likewise.
> * pex-unix.c: Likewise.
> * pex-win32.c: Likewise.
If long isn't long enough what is pid_t defined to be on _WIN64?
cgf
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: patch: libiberty pex for _WIN64
2007-08-03 23:16 ` Christopher Faylor
@ 2007-08-04 8:44 ` Eli Zaretskii
2007-08-04 16:35 ` Christopher Faylor
0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2007-08-04 8:44 UTC (permalink / raw)
To: Christopher Faylor; +Cc: iant, gdb-patches, binutils, gcc-patches, Kai.Tietz
> Date: Fri, 3 Aug 2007 19:16:42 -0400
> From: Christopher Faylor <cgf-use-the-mailinglist-please@sourceware.org>
>
> >2007-08-03 Kai Tietz <kai.tietz@onevision.com>
> >
> > * pex-common.h: (pex_funcs): Retyped wait and exec_child to pid_t.
> > * pex-djgpp.c: Likewise.
> > * pex-msdos.c: Likewise.
> > * pex-unix.c: Likewise.
> > * pex-win32.c: Likewise.
>
> If long isn't long enough what is pid_t defined to be on _WIN64?
I think it's "long long", as 64-bit Windows uses the P64 model.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: patch: libiberty pex for _WIN64
2007-08-04 8:44 ` Eli Zaretskii
@ 2007-08-04 16:35 ` Christopher Faylor
2007-08-06 7:07 ` Kai Tietz
0 siblings, 1 reply; 8+ messages in thread
From: Christopher Faylor @ 2007-08-04 16:35 UTC (permalink / raw)
To: iant, gdb-patches, binutils, Kai.Tietz, gcc-patches
On Sat, Aug 04, 2007 at 11:44:03AM +0300, Eli Zaretskii wrote:
>> Date: Fri, 3 Aug 2007 19:16:42 -0400
>> From: Christopher Faylor <cgf-use-the-mailinglist-please@sourceware.org>
>>
>> >2007-08-03 Kai Tietz <kai.tietz@onevision.com>
>> >
>> > * pex-common.h: (pex_funcs): Retyped wait and exec_child to pid_t.
>> > * pex-djgpp.c: Likewise.
>> > * pex-msdos.c: Likewise.
>> > * pex-unix.c: Likewise.
>> > * pex-win32.c: Likewise.
>>
>> If long isn't long enough what is pid_t defined to be on _WIN64?
>
>I think it's "long long", as 64-bit Windows uses the P64 model.
Yeah, duh. That was obvious. Sorry.
Where does the "typedef long long pid_t" come from? I only see it as
being defined as "int" in the mingw headers. And I didn't see any
machinery in configure to derive this.
I guess I'm asking if there is another patch coming down the line which
handles the long long.
cgf
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: patch: libiberty pex for _WIN64
2007-08-04 16:35 ` Christopher Faylor
@ 2007-08-06 7:07 ` Kai Tietz
0 siblings, 0 replies; 8+ messages in thread
From: Kai Tietz @ 2007-08-06 7:07 UTC (permalink / raw)
To: iant; +Cc: binutils, gcc-patches, gdb-patches
Hi Christopher,
> On Sat, Aug 04, 2007 at 11:44:03AM +0300, Eli Zaretskii wrote:
> >> Date: Fri, 3 Aug 2007 19:16:42 -0400
> >> From: Christopher Faylor
<cgf-use-the-mailinglist-please@sourceware.org>
> >>
> >> >2007-08-03 Kai Tietz <kai.tietz@onevision.com>
> >> >
> >> > * pex-common.h: (pex_funcs): Retyped wait and exec_childto
pid_t.
> >> > * pex-djgpp.c: Likewise.
> >> > * pex-msdos.c: Likewise.
> >> > * pex-unix.c: Likewise.
> >> > * pex-win32.c: Likewise.
> >>
> >> If long isn't long enough what is pid_t defined to be on _WIN64?
> >
> >I think it's "long long", as 64-bit Windows uses the P64 model.
>
> Yeah, duh. That was obvious. Sorry.
>
> Where does the "typedef long long pid_t" come from? I only see it as
> being defined as "int" in the mingw headers. And I didn't see any
> machinery in configure to derive this.
>
> I guess I'm asking if there is another patch coming down the line which
> handles the long long.
The _WIN64 headers are released under the Snapshot mingw-w64-headers (as
the new crt for this platform). The pid_t is defined there in sys/types.h.
I think that the headers may get merged with the 32-bit version, but I am
not quite certain about that. Therefore I try to open an repository on
sourceforge for them and let them run in parallel.
Cheers,
i.A. Kai Tietz
| (\_/) This is Bunny. Copy and paste Bunny
| (='.'=) into your signature to help him gain
| (")_(") world domination.
------------------------------------------------------------------------------------------
OneVision Software Entwicklungs GmbH & Co. KG
Dr.-Leo-Ritter-Straße 9 - 93049 Regensburg
Tel: +49.(0)941.78004.0 - Fax: +49.(0)941.78004.489 - www.OneVision.com
Commerzbank Regensburg - BLZ 750 400 62 - Konto 6011050
Handelsregister: HRA 6744, Amtsgericht Regensburg
Komplementärin: OneVision Software Entwicklungs Verwaltungs GmbH
Dr.-Leo-Ritter-Straße 9 – 93049 Regensburg
Handelsregister: HRB 8932, Amtsgericht Regensburg - Geschäftsführer:
Ulrike Döhler, Manuela Kluger
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: patch: libiberty pex for _WIN64
2007-08-03 16:02 ` Ian Lance Taylor
@ 2007-08-07 14:18 ` Kai Tietz
0 siblings, 0 replies; 8+ messages in thread
From: Kai Tietz @ 2007-08-07 14:18 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: binutils, gcc-patches, gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1421 bytes --]
Hi Ian,
> Kai Tietz <Kai.Tietz@onevision.com> writes:
>
> > 2007-08-03 Kai Tietz <kai.tietz@onevision.com>
> >
> > * pex-common.h: (pex_funcs): Retyped wait and exec_child to
pid_t.
> > * pex-djgpp.c: Likewise.
> > * pex-msdos.c: Likewise.
> > * pex-unix.c: Likewise.
> > * pex-win32.c: Likewise.
>
> This is OK if it passes bootstrap on a Unix or GNU/Linux system.
It passes bootstrap on cygwin, x86_64 mingw, and i386 linux.
There was an bug that if sys/types.h defines the pid_t it was not included
to define it. I added the include of it by using the config.h define
HAVE_SYS_TYPES_H.
Cheers,
i.A. Kai Tietz
| (\_/) This is Bunny. Copy and paste Bunny
| (='.'=) into your signature to help him gain
| (")_(") world domination.
------------------------------------------------------------------------------------------
OneVision Software Entwicklungs GmbH & Co. KG
Dr.-Leo-Ritter-Straße 9 - 93049 Regensburg
Tel: +49.(0)941.78004.0 - Fax: +49.(0)941.78004.489 - www.OneVision.com
Commerzbank Regensburg - BLZ 750 400 62 - Konto 6011050
Handelsregister: HRA 6744, Amtsgericht Regensburg
Komplementärin: OneVision Software Entwicklungs Verwaltungs GmbH
Dr.-Leo-Ritter-Straße 9 – 93049 Regensburg
Handelsregister: HRB 8932, Amtsgericht Regensburg - Geschäftsführer:
Ulrike Döhler, Manuela Kluger
[-- Attachment #2: libi_pex.txt --]
[-- Type: text/plain, Size: 15110 bytes --]
Index: gcc/libiberty/pex-common.h
===================================================================
--- gcc.orig/libiberty/pex-common.h
+++ gcc/libiberty/pex-common.h
@@ -26,6 +26,12 @@ Boston, MA 02110-1301, USA. */
#include "libiberty.h"
#include <stdio.h>
+/* pid_t is may defined by config.h or sys/types.h needs to be
+ included. */
+#if !defined(pid_t) && defined(HAVE_SYS_TYPES_H)
+#include <sys/types.h>
+#endif
+
#define install_error_msg "installation problem, cannot exec `%s'"
/* stdin file number. */
@@ -108,7 +114,7 @@ struct pex_funcs
closed in the child process. The function should handle the
PEX_STDERR_TO_STDOUT flag. Return >= 0 on success, or -1 on
error and set *ERRMSG and *ERR. */
- long (*exec_child) (struct pex_obj *, int /* flags */,
+ pid_t (*exec_child) (struct pex_obj *, int /* flags */,
const char */* executable */, char * const * /* argv */,
char * const * /* env */,
int /* in */, int /* out */, int /* errdes */,
@@ -120,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 *, long /* child */, int * /* status */,
+ int (*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
Index: gcc/libiberty/pex-djgpp.c
===================================================================
--- gcc.orig/libiberty/pex-djgpp.c
+++ gcc/libiberty/pex-djgpp.c
@@ -44,12 +44,12 @@ extern int errno;
static int pex_djgpp_open_read (struct pex_obj *, const char *, int);
static int pex_djgpp_open_write (struct pex_obj *, const char *, int);
-static long pex_djgpp_exec_child (struct pex_obj *, int, const char *,
+static pid_t pex_djgpp_exec_child (struct pex_obj *, int, const char *,
char * const *, char * const *,
int, int, int, int,
const char **, int *);
static int pex_djgpp_close (struct pex_obj *, int);
-static int pex_djgpp_wait (struct pex_obj *, long, int *, struct pex_time *,
+static int 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. */
@@ -110,7 +110,7 @@ pex_djgpp_close (struct pex_obj *obj ATT
/* Execute a child. */
-static long
+static pid_t
pex_djgpp_exec_child (struct pex_obj *obj, int flags, const char *executable,
char * const * argv, char * const * env,
int in, int out, int errdes,
@@ -132,19 +132,19 @@ pex_djgpp_exec_child (struct pex_obj *ob
{
*err = errno;
*errmsg = "dup";
- return -1;
+ return (pid_t) -1;
}
if (dup2 (in, STDIN_FILE_NO) < 0)
{
*err = errno;
*errmsg = "dup2";
- return -1;
+ return (pid_t) -1;
}
if (close (in) < 0)
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
@@ -155,19 +155,19 @@ pex_djgpp_exec_child (struct pex_obj *ob
{
*err = errno;
*errmsg = "dup";
- return -1;
+ return (pid_t) -1;
}
if (dup2 (out, STDOUT_FILE_NO) < 0)
{
*err = errno;
*errmsg = "dup2";
- return -1;
+ return (pid_t) -1;
}
if (close (out) < 0)
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
@@ -179,14 +179,14 @@ pex_djgpp_exec_child (struct pex_obj *ob
{
*err = errno;
*errmsg = "dup";
- return -1;
+ return (pid_t) -1;
}
if (dup2 ((flags & PEX_STDERR_TO_STDOUT) != 0 ? STDOUT_FILE_NO : errdes,
STDERR_FILE_NO) < 0)
{
*err = errno;
*errmsg = "dup2";
- return -1;
+ return (pid_t) -1;
}
if (errdes != STDERR_FILE_NO)
{
@@ -194,7 +194,7 @@ pex_djgpp_exec_child (struct pex_obj *ob
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
}
@@ -218,13 +218,13 @@ pex_djgpp_exec_child (struct pex_obj *ob
{
*err = errno;
*errmsg = "dup2";
- return -1;
+ return (pid_t) -1;
}
if (close (org_in) < 0)
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
@@ -234,13 +234,13 @@ pex_djgpp_exec_child (struct pex_obj *ob
{
*err = errno;
*errmsg = "dup2";
- return -1;
+ return (pid_t) -1;
}
if (close (org_out) < 0)
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
@@ -251,13 +251,13 @@ pex_djgpp_exec_child (struct pex_obj *ob
{
*err = errno;
*errmsg = "dup2";
- return -1;
+ return (pid_t) -1;
}
if (close (org_errdes) < 0)
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
@@ -269,7 +269,7 @@ pex_djgpp_exec_child (struct pex_obj *ob
statuses[obj->count] = status;
obj->sysdep = (void *) statuses;
- return obj->count;
+ return (pid_t) obj->count;
}
/* Wait for a child process to complete. Actually the child process
@@ -277,7 +277,7 @@ pex_djgpp_exec_child (struct pex_obj *ob
status. */
static int
-pex_djgpp_wait (struct pex_obj *obj, long pid, int *status,
+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,
int *err ATTRIBUTE_UNUSED)
Index: gcc/libiberty/pex-msdos.c
===================================================================
--- gcc.orig/libiberty/pex-msdos.c
+++ gcc/libiberty/pex-msdos.c
@@ -54,12 +54,12 @@ struct pex_msdos
static int pex_msdos_open (struct pex_obj *, const char *, int);
static int pex_msdos_open (struct pex_obj *, const char *, int);
static int pex_msdos_fdindex (struct pex_msdos *, int);
-static long pex_msdos_exec_child (struct pex_obj *, int, const char *,
+static pid_t pex_msdos_exec_child (struct pex_obj *, int, const char *,
char * const *, char * const *,
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 *, long, int *, struct pex_time *,
+static int pex_msdos_wait (struct pex_obj *, pid_t, int *, struct pex_time *,
int, const char **, int *);
static void pex_msdos_cleanup (struct pex_obj *);
@@ -152,7 +152,7 @@ pex_msdos_close (struct pex_obj *obj, in
/* Execute a child. */
-static long
+static pid_t
pex_msdos_exec_child (struct pex_obj *obj, int flags, const char *executable,
char * const * argv, char * const * env, int in, int out,
int toclose ATTRIBUTE_UNUSED,
@@ -235,7 +235,7 @@ pex_msdos_exec_child (struct pex_obj *ob
free (scmd);
free (rf);
*errmsg = "cannot open temporary command file";
- return -1;
+ return (pid_t) -1;
}
for (i = 1; argv[i] != NULL; ++i)
@@ -262,7 +262,7 @@ pex_msdos_exec_child (struct pex_obj *ob
free (scmd);
free (rf);
*errmsg = "system";
- return -1;
+ return (pid_t) -1;
}
remove (rf);
@@ -275,7 +275,7 @@ pex_msdos_exec_child (struct pex_obj *ob
ms->statuses = XRESIZEVEC(int, ms->statuses, obj->count + 1);
ms->statuses[obj->count] = status;
- return obj->count;
+ return (pid_t) obj->count;
}
/* Wait for a child process to complete. Actually the child process
@@ -283,7 +283,7 @@ pex_msdos_exec_child (struct pex_obj *ob
status. */
static int
-pex_msdos_wait (struct pex_obj *obj, long pid, int *status,
+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,
int *err ATTRIBUTE_UNUSED)
Index: gcc/libiberty/pex-unix.c
===================================================================
--- gcc.orig/libiberty/pex-unix.c
+++ gcc/libiberty/pex-unix.c
@@ -269,12 +269,12 @@ static void pex_child_error (struct pex_
ATTRIBUTE_NORETURN;
static int pex_unix_open_read (struct pex_obj *, const char *, int);
static int pex_unix_open_write (struct pex_obj *, const char *, int);
-static long pex_unix_exec_child (struct pex_obj *, int, const char *,
+static pid_t pex_unix_exec_child (struct pex_obj *, int, const char *,
char * const *, char * const *,
int, int, int, int,
const char **, int *);
static int pex_unix_close (struct pex_obj *, int);
-static int pex_unix_wait (struct pex_obj *, long, int *, struct pex_time *,
+static int pex_unix_wait (struct pex_obj *, pid_t, int *, struct pex_time *,
int, const char **, int *);
static int pex_unix_pipe (struct pex_obj *, int *, int);
static FILE *pex_unix_fdopenr (struct pex_obj *, int, int);
@@ -355,7 +355,7 @@ pex_child_error (struct pex_obj *obj, co
extern char **environ;
-static long
+static pid_t
pex_unix_exec_child (struct pex_obj *obj, int flags, const char *executable,
char * const * argv, char * const * env,
int in, int out, int errdes,
@@ -384,7 +384,7 @@ pex_unix_exec_child (struct pex_obj *obj
case -1:
*err = errno;
*errmsg = VFORK_STRING;
- return -1;
+ return (pid_t) -1;
case 0:
/* Child process. */
@@ -435,7 +435,7 @@ pex_unix_exec_child (struct pex_obj *obj
}
/* NOTREACHED */
- return -1;
+ return (pid_t) -1;
default:
/* Parent process. */
@@ -445,7 +445,7 @@ pex_unix_exec_child (struct pex_obj *obj
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
if (out != STDOUT_FILE_NO)
@@ -454,7 +454,7 @@ pex_unix_exec_child (struct pex_obj *obj
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
if (errdes != STDERR_FILE_NO)
@@ -463,18 +463,18 @@ pex_unix_exec_child (struct pex_obj *obj
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
- return (long) pid;
+ return pid;
}
}
/* Wait for a child process to complete. */
static int
-pex_unix_wait (struct pex_obj *obj, long pid, int *status,
+pex_unix_wait (struct pex_obj *obj, pid_t pid, int *status,
struct pex_time *time, int done, const char **errmsg,
int *err)
{
Index: gcc/libiberty/pex-win32.c
===================================================================
--- gcc.orig/libiberty/pex-win32.c
+++ gcc/libiberty/pex-win32.c
@@ -79,12 +79,12 @@ backslashify (char *s)
static int pex_win32_open_read (struct pex_obj *, const char *, int);
static int pex_win32_open_write (struct pex_obj *, const char *, int);
-static long pex_win32_exec_child (struct pex_obj *, int, const char *,
+static pid_t pex_win32_exec_child (struct pex_obj *, int, const char *,
char * const *, char * const *,
int, int, int, int,
const char **, int *);
static int pex_win32_close (struct pex_obj *, int);
-static int pex_win32_wait (struct pex_obj *, long, int *,
+static int 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);
@@ -522,7 +522,7 @@ env_compare (const void *a_ptr, const vo
return c1 - c2;
}
-static long
+static pid_t
win32_spawn (const char *executable,
BOOL search,
char *const *argv,
@@ -597,7 +597,7 @@ win32_spawn (const char *executable,
free (full_executable);
- return -1;
+ return (pid_t) -1;
}
/* Clean up. */
@@ -606,7 +606,7 @@ win32_spawn (const char *executable,
if (env_block)
free (env_block);
- return (long) pi->hProcess;
+ return (pid_t) pi->hProcess;
error:
if (env_block)
@@ -616,17 +616,17 @@ win32_spawn (const char *executable,
if (full_executable)
free (full_executable);
- return -1;
+ return (pid_t) -1;
}
-static long
+static pid_t
spawn_script (const char *executable, char *const *argv,
char* const *env,
DWORD dwCreationFlags,
LPSTARTUPINFO si,
LPPROCESS_INFORMATION pi)
{
- int pid = -1;
+ pid_t pid = (pid_t) -1;
int save_errno = errno;
int fd = _open (executable, _O_RDONLY);
@@ -673,7 +673,7 @@ spawn_script (const char *executable, ch
dwCreationFlags, si, pi);
if (executable1 != newex)
free ((char *) newex);
- if (pid < 0)
+ if ((long) pid < 0)
{
newex = msys_rootify (executable1);
if (newex != executable1)
@@ -689,14 +689,14 @@ spawn_script (const char *executable, ch
}
}
}
- if (pid < 0)
+ if ((long) pid < 0)
errno = save_errno;
return pid;
}
/* Execute a child. */
-static long
+static pid_t
pex_win32_exec_child (struct pex_obj *obj ATTRIBUTE_UNUSED, int flags,
const char *executable, char * const * argv,
char* const* env,
@@ -705,7 +705,7 @@ pex_win32_exec_child (struct pex_obj *ob
const char **errmsg,
int *err)
{
- long pid;
+ pid_t pid;
HANDLE stdin_handle;
HANDLE stdout_handle;
HANDLE stderr_handle;
@@ -780,10 +780,10 @@ pex_win32_exec_child (struct pex_obj *ob
/* Create the child process. */
pid = win32_spawn (executable, (flags & PEX_SEARCH) != 0,
argv, env, dwCreationFlags, &si, &pi);
- if (pid == -1)
+ if (pid == (pid_t) -1)
pid = spawn_script (executable, argv, env, dwCreationFlags,
&si, &pi);
- if (pid == -1)
+ if (pid == (pid_t) -1)
{
*err = ENOENT;
*errmsg = "CreateProcess";
@@ -808,7 +808,7 @@ pex_win32_exec_child (struct pex_obj *ob
macros. Note that WIFSIGNALED will never be true under CRTDLL. */
static int
-pex_win32_wait (struct pex_obj *obj ATTRIBUTE_UNUSED, long pid,
+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)
{
@@ -883,7 +883,7 @@ main (int argc ATTRIBUTE_UNUSED, char **
char const *errmsg;
int err;
argv++;
- printf ("%ld\n", pex_win32_exec_child (NULL, PEX_SEARCH, argv[0], argv, NULL, 0, 0, 1, 2, &errmsg, &err));
+ printf ("%ld\n", (long) pex_win32_exec_child (NULL, PEX_SEARCH, argv[0], argv, NULL, 0, 0, 1, 2, &errmsg, &err));
exit (0);
}
#endif
=
^ permalink raw reply [flat|nested] 8+ messages in thread
* patch: libiberty pex for _WIN64
2007-08-01 1:45 PING: Re: patch: libiberty adjustments " Ian Lance Taylor
@ 2007-08-03 15:01 ` Kai Tietz
0 siblings, 0 replies; 8+ messages in thread
From: Kai Tietz @ 2007-08-03 15:01 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: gcc-patches, gdb-patches, binutils
Ian,
I prepared a patch for pex using pid_t instead of the type 'long' for
system handles. This is necessary for _WIN64, because the long type isn't
wide enougth to hold a pointer for this ABI The type pid_t is always
defined by the configure in config.h if not defined by the header-set.
Therefore it seems to be the best way to make this run.
ChangeLog:
2007-08-03 Kai Tietz <kai.tietz@onevision.com>
* pex-common.h: (pex_funcs): Retyped wait and exec_child to pid_t.
* pex-djgpp.c: Likewise.
* pex-msdos.c: Likewise.
* pex-unix.c: Likewise.
* pex-win32.c: Likewise.
Cheers,
i.A. Kai Tietz
| (\_/) This is Bunny. Copy and paste Bunny
| (='.'=) into your signature to help him gain
| (")_(") world domination.
------------------------------------------------------------------------------------------
OneVision Software Entwicklungs GmbH & Co. KG
Dr.-Leo-Ritter-Straße 9 - 93049 Regensburg
Tel: +49.(0)941.78004.0 - Fax: +49.(0)941.78004.489 - www.OneVision.com
Commerzbank Regensburg - BLZ 750 400 62 - Konto 6011050
Handelsregister: HRA 6744, Amtsgericht Regensburg
Komplementärin: OneVision Software Entwicklungs Verwaltungs GmbH
Dr.-Leo-Ritter-Straße 9 – 93049 Regensburg
Handelsregister: HRB 8932, Amtsgericht Regensburg - Geschäftsführer:
Ulrike Döhler, Manuela Kluger
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-08-07 14:18 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-03 15:32 patch: libiberty pex for _WIN64 Kai Tietz
2007-08-03 16:02 ` Ian Lance Taylor
2007-08-07 14:18 ` Kai Tietz
2007-08-03 23:16 ` Christopher Faylor
2007-08-04 8:44 ` Eli Zaretskii
2007-08-04 16:35 ` Christopher Faylor
2007-08-06 7:07 ` Kai Tietz
-- strict thread matches above, loose matches on Subject: below --
2007-08-01 1:45 PING: Re: patch: libiberty adjustments " Ian Lance Taylor
2007-08-03 15:01 ` patch: libiberty pex " Kai Tietz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).