Subject: RE: where is select() function....
To: Rui Paulo <rpaulo@NetBSD.org>
From: Randazzo, Michael <RANDAZZO@ddc-web.com>
List: tech-kern
Date: 06/15/2005 14:29:17
So the "libc" select function, which is the standard prototype for =
select, just passes everything
to the sys_select/sys_pselect functions....
How does it know which one to call?
Regards,=20
Mike=20
Michael J. Randazzo=20
Senior Applications Engineer=20
Data Device Corporation=20
105 Wilbur Place=20
Bohemia, NY 11716-2482=20
Voice: 800-DDC-1772 ext. 7321=20
Fax: 631-567-7358=20
Email: randazzo@ddc-web.com=20
Web: <http://www.ddc-web.com>=20
-----Original Message-----
From: Rui Paulo [mailto:rpaulo@NetBSD.org]
Sent: Wednesday, June 15, 2005 2:13 PM
To: Randazzo, Michael
Cc: tech-kern@netbsd.org
Subject: Re: where is select() function....
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=20
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/.
--=20
Rui Paulo