previous: >>108155678#define __NR_shutdown 48https://man7.org/linux/man-pages/man2/shutdown.2.htmlnow this is a poorly named syscall if i've ever seen one! i totally thought this referred to shutting down the machine, but nope. that's reboot (even for shutdowns!)it is quite neat that you can partially shut down the socket connection, though. sort of like an fcntl in a way, i guessrelevant resources: man manman syscallshttps://man7.org/linux/man-pages/https://linux.die.net/man/https://elixir.bootlin.com/linux/https://elixir.bootlin.com/musl/https://elixir.bootlin.com/glibc/
#define __NR_shutdown 48
man man
man syscalls
>>108162093> If how is SHUT_RD, further receptions will be disallowed. If how is SHUT_WR, further transmissions will be disallowed. If how is SHUT_RDWR, further receptions and transmissions will be disallowed.Is this useful for firewalls? What else can this be useful for?
>>108162292>What else can this be useful for?Just graceful termination.Also, if you ever needed proof that the designers of the socket layer had no idea what they were doing - at all: you cannot reuse a shut-down socket. Which would've been nice, y'know, to avoid having to interact with this shitty microkernel interface and pay for protection ring switches out the wazoo.
>>108162311god they love pulling shit like that
>>108162610It goes back to the original UNIX, which actually had a reason for these piecemeal interfaces:>little memory>thus simple memory model>also mass storage was tapeProblem is that those were the limitations of 1969, and as such didn't exist in 1989, when NT started, or 1991, when Linux did.Or 1982, when the 80286 released and protection ring switches were introduced, and people like Tanenbaum would still advocate for microkernels. Which, don't get me wrong, they have their use cases - but not on the x86/x64.