Skip to contentSkip to conversation

Patch: dyngen-exec.h for OpenBSD

Qemu-devel Juergen Keil 3 participants 5 messages Apr 2, 2007

lore
Share & tools
lore
#0 lore raw
Quoted 8 lines

From: Thiemo Seufer <[email protected]>

Quoted 5 lines · Todd T. Fries

This is relative to the 20070319 snapshot.

dyngen-exec.h renamed from dyngen-exec.h.orig +0 -0

...

Quoted 6 lines
Quoted 6 lines

/* XXX: This may be wrong for 64-bit ILP32 hosts. */ typedef void * host_reg_t;

dyngen-exec.h renamed from dyngen-exec.h.orig +0 -0
@@ -78,11 +83,15 @@ typedef void * host_reg_t;
 #define UINT32_MAX		(4294967295U)
 #define UINT64_MAX		((uint64_t)(18446744073709551615))
 
Quoted 11 lines

dyngen-exec.h typedef void * host_reg_t; · line 94

Quoted 9 lines
dyngen-exec.h renamed from dyngen-exec.h.orig +4 -0
+#ifdef __OpenBSD__
+typedef struct __sFILE FILE;
+#else
 typedef struct FILE FILE;
 extern int fprintf(FILE *, const char *, ...);
 extern int printf(const char *, ...);
 #undef NULL
 #define NULL 0
+#endif

Shouldn't this cover only the FILE typedef?

Probably.

My dyngen-exec.h has a similar change, when I made some NetBSD experiments:

Index: dyngen-exec.h
===================================================================
RCS file: /cvsroot/qemu/qemu/dyngen-exec.h,v
retrieving revision 1.33

dyngen-exec.h 2 Apr 2007 09:42:03 -0000 renamed from dyngen-exec.h 30 Mar 2007 16:44:53 -0000 1.33 +4 -0
diff -u -B -r1.33 dyngen-exec.h
@@ -78,7 +78,11 @@
 #define UINT32_MAX             (4294967295U)
 #define UINT64_MAX             ((uint64_t)(18446744073709551615))
 
+#ifdef __NetBSD__
+typedef struct __sFILE FILE;
+#else
 typedef struct FILE FILE;
+#endif
 extern int fprintf(FILE *, const char *, ...);
 extern int fputs(const char *, FILE *);
 extern int printf(const char *, ...);
#1 lore raw
Quoted 39 lines · Juergen Keil
Quoted 8 lines

From: Thiemo Seufer <[email protected]>

Quoted 5 lines · Todd T. Fries

This is relative to the 20070319 snapshot.

dyngen-exec.h renamed from dyngen-exec.h.orig +0 -0

...

Quoted 6 lines
Quoted 6 lines

/* XXX: This may be wrong for 64-bit ILP32 hosts. */ typedef void * host_reg_t;

dyngen-exec.h renamed from dyngen-exec.h.orig +0 -0
@@ -78,11 +83,15 @@ typedef void * host_reg_t;
 #define UINT32_MAX		(4294967295U)
 #define UINT64_MAX		((uint64_t)(18446744073709551615))
 
Quoted 11 lines

dyngen-exec.h typedef void * host_reg_t; · line 94

Quoted 9 lines
dyngen-exec.h renamed from dyngen-exec.h.orig +4 -0
+#ifdef __OpenBSD__
+typedef struct __sFILE FILE;
+#else
 typedef struct FILE FILE;
 extern int fprintf(FILE *, const char *, ...);
 extern int printf(const char *, ...);
 #undef NULL
 #define NULL 0
+#endif

Shouldn't this cover only the FILE typedef?

Probably.

My dyngen-exec.h has a similar change, when I made some NetBSD experiments:

Index: dyngen-exec.h
===================================================================
RCS file: /cvsroot/qemu/qemu/dyngen-exec.h,v
retrieving revision 1.33
diff -u -B -r1.33 dyngen-exec.h

dyngen-exec.h 2 Apr 2007 09:42:03 -0000 line 85

Quoted 8 lines
dyngen-exec.h 2 Apr 2007 09:42:03 -0000 renamed from dyngen-exec.h 30 Mar 2007 16:44:53 -0000 1.33 +4 -0
@@ -78,7 +78,11 @@
 #define UINT32_MAX             (4294967295U)
 #define UINT64_MAX             ((uint64_t)(18446744073709551615))
 
+#ifdef __NetBSD__
+typedef struct __sFILE FILE;
+#else
 typedef struct FILE FILE;
+#endif

I made that "#ifdef _BSD" based on the assumption it is ok for all BSD variants, including Darwin.

Thiemo

#2 lore raw

In message: <[email protected]>
Thiemo Seufer <[email protected]> writes:
: I made that "#ifdef _BSD" based on the assumption it is ok for all : BSD variants, including Darwin.

_BSD isn't defined on all variants of BSD. sys/param.h defines BSD to be 199506 on all BSD systems (at least all of them derived from 4.4BSD lite). sys/param.h also defines BSD4_3 and BSD4_4. FreeBSD defines __FreeBSD__ in the compiler, NetBSD defined __NetBSD__, OpenBSD defines __OpenBSD__. I'm unsure what darwin/osx define.

so unless I missed a change elsewhere in the build system to define _BSD, this change needs some more thought.

Warner

#3 lore raw
Quoted 5 lines · M. Warner Losh

In message: <[email protected]>
Thiemo Seufer <[email protected]> writes:
: I made that "#ifdef _BSD" based on the assumption it is ok for all : BSD variants, including Darwin.

Quoted 8 lines

_BSD isn't defined on all variants of BSD. sys/param.h defines BSD to be 199506 on all BSD systems (at least all of them derived from 4.4BSD lite). sys/param.h also defines BSD4_3 and BSD4_4. FreeBSD defines __FreeBSD__ in the compiler, NetBSD defined __NetBSD__, OpenBSD defines __OpenBSD__. I'm unsure what darwin/osx define.

so unless I missed a change elsewhere in the build system to define _BSD, this change needs some more thought.

It is already used in other files. The define in qemu comes from the configure script via config.h, which might be a bug.

Thiemo

#4 lore raw

In message: <[email protected]>
Thiemo Seufer <[email protected]> writes:
: M. Warner Losh wrote:
: > In message: <[email protected]>
: > Thiemo Seufer <[email protected]> writes:
: > : I made that "#ifdef _BSD" based on the assumption it is ok for all : > : BSD variants, including Darwin.
: >
: > _BSD isn't defined on all variants of BSD. sys/param.h defines BSD to : > be 199506 on all BSD systems (at least all of them derived from 4.4BSD : > lite). sys/param.h also defines BSD4_3 and BSD4_4. FreeBSD defines : > __FreeBSD__ in the compiler, NetBSD defined __NetBSD__, OpenBSD : > defines __OpenBSD__. I'm unsure what darwin/osx define.
: >
: > so unless I missed a change elsewhere in the build system to define : > _BSD, this change needs some more thought.
:
: It is already used in other files. The define in qemu comes from the : configure script via config.h, which might be a bug.

Somehow I missed that detail... In that case, nevermind :-)

Warner