Tue Jun 4 12:17:20 MDT 2013
> Actually, /usr/src/linux-2.2.12/net/socket.c, it looks like sys_bind() is a
> wrapper for bind()
> asmlinkage int sys_bind(int fd, struct sockaddr *umyaddr, int addrlen)
> err = sock->ops->bind(sock, (struct sockaddr *)address, addrlen);
> Too bad for me it wasn't the other way around!
But this is enough information to track down what you want. What's
happening here is that a call is being made to the more specific
function pointed to by the 'ops' structure of the socket.
So, if your question is, which function is that, and what does it look
like, it depends on what type of socket you're interested in.
I grepped for "sock->ops" and found that these functions are defined
in various places, including net/ipv4/af_inet.c. For example, if
you're interested in STREAM sockets, inet_create() sets sock->ops to
point to inet_stream_ops, which is defined further in the same file.
The result of this is that one of the many functions you might be
looking for is inet_bind(), also in af_inet.c.
If you were looking for the variation that handles UDP stuff,
inet_create() sets sock->ops to inet_dgram_ops, which also happens to
be pointing to inet_bind(). So apparently inet_bind() handles both
the TCP and the UDP cases.
You might also be interested in net/ipv6/af_inet6.c which contains the
inet6_bind() function. Or any of the others.
socket at peakpeak.com
More information about the LUG