Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am studying pthread_mutex_lock, and find out pthread_mutex_lock will finally calls a macro lll_futex_timed_wait() in glibc(version 2.27), I download glibc source but it is shown that lll_futex_timed_wait() was defined as -ENOSYS, what is that mean and how to get it's real definition(it should be a system call, I also have gotten the source of linux kernel)?

//glibc-2.27/sysdeps/nptl/lowlevellock-futex.h

/* Wait until a lll_futex_wake call on FUTEXP, or TIMEOUT elapses.  */
#define lll_futex_timed_wait(futexp, val, timeout, private)             
  -ENOSYS
question from:https://stackoverflow.com/questions/65840531/why-is-the-meaning-of-macro-enosys-in-glibc

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.4k views
Welcome To Ask or Share your Answers For Others

1 Answer

A big chunk of glibc is comprised of system and architecture dependent bits under the sysdeps subtree. What you are looking at is a common stub which will only be compiled if the glibc is not properly configured for the specific platform build.

The actual implementation of the low level futex details in those older glibc releases will reside in sysdeps/unix/sysv/linux/lowlevellock-futex.h

Interestingly enough, in more recent glibc versions, the code was promoted to the "common" tree, so if you were to check glibc 2.32 for example, you will see this macro properly implemented in terms of system call.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...