Thread #108589999
File: 1709467084805253.jpg (435.7 KB)
435.7 KB JPG
previous: >>108582499#define __NR_vhangup 153
https://man7.org/linux/man-pages/man2/vhangup.2.html
tl;dr:
virtually hup a terminal
i went to the archives to double check that i hadn't included this one in a previous thread, and from what i can see, it looks like no one has ever posted the term "vhangup" to /g/ before... really interesting. i wonder to how many syscalls that applies?
anyway, i read the manpage, and to be perfectly honest with you, i'm still not really sure what this syscall does. i was never good with terminals. the low level details really confuse me... i need to take that one anon's advice from a few threads back and read the chapters from the classic book on it.
there were go, found it: https://desuarchive.org/g/thread/108458443/#108465772
chapter #34 in TLPI
i wonder if that anon is still around and might have anything to add?
otherwise, i might just poke around on bootlin and see what exactly is happening in the source for this guy
relevant resources:man manman syscalls
https://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/
24 RepliesView Thread
>>
>>
>>
>>
>>108589999
>heartbroken nekomimi meido
;_;
Anyway, this sounds like a way to disconnect from a connected terminal without killing the current process. I don't get why this can't be done withraise(SIGHUP);, though.
>>
>>
>>
>>108590248
she's just like me fr
>>108590254
yeah, there's a whole lot of cruft i'm discovering
>>
>>108590254
>>108590267
I'm not surprised. Unix started as essentially a toy project in the late 60s and then got too popular to break backwards compatibility, so any new and improved interfaces were just piled on top of everything else that already existed. The POSIX C time API, for example, is particularly messy.
>>
>>
>>
>>
>>
>>
>>
>>108590361
try setting SIGHUP to ignored and see what happens?
https://elixir.bootlin.com/linux/v6.19.11/source/drivers/tty/tty_io.c# L680
>>
>>108590361
>>108590440
oh, and, here's the wrapper
https://elixir.bootlin.com/linux/v6.19.11/source/fs/open.c#L1588
>>
>>
>>
>>108589999
I don't really get what this does, the man page for login mentions this :
> A recursive login, as used to be possible in the good old days, no longer works; for most purposes su(1) is a satisfactory substitute. Indeed, for security reasons, login does a vhangup(2) system call to remove any possible listening processes on the tty. This is to avoid password sniffing. If one uses the command login, then the surrounding shell gets killed by vhangup(2) because it’s no longer the true owner of the tty. This can be avoided by using exec login in a top-level shell or xterm.
>>
>>
>>
>>108590434
>>108591572
how is this different than just calling revoke on the tty?
>>
>>
>>108592263
apparently revoke does not really exist on linux, which is kind of surprising. glibc has the function but it always fails with ENOSYS, and there is no revoke system call. In order to revoke access to a terminal you have to either use this syscall or the TIOCVHANGUP ioctl on the terminal.