summaryrefslogtreecommitdiff
path: root/emulators/qemu-devel/files
diff options
context:
space:
mode:
authorJuergen Lock <nox@FreeBSD.org>2014-04-05 21:54:49 +0000
committerJuergen Lock <nox@FreeBSD.org>2014-04-05 21:54:49 +0000
commitd7878e0e9da8bedf128dbe1822e58b64303803e8 (patch)
tree5633337392b51672b3b3567b45b0a2ed0bf32b5d /emulators/qemu-devel/files
parent- remove comment from patch (diff)
- Three more bsd-user fixes:
- Fix fchflags(). (typo) [1] - Fix hw.availpages sysctl. [1] - Fix sysctl kern.usrstack and kern.ps_strings invoked from sysctl(8). - Bump PORTREVISION. Reported by: sbruno [1]
Diffstat (limited to 'emulators/qemu-devel/files')
-rw-r--r--emulators/qemu-devel/files/extra-patch-bsd-user-syscall.c11
-rw-r--r--emulators/qemu-devel/files/extra-patch-sysctl-0oldlen24
-rw-r--r--emulators/qemu-devel/files/extra-patch-sysctl-hw-availpages53
3 files changed, 88 insertions, 0 deletions
diff --git a/emulators/qemu-devel/files/extra-patch-bsd-user-syscall.c b/emulators/qemu-devel/files/extra-patch-bsd-user-syscall.c
new file mode 100644
index 000000000000..3570ca234e35
--- /dev/null
+++ b/emulators/qemu-devel/files/extra-patch-bsd-user-syscall.c
@@ -0,0 +1,11 @@
+--- a/bsd-user/syscall.c
++++ b/bsd-user/syscall.c
+@@ -627,7 +627,7 @@ abi_long do_freebsd_syscall(void *cpu_en
+ break;
+
+ case TARGET_FREEBSD_NR_fchflags: /* fchflags(2) */
+- ret = do_bsd_fchflags(arg2, arg2);
++ ret = do_bsd_fchflags(arg1, arg2);
+ break;
+
+ case TARGET_FREEBSD_NR_chroot: /* chroot(2) */
diff --git a/emulators/qemu-devel/files/extra-patch-sysctl-0oldlen b/emulators/qemu-devel/files/extra-patch-sysctl-0oldlen
new file mode 100644
index 000000000000..72a8d52d92d7
--- /dev/null
+++ b/emulators/qemu-devel/files/extra-patch-sysctl-0oldlen
@@ -0,0 +1,24 @@
+--- 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
diff --git a/emulators/qemu-devel/files/extra-patch-sysctl-hw-availpages b/emulators/qemu-devel/files/extra-patch-sysctl-hw-availpages
new file mode 100644
index 000000000000..914f146961b4
--- /dev/null
+++ b/emulators/qemu-devel/files/extra-patch-sysctl-hw-availpages
@@ -0,0 +1,53 @@
+--- a/bsd-user/freebsd/os-sys.c
++++ b/bsd-user/freebsd/os-sys.c
+@@ -219,24 +219,36 @@ abi_long do_freebsd_sysctl(CPUArchState
+ ret = 0;
+ goto out;
+
+- case 851: /* hw.availpages */
++ default:
+ {
+- long lvalue;
+- size_t len = sizeof(lvalue);
++ static int oid_hw_availpages;
++
++ if (!oid_hw_availpages) {
++ int real_oid[CTL_MAXNAME+2];
++ size_t len = sizeof(real_oid) / sizeof(int);
+
+- if (sysctlbyname("hw.availpages", &lvalue, &len, NULL, 0)
+- == -1) {
+- ret = -1;
+- } else {
+- (*(abi_ulong *)holdp) = tswapal((abi_ulong)lvalue);
+- holdlen = sizeof(abi_ulong);
+- ret = 0;
++ if (sysctlnametomib("hw.availpages", real_oid, &len) >= 0)
++ oid_hw_availpages = real_oid[1];
+ }
+- }
+- goto out;
+
+- default:
+- break;
++ if (oid_hw_availpages && snamep[1] == oid_hw_availpages) {
++ long lvalue;
++ size_t len = sizeof(lvalue);
++
++ if (sysctlbyname("hw.availpages", &lvalue, &len, NULL, 0)
++ == -1) {
++ ret = -1;
++ } else {
++ if (oldlen) {
++ (*(abi_ulong *)holdp) = tswapal((abi_ulong)lvalue);
++ }
++ holdlen = sizeof(abi_ulong);
++ ret = 0;
++ }
++ goto out;
++ }
++ break;
++ }
+ }
+ default:
+ break;