Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to find select() source code in glibc source?

I am trying to find the select() source code (Linux, i386 arch) in the glibc source code, but I cannot find anything that is related to the said architecture.

Could anybody point me to the select() source code?

like image 223
Xavier Bourvellec Avatar asked Feb 06 '26 08:02

Xavier Bourvellec


2 Answers

mh's answer is pretty good, but I will try to be more specific:

select is Linux system call, not libc function. It's source code could be found here.

libc has only wrapper for calling (executing) linux system call. Wrapper for select syscall is created on the fly at build time, because select is in syscalls.list file.

like image 178
Marko Kevac Avatar answered Feb 07 '26 20:02

Marko Kevac


select() is not a function of the libc, but a kernel function, so you need to take a look into the kernel source.

You can tell this by looking into the man page: If it is in section 2, it's a kernel function, if it's in section 3, it's a function of the standard C library, in your case the glibc.

Edit: Like some other people remarked correctly (thank you!), a function described in section 2 is officially called a system call and it is actually a call to a library that wraps the operating system's actual call interface.

like image 29
mh. Avatar answered Feb 07 '26 22:02

mh.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!