[lug] source for bind(int sockfd, struct sockaddr *my_addr, int addrlen)
Matt McIllece (1-3762)
mcillece at elbonia.ast.lmco.com
Wed Apr 18 17:51:01 MDT 2001
> That's because it's not in /usr/src. It's in /usr/include/sys.
<Blush> Oops, I got used to seeing everything in /usr/src. </Blush>
But while grepping in /usr/include does produce an interface for bind(), it
doesn't help find the implementation...
> I'm tempted to ask, which *kind* of bind()
> are you asking for? ipv4? ipv6?
Any generic bind() would do. I chose ipv4.
> I grepped for "sock->ops" and found that these functions are defined
> in various places, including net/ipv4/af_inet.c.
I did a lot of grepping under /usr/src for things like that, and I also did a
lot of hand searching under /usr/src/linux/net/. But in trying to cope with all
the info, I must have missed the significance of the
sock->ops = &inet_stream_ops;
assignment in the inet_create() part of /usr/src/linux/net/ipv4/af_inet.c. In
the same fashion as your inet_dgram_ops example, the inet_stream_ops structure
turns out to contain inet_bind() in place of (bind*). And as you said,
inet_bind() is defined in af_inet.c. Implementation found. Thanks!
More information about the LUG
mailing list