Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.7k views
in Technique[技术] by (71.8m points)

why is the meaning of macro `-ENOSYS` in glibc?

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...