[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: 1767741151326502.jpg (22 KB, 320x306)
22 KB
22 KB JPG
previous: >>107813965

#define __NR_poll                7


so early on, and we're already breaking into async operations. poll is quite exciting! it makes use of signals, timespecs, and structs with varying definitions. it's a good example of how linux had modernized over the years

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/
>>
>>107824139
poll is a relict of the past just use epoll
also why poll is faster than select why did they make select when poll was already in?
>>
why file descriptors are blocking by default?
say i have a pipe fd that poll (or select (or epoll)) lets me know that this pipe is readable
how am i supposed to know that I read everything off the pipe without making that file descriptor non-blocking?
also most tutorials dont even tell you can just make fds nonblockig, took me a while to realize that
>>
>>107824365
faster as in it has smaller syscall number not in performance
>>
>>107824392
read documentation, faggot
>>
>>107824139
at least he's happy serving his master
>>
File: file.png (646 KB, 898x4274)
646 KB
646 KB PNG
https://linux.die.net/man/2/poll
>>
>>107824392
>>107824405
(nta)
process sleeps until it gets input?
>>
>>107824434
read documentation
>>
>>107824438
i will do unspeakable things to your computer
and im gonna make you watch it all
>>
>>107824457
you can't even read
>>
poll is retarded. You can only wait for events on file descriptors. A truly useful poll would also allow you to wait on process or thread termination. Also, they still haven't deprecated select so half of codemonkeys still use it despite that it's even far worse than poll.
>>
>>107824464
yes i can but you could have said
"uh-huh"
>>
>>107824468
pidfd exists, midwit
>>
>>107824468
>process termination
pidfd
>thread thermination
eventfd
you can pretty much do anything and wait for anything you want with eventfd
there is also signalfd so you can get SIGINT in a poll instead of the signal_handlers but i dont think it syscall wrapper in libc
>>
>>107824468
>poll is retarded
go back >>>/r/eddit
>>
>>107824559
>muh libc
use case?
>>
>>107824365
>epoll
linux specific, not posix
>>
>>107824473
you clearly are illiterate
>>
>>107824559
>pidfd
linux specific
>eventfd
linux specific
>>
>>107824600
or maybe disregard my post, this thread seems to be linux specific anyways
>>
>>107824611
Ye hope you will learn that writing cross platform programs is a lie and you're a buffoon for believing it.
>>
>>107824592
and?
>>
>>107824627
You're illiterate.
>>
>>107824592
yes i am, im self taught
i came to this thread to prompt you for knowledge kek
that does sound liek the process is passed to the scheduler and sleeps until theres a change in the fd
>>
>>107824624
My program works on linux, freebsd, openbsd, macos and haiku so I guess its working fine. But how the fuck was macos "unix certified" or whatever and claim to be posix compatible when it didn't even support clock_gettime until relatively recently
>>
>>107824629
so?
>>
>>107824636
*though
>>
>>107824650
Why so mad bro? it works fine in my case because I dont have to deal with a billion file descriptors. I just need to know when a few are readable/writable.
>>
>>107824659
>>107824650
but also I do get frequently people that ask me for support for other OS' in my other application that does some linux specific things (such as reading /proc)
>>
>>107824659
Because if I was an unironic memebsd user I'd want you to use kqueue instead of poll, just like as a Linux user I want you to use epoll or maybe io_uring, you stupid jeet.
>>
>>107824476
>>107824559
Not POSIX.
>>
>>107824810
nobody cares, software that only restricts itself to poosix is jeetslop and you should kill yourself
>>
>>107824810
>posix only software
use case?
>>
>>107824813
>you should kill yourself
I won't.

>>107824940
Portability.
>>
>>107824813
be nice
>>
#define __NR_lstat                6
>>
>>107827400
:)



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