running the mips version of "sysctl -a" yeilds no output: sbruno@tasty.ysv:~/qemu-bsd-user % mips-bsd-user/qemu-mips /usr/local/poudriere/jails/11mips-test/rescue/sysctl -a sysctl: sysctl fmt -1 1024 2: No such file or directory running the arm version works just fine: sbruno@tasty.ysv:~/qemu-bsd-user % mips-bsd-user/qemu-mips /usr/local/poudriere/jails/11mips-test/rescue/sysctl kern sbruno@tasty.ysv:~/qemu-bsd-user % mips-bsd-user/qemu-mips /usr/local/poudriere/jails/11mips-test/rescue/sysctl kern.ipc sbruno@tasty.ysv:~/qemu-bsd-user % arm-bsd-user/qemu-arm /usr/local/poudriere/jails/11armv6/rescue/sysctl kern.ipc kern.ipc.maxsockbuf: 2097152 0 kern.ipc.sockbuf_waste_factor: 8 0 kern.ipc.max_linkhdr: 16 kern.ipc.max_protohdr: 60 kern.ipc.max_hdr: 76 kern.ipc.max_datalen: 92 kern.ipc.sendfile.readahead: 1 kern.ipc.maxsockets: 523050 kern.ipc.numopensockets: 49 kern.ipc.soacceptqueue: 128 kern.ipc.shm_allow_removed: 0 kern.ipc.shm_use_phys: 0 kern.ipc.shmall: 131072 0 kern.ipc.shmseg: 128 0 kern.ipc.shmmni: 192 0 kern.ipc.shmmin: 1 0 kern.ipc.shmmax: 536870912 0 kern.ipc.semaem: 16384 kern.ipc.semvmx: 32767 kern.ipc.semusz: 632 kern.ipc.semume: 50 kern.ipc.semopm: 100 kern.ipc.semmsl: 340 kern.ipc.semmnu: 150 kern.ipc.semmns: 340 kern.ipc.semmni: 50 kern.ipc.msgseg: 2048 kern.ipc.msgssz: 8 kern.ipc.msgtql: 40 kern.ipc.msgmnb: 2048 kern.ipc.msgmni: 40 kern.ipc.msgmax: 16384 kern.ipc.piperesizeallowed: 1 kern.ipc.piperesizefail: 0 kern.ipc.pipeallocfail: 0 kern.ipc.pipefragretry: 0 kern.ipc.pipekva: 540672 0 kern.ipc.maxpipekva: 267796480 0 kern.ipc.nmbufs: 6513165 kern.ipc.nmbjumbo16: 339224 kern.ipc.nmbjumbo9: 452301 kern.ipc.nmbjumbop: 508841 kern.ipc.nmbclusters: 1017682 kern.ipc.maxmbufmem: 8336850944
Also fails with qemu-mips64. qemu-mips64-static -strace indicates that sysctl({0 4 16777216 16777216}, 4,...) is failing: 39063 __sysctl({ 0 2 1 }, 3, 0x0000007fffffd5f8, 0x0000007fffffd650, 0x0000000000000000, 0x0000000000000000) = 0 39063 __sysctl({ 0 1 16777216 16777216 }, 4, 0x0000007fffffccb0, 0x0000007fffffd518, 0x0000000000000000, 0x0000000000000000) = 0 39063 __sysctl({ 0 4 16777216 16777216 }, 4, 0x0000007fffffc478, 0x0000007fffffc878, 0x0000000000000000, 0x0000000000000000) = -1 errno=2 (No such file or directory) A comment from sys/kern/kern_sysctl.c documents these undocumented sysctl's: /* * "Staff-functions" * * These functions implement a presently undocumented interface * used by the sysctl program to walk the tree, and get the type * so it can print the value. * This interface is under work and consideration, and should probably * be killed with a big axe by the first person who can find the time. * (be aware though, that the proper interface isn't as obvious as it * may seem, there are various conflicting requirements. * * {0,0} printf the entire MIB-tree. * {0,1,...} return the name of the "..." OID. * {0,2,...} return the next OID. * {0,3} return the OID of the name in "new" * {0,4,...} return the kind & format info for the "..." OID. * {0,5,...} return the description the "..." OID. */ It is strange that {0,1,...} works but {0,4,...} is failing.
(In reply to Stacey Son from comment #1) Some sysctls are structs, I don't think we handle all of these...
..for example sysctl_oldcvt() in bsd-user/freebsd/os-sys.c doesn't handle CTLTYPE_OPAQUE and CTLTYPE_STRUCT.
(In reply to Juergen Lock from comment #3) Note that all the KERN_PROC code I recently added is CTLTYPE_STRUCT types. With structs there isn't really a generic way of handling them.
https://github.com/seanbruno/qemu-bsd-user/commit/9b1c1bb82d63266e0b0e24d455e430ae366642c3 should fix this problem and give lots of output for 'sysctl -a'. Some of the output from 'sysctl -a' may not be correct, however, since it may need to be byte swapped itself.
A commit references this bug: Author: nox Date: Thu Jul 2 15:41:53 UTC 2015 New revision: 391165 URL: https://svnweb.freebsd.org/changeset/ports/391165 Log: Catch up with github tree - changelog: https://github.com/seanbruno/qemu-bsd-user/commits/bsd-user PR: 201168 Changes: head/emulators/qemu-sbruno/Makefile head/emulators/qemu-sbruno/distinfo