Socket programming question
keramida at ceid.upatras.gr
Wed Nov 14 17:13:32 PST 2007
On 2007-11-14 15:21, Andrew Falanga <af300wsm at gmail.com> wrote:
> My question has to do with how someone would find out if a call to
> socket(2) actually produced a socket. I know that the API works, I've
> programmed with it many times, but is there a way to find out if 's'
> returned by socket(2) is actually valid in whatever kernel structure
> it is stored? I understand that I may have the process entirely mixed
> up. But it seems to me that the socket is somehow known to the kernel
> and I should be able to query the kernel somehow and discover if it is
The socket() system call returns -1 when it fails. Isn't that
sufficient? If not, why? What ``extra'' information would you
expect from the kernel when socket() fails?
> Let me know if my question doesn't make sense as worded and I'll try
> to explain myself better. Another question related to this one, would
> someone in this list know where the source code is, in the system
> source tree, for the select call?
Look for kern_select() in `/usr/src/sys/kern/sys_generic.c'.
More information about the freebsd-questions