[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: 1709467084805253.jpg (436 KB, 3000x2706)
436 KB
436 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 man

man 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/
>>
Nice pic asshole

Deviant plus alcoholic...
>>
>>108590087
yep, that's me
you're probably wondering how i got here
>>
i dont know what these threads are about but keep posting, the pics are cool.
>>
>>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 with
 raise(SIGHUP); 
, though.
>>
these syscalls always remind you of how hilariously outdated many of the unix primitives are
>>
>>108590248
Wait, never mind,
 raise(SIGHUP); 
would kill the current process.
>>
>>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.
>>
I don'get it either. If the hangup is simulated, how does the user get a clean terminal? What even does "simulated" mean in this context? Confusing.
>>
>>108590306
I just tried it and got the "Operation not permitted" errno.
>>
>>108590337
you've gotta sudo it
>>
>>108590341
It seems to just kill the process with a SIGHUP without executing any following code.
>>
>>108589999
Also notable about this syscall is that it seems to be Linux-specific. I can't find a POSIX manpage for it.
>>
>>108589999
How is this different from just closing the file descriptors for the terminal?
>>
>>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
>>
>>108590112
if you were a real woman I could save you
>>
>>108590482
it's ok im actually pretty happy these days and don't need saving but y'know, at least you tried
>>
>>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.
>>
>>108590112
tell us
>>
>>108590434
you would have to do it for all processes in the session, or at least in the foreground process group (I think). I assume this syscall enforces this for you
>>
>>108590434
>>108591572
how is this different than just calling revoke on the tty?
>>
>>108592263
so far, no one seems to know
>>
>>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.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.