Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Feb 2008 05:34:56 +0200
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        aora57@gmail.com
Cc:        FreeBSD-questions@freebsd.org
Subject:   Re: Where is connect?
Message-ID:  <20080226033456.GC2154@kobe.laptop>
In-Reply-To: <b0f1b5700802251823uaf84861vbf817b6b51ab9371@mail.gmail.com>
References:  <b0f1b5700802251823uaf84861vbf817b6b51ab9371@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2008-02-25 21:23, a arcadia <aora57@gmail.com> wrote:
> This is likely a silly question but where exactly is the source for
> connect?  Under /usr/src/lib/libc/sys there is connect.2 but  no
> connect.c, or any other socket functions for that matter.

It is a system call.  The userlevel part of system calls is,
traditionally, only a very thin wrapper around their kernel
counterparts.

If you look at `/usr/src/sys/kern/syscalls.master' you can see a line
which maps the connect(2) system call to the connect() kernel function:

% 98      AUE_CONNECT     STD     { int connect(int s, caddr_t name, \
%                                     int namelen); }

The connect() function itself is easy to locate in src/sys/kern:

% keramida@kobe:/usr/src/sys/kern$ grep -n '^connect' *.c
% uipc_syscalls.c:501:connect(td, uap)
% keramida@kobe:/usr/src/sys/kern$

This is the entry point of the connect(2) system call.  Things go on
from this point into the network stack & protocol support code.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080226033456.GC2154>