Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 02 Jul 2003 08:55:09 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Sandeep Kumar Davu <sdavu@kent.edu>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Writing a new (socket ) system call
Message-ID:  <3F03005D.9B82593D@mindspring.com>
References:  <3F0C1D56@webmail.kent.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
Sandeep Kumar Davu wrote:
> I am scanning throug the freeBSD source code and wanted to know somethin about
> the bind system call. I could follow through the code till sobind and after
> that pru_bind routine is called in uipc_socket.c. Then suddenly in
> tcp_usrreq.c there is tcp_usr_bind. I am wondering how these 2 can be related.
> I think i am missing something. i wanted it because I am writing a new system
> call that has to navigate to the tcp_usrreq.c. Can anyone help me out with
> this. It would be of great help if u can do so.

Most likely you can accomplish what you want to accomplish without
adding a new system call.

If you insist on adding a system call, the code to do so will be
rather complex, and involve not only extending a number of data
structures, which will require recompiling everything to add another
pru_* entry, it will involve adding stub functions in uipc_*, and,
possibly, a default implementation for all protocols that have to
deal with it.  Add to that you will need to allocate a system call
slot and (potentially) a struct fileops entry, and you can see that
you will not only be touching a lot of the system, you will be
making your implementation binarily incompatible with third party
code.

If you can do it as a socket option (search for "SOPT" in tcp_usrreq.c)
then I'd really advise you to do that, instead.

-- Terry



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F03005D.9B82593D>