previous: >>108066842#define __NR_nanosleep 35#define __NR_clock_nanosleep 230https://man7.org/linux/man-pages/man2/nanosleep.2.htmlhttps://man7.org/linux/man-pages/man2/clock_nanosleep.2.htmlhttps://man7.org/linux/man-pages/man3/timespec.3type.htmli actually have a personal vendetta against this syscall (nanosleep). previously, i have played around with writing syscalls in pure assembly. for whatever reason, i could not get this one to work. i don't know if i am just retarded or what, but it seemed like no matter what i did, i couldn't get it to accept my arguments and sleep... or actually, maybe it was clock_nanosleep. i don't remember. either way, couldn't get it to work. which is unfortunate, because the api really isn't all that complicated. if anyone else can get it to work (and actually execute correctly), i would be really interested to see it. i can't imagine what i was doing wrong...aside from that, great syscalls! use them all the time. i'm a fan of the classic sleep-assisted printf debugging, although these days i generally try to raise(SIGSTOP) instead. but the sleeps are nice for when it's multi-threaded stuff relevant 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_nanosleep 35#define __NR_clock_nanosleep 230
man man
man syscalls
nanodesu
>>108075578>sleep-assisted printf debuggingwth?care to expand on that?
I love autistic stuff like this. I love standards.
>I just slept 5 nanoseconds as you wanted
>>108075720what part don't you understand?
>>108076939lol no i put it at like a really huge numbermaybe i was off by a factor of 1000 or something though
>>108077163all of fucking iti googled this shit and i refuse to believe you dont know that if you fprinf to stderr your printf is then unbufferedso i asked youdont act hoighty toighty with me autismo trashi asked you a fucking question, politelybe polite in return
>>108075720people who refuse to use debuggers and inspect their variables.also very quick sleepsort implementation to troll algorithm coomers.
wtf is sleep-assisted printf debugging? why would you need to sleep?
>>108077364>people who refuse to use debuggers and inspect their variables.im in that category, because why even learn a whole other framework, if (f)printf can provide exactly the sameits just that i refuse that an anon who's all about fukken syscalls doesnt know that stderr is unbufferedits like- someone tells, and SHOWS you they can runbut they cant fucking walk?how?i must be missing something- thats my logicso i asked my question>no, the autismo rabble has to be passive aggressiveand im not passive aggressive because im not a faggotwhen people start raising hands, i pull out the gat and spray everyone including the passer-bys because i have poor sight
>>108077220>>108077379i even said in the OP lol. it's good for multi-threaded stuff. or for example if i want to ll /proc/<pid>/fd/ or /proc/<pid>/task/, or cat /proc/<pid>/maps. that sort of thing. but also like i mentioned in the OP, i usually just raise SIGSTOP these days so i don't have to rush as muchthe printf isn't necessarily the critical part here. maybe that's what was causing some of the confusion?
>coding thread on nocoder board>filled with posts by retarded nocodersroflmaoin Rust this is juststd::thread::sleep(std::time::Duration::from_nanos_u128(1001))
std::thread::sleep(std::time::Duration::from_nanos_u128(1001))
>>108077421fucking 4 hours, anonyou make a thread and then orphan it for 4 hours?what the fuckyou know what?ima get some kushnow YOU waituntil then youre a faggot
>>108075578Maybe the ABI for time values is quite fucked because Y38K required extending time values from 32 to 64 bits.
>>108077460Wow so simple!
>>108077506i have shit to do generally :<
>>108075578I don't ever write asm but this is all I got lol```.text.global _start_start: pushq $500000000 pushq $1 mov %rsp, %rdi mov $35, %eax # syscall SYS_nanosleep syscall```it sleeps but it segfaults lmao and I can't spend much more time on it today.
>>108077803sorry for being harsh thenbut still, 4 hours is quite exaggeratedits impolite in a good measureaka- not nice. not nice at allon the other handyoure sure you didnt use usleep to just force switching contexts?because i did something of the sort, and thats inelegant as fuck its literally rude to the os because you have other tools at your disposal, and youre forcing it to follow a time based pattern as opposed to a process based pattern.afaik.also also:arent signals slow?i didnt benchmark thembut maybe you did...even though sigstop does seem like a canonical solution...its literally in the name, youre using it exactly for the usecase thats written on the tin
>>108075578gamedev herei use this syscall exclusively for all thread sleeping since it supports such a wide range of time with exreme resolutionthat being said timespec_t is not intuitive and i write in C not ASM
>>108078418>timespec_t is not intuitivewrong
>>108078248I like these threads and would be sad if they stopped showing up before dinner time because OP is too busy to promptly answer questionsThis part of the 4chins etiquette is not known to me
>no caps>unnecesary cursing>WhAT abOuT PolItneSsWhat a cunt.
bampu
>>108078229>but it segfaultsyou need to exit from _start
>>108079100should've clocked in from the second message
>>108078229oh, i was trying to do mine without the stack
>>108081743or you can just let your program segfault to finish. who needs clean exits anyway