[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: socket and device relation.
Hi Guillaume Thouvenin,
Just check my comments. If there is any mistake please
correct me.
On Friday 05 December 2003 17:44, Guillaume Thouvenin wrote:
> > I'm trying to understant exactly where network driver is involved during
> > the connection. So I start with a user program which do the following
> > things: socket, bind, listen and accept. This is now what I understand:
> >
> > - socket() called sys_socket()
> > - sys_socket()
> > -> sock_create()
>
> Ooops, it seems that my mail was posted before I finished my question. So I
> rewrite it.
>
> I'm trying to understant exactly where network driver is involved during
> the connection. So I start with a user program which do the following
> things: socket, bind, listen and accept. This is what I understand:
>
> call to socket cause a syscall to sys_socketcall which call:
> - sys_socket()
> -> sock_create()
> * check protocol
> * sock_alloc()
> allocate a new inode and a new socket object
missing an important function call here( I'm refer linux-2.4.20-8)
902 if ((i = net_families[family]->create(sock, protocol)) < 0)
====> net_families[family]->create()
In that protocol specific function (net_families[family]->create) the
sock->ops is initialized.
Eg :- inet_create function in SRC/net/ipv4/af_inet.c for ipv4 protocol.
360 sock->ops = answer->ops;
> -> sock_map_fd()
> * map the socket to a file descriptor
>
> So during the creation of the socket the driver is not involved.
> Now there is the binding:
>
> - sys_bind()
> * Just bind the name and the socket
>
> At this point there something that I don't understand:
> There is a call to
> sock->ops->bind(sock, (struct sockaddr *)address, addrlen);
>
> but I don't see where sock->ops is initialized and thus, I don't find
> the function bind. Is the binding involving the network driver.
>
> Thank you for help
Regards,
Shine Mohamed
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive: http://mail.nl.linux.org/kernelnewbies/
> FAQ: http://kernelnewbies.org/faq/
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/