[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: huabqu3dfm6e1.jpg (146 KB, 1080x1197)
146 KB JPG
previous: >>108786358

#define __NR_set_tid_address        218

https://man7.org/linux/man-pages/man2/set_tid_address.2.html

tl;dr:
manage a thread's tid

kind of a weird/niche one. it seems to be used in what is effectively a waitpid, but for threads?
why is returns your own tid, i can't even begin to imagine
it's a bit strange that this syscall supposedly always succeeds. i haven't looked at the source code, but i have a feeling if the address you pass in is outside of your address space...
just looked it up, and nope. lol
            /*
* We don't check the error code - if userspace has
* not set up a proper pointer then tough luck.
*/


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/
>>
File: 1767214649302229.png (164 KB, 407x485)
164 KB PNG
Usecase for altering a thread's ID?
Unironically.
>>
very convoluted naming and manpage.
I wonder whether it's this convoluted just so can wait on a futex instead of always having to issue a syscall like with waitpid
>>
>>108795244
you aren't altering the TID, the naming is just very confusing
>>
>>108795364
glibc uses it for pthread joining.
https://elixir.bootlin.com/glibc/glibc-2.43/source/nptl/pthread_create.c#L293



[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.