ports/emulators/qemu-devel/files/extra-patch-sysctl-0oldlen
Juergen Lock cf14e8bdd7 - Update to 2.0.0 - announce message is here:
http://article.gmane.org/gmane.comp.emulators.qemu/267615

- Take updated bsd-user patches from sbruno's github repo. [1]
- Add headers to my recent bsd-user patches. (they are applied as in
  the EXTRA_PATCHES order in the port Makefile)

Submitted by:	sbruno [1]
Obtained from:	https://github.com/seanbruno/qemu/commits/bsd-user [1]
2014-04-18 10:53:51 +00:00

34 lines
1.1 KiB
Text

From nox Mon Sep 17 00:00:00 2001
From: Juergen Lock <nox@jelal.kn-bremen.de>
Date: 05 Apr 2014 23:36:00 +0200
Subject: Fix FreeBSD sysctls kern.usrstack and kern.ps_strings
Fix FreeBSD sysctls kern.usrstack and kern.ps_strings invoked with
oidlen zero. (like from sysctl(8))
Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
--- a/bsd-user/freebsd/os-sys.c
+++ b/bsd-user/freebsd/os-sys.c
@@ -165,7 +165,9 @@ abi_long do_freebsd_sysctl(CPUArchState
switch (snamep[1]) {
case KERN_USRSTACK:
#if TARGET_USRSTACK != 0
- (*(abi_ulong *)holdp) = tswapal(TARGET_USRSTACK);
+ if (oldlen) {
+ (*(abi_ulong *)holdp) = tswapal(TARGET_USRSTACK);
+ }
holdlen = sizeof(abi_ulong);
ret = 0;
#else
@@ -175,7 +177,9 @@ abi_long do_freebsd_sysctl(CPUArchState
case KERN_PS_STRINGS:
#if defined(TARGET_PS_STRINGS)
- (*(abi_ulong *)holdp) = tswapal(TARGET_PS_STRINGS);
+ if (oldlen) {
+ (*(abi_ulong *)holdp) = tswapal(TARGET_PS_STRINGS);
+ }
holdlen = sizeof(abi_ulong);
ret = 0;
#else