Skip to contentSkip to conversation

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

PATCH Applied Ed Maste 2 participants 2 messages Apr 30, 2013 – May 3, 2013

lore
Share & tools
lore

Ed Maste

author
#0 lore raw

PATCH v2 1/1 bsd-user: OS-agnostic 64-bit SYSCTL types

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).

---
v2: Delete stray : at end of #ifdef conditional

 bsd-user/syscall.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
bsd-user/syscall.c +4 -3
index 69e3466..a4d1583 100644
@@ -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;
Signature · 1 line
1.7.11.5
#1 lore raw
Quoted 6 lines · Ed Maste

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).

Applied to trivial-patches tree (8e4125147a8bc4da2c1e8eced722ebe31bafc19e), thank you!

/mjt