ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: debian, lfs, whatever else i need in qemu
Posts: 268
Rep:
Confirmed on debian too. Peculiar. If you add time.sleep(1) before that it'll use select(0,0,0,0,[1,0]) instead of nanosleep in linux. But where does it pull the time in clock_gettime/gettimeofday format i wonder?
Distribution: debian, lfs, whatever else i need in qemu
Posts: 268
Rep:
If you run it with ltrace(warning: LOTS of data would be printed) you can actually see clock_gettime() there BUT it's not coming up in strace, which doesn't seem right.
Distribution: debian, lfs, whatever else i need in qemu
Posts: 268
Rep:
Quote:
Originally Posted by syg00
Code:
man vdso
Thanks man, learned something new today. I thought it's gotta be somehow mapped onto memory otherwise it can't be explained but I've never heard of vdso before.
i read man vdso but i didn't get much out of it besides it saying strace won't show it. i'm still curious how this code manages to get the time value. i assume it does not do that expensive INT (or its equivalent on other architectures). is it doing a virtual memory trap and code in the kernels handles a vdso memory trap specially to copy the time value into some designated place like a place in the vdso or some register?
Distribution: debian, lfs, whatever else i need in qemu
Posts: 268
Rep:
Yeah, that's what it basically says. You'll have to study vdso code to figure out more but it's only natural it's some kind of map that's probably doesn't have any overhead until queried to be read out from userlevel.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.