News for hackers. Stuff that matters.
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by c00lio on Wednesday June 21, 2023 @10:25AM (#36418849)
Netlink sockets in Linux input and output packed C structures. Doesn't get more efficient than that. Such an interface definitely doesn't have to be strings-only. But of course, you cannot use it with just 'echo' in that case.
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by markhahn on Wednesday June 21, 2023 @03:35PM (#36423253)
/proc pseudofiles could have a mode (perhaps on open) that determines whether the protocol is ascii or packed/binary. there could even be a side-band interface that provides the packed schema (assuming not everything is exploded to atomic type-evident items).
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by mike_hock on Wednesday June 21, 2023 @04:15PM (#36423758)
How is that "simple and elegant" design going for you?
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by naasking on Wednesday June 21, 2023 @06:33PM (#36425611)
Passing data in registers is more efficient, that's what you lose with serialization. Serialization gets you generality at the cost of some performance.
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by c00lio on Wednesday June 21, 2023 @07:12PM (#36426033)
Right, registers are even faster.
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by codedokode on Thursday June 22, 2023 @06:11PM (#36439826)
Why not make real syscalls rather than emulate them using socket-like interface? Doesn't make much sense to me. For example, if you want to filter syscalls then it becomes more difficult (need to remember which type of socket it is, need to parse the structures and so on).
Re:Linux Namespaces Are a Poor Man's Plan 9 Namespaces by c00lio on Friday June 23, 2023 @04:33AM (#36444269)
The original idea for netlink sockets (where the name comes from) is to be able to do some network packet processing in userspace. E.g. to do stuff like virus-scanning on TCP connections.

The situation there is exactly the opposite of a syscall, it is rather that the kernel calls into userspace to perform a helper function.

Communication with the socket is still read()/write()/..., so there are still syscalls. The userspace program will do a read() to get the next struct+packet out of the socket.

The modern, syscall-less interface for stuff would be io_uring. There, you do not need to read(), you can just get your data written into a userspace buffer that you can mwait or poll on.