Patchwork bsd-user: OS-agnostic 64-bit SYSCTL types

login
register
mail settings
Submitter Ed Maste
Date April 29, 2013, 2:12 p.m.
Message ID <1367244775-94775-1-git-send-email-emaste@freebsd.org>
Download mbox | patch
Permalink /patch/240377/
State New
Headers show

Comments

Ed Maste - April 29, 2013, 2:12 p.m.
Use existence of type as #ifdef condition rather than FreeBSD-specific
version check, as suggested by Patrick Welche.

Also handle the signed (CTLTYPE_S64) case identically to the unsigned
(CTLTYPE_U64) case, per later patches in the FreeBSD ports tree
(emulators/qemu-devel/files/patch-z-arm-bsd-user-001).

Signed-off-by: Ed Maste <emaste@freebsd.org>
---
 bsd-user/syscall.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Patch

diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c
index 69e3466..34b8dfc 100644
--- a/bsd-user/syscall.c
+++ b/bsd-user/syscall.c
@@ -211,10 +211,11 @@  static int sysctl_oldcvt(void *holdp, size_t holdlen, uint32_t kind)
         *(uint64_t *)holdp = tswap64(*(unsigned long *)holdp);
         break;
 #endif
-#if !defined(__FreeBSD_version) || __FreeBSD_version < 900031
-    case CTLTYPE_QUAD:
-#else
+#ifdef CTLTYPE_U64:
+    case CTLTYPE_S64:
     case CTLTYPE_U64:
+#else
+    case CTLTYPE_QUAD:
 #endif
         *(uint64_t *)holdp = tswap64(*(uint64_t *)holdp);
         break;