Subject: Re: where is select() function....
To: Randazzo, Michael <RANDAZZO@ddc-web.com>
From: Rui Paulo <rpaulo@NetBSD.org>
List: tech-kern
Date: 06/15/2005 18:13:09
On 2005.06.15 14:04:04 +0000, Randazzo, Michael wrote:
> is sys_select the same as "select"  how does the system link them?

When you use that function in your C programs, you first go to the 
libc select:
$ nm /lib/libc.so | grep select
0001db04 W _pselect
0001da98 W _select
0001db04 T _sys_pselect
0001da98 T _sys_select
0001db04 W pselect
0001da98 W select

And after that, libc will transfer the control of execution to the kernel
where you have the sys_select/sys_pselect system calls.
$ gdb -q /lib/libc.so
(no debugging symbols found)...(gdb) disassemble select
Dump of assembler code for function select:
0x1da98 <select>:       mov    $0x5d,%eax
0x1da9d <select+5>:     int    $0x80
[...]

If you want to know more about how this stuff works, I suggest
you read http://www.int80h.org/bsdasm/.

-- 
Rui Paulo