3 ms·
Most unixes allow for static binaries. And most unixes allow for you to run a static binary compiled for an older OS on a newer OS. In order for that to work, t
by toast0 3y ago
Most unixes allow for static binaries. And most unixes allow for you to run a static binary compiled for an older OS on a newer OS. In order for that to work, the syscall interface needs to be at least mostly stable.
Yes, if you're writing netstat or lsof or ps or something, you need tight coupling with the binary and the kernel, and you can argue Linux does that better, but most people aren't writing netstat or lsof or ps.
- IAmLiterallyAB 3y agoEven those get most of their info from /proc and /sys rather than special syscalls
- epcoa 3y agoOn the BSDs they sure don't, /proc (for its role referred to) and /sys are peculiar to Linux, /proc is not even mounted by default on FreeBSD, is deprecated and doesn't exist on OpenBSD. On OpenBSD/FreeBSD most of the info comes out with sysctl(3) or reading kernel memory directly.
- saagarjha 3y ago> reading kernel memory directly God I hope not
- adrian_b 3y agoI do not know what the previous poster was talking about, but, while unrestricted access to kernel memory is of course unacceptable, a perfectly secure and useful means for the kernel to provide information to a user process is to map a page as read-only in the user address space, from where the user process could get the information without the overhead of a system call. For information of general interest such a special kernel page could be mapped as read-only in the address space of all user processes. Much of the information that is provided in the special file systems /proc and /sys could have been provided in some appropriate data structures in such read-only shared memory, for a faster access, by avoiding the overhead of file system calls and of file text parsing.
- deleted 3y ago[deleted]
- epcoa 3y agohttps://man.freebsd.org/cgi/man.cgi?query=kvm&sektion=3&n=1 https://man.freebsd.org/cgi/man.cgi?query=kvm&sektion=3&n=1 The aforementioned tools use these interfaces. Emphasis on most of the sundry information for the live kernel now comes from sysctl, I note the (root only) mem/kmem interface for completeness and rare utilities (eg btsockstat) use it. Going way back, this is how it all used to work, the more structured interfaces were a 90s thing. https://github.com/v7unix/v7unix/blob/master/v7/usr/src/cmd/ps.c https://github.com/v7unix/v7unix/blob/master/v7/usr/src/cmd/... Even early Linux used kmem for ps. Not ideal https://cdn.kernel.org/pub/linux/kernel/Historic/old-versions/RELNOTES-0.97 https://cdn.kernel.org/pub/linux/kernel/Historic/old-version... Also why the package is still called procps, for a while it coexisted with kmem-ps.