Re: sock structure.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dronen,
	Thanks for ur reply. I am using kernel-2.2.15, but there is no
such sock_put function. All the other functions r there. Can you give some
idea for 2.2.x type of kernel?

Regards,

Saibal

> 
> This code is from 2.4.0-test13-pre4.
> 
> See, for example, the call to sock_put() (which calls sk_free())
> at the bottom of net/ipv4/tcp.c:tcp_close().  tcp_close() takes
> a struct sock as an argument and, when all is said and done, it
> frees it.
> 
>     bh_unlock_sock(sk);
>     local_bh_enable();
>     sock_put(sk);
> 
> tcp_close() is a member of struct proto tcp_prot, which is
> defined in net/ipv4/tcp_ipv4.c.  tcp_prot is assigned to
> sk->prot in net/ipv4/af_inet.c:inet_create().  
> 
> 	sk->prot = prot;
> 
> net/af_inet.c:inet_release() calls the close function
> of the struct sock's struct proto (sk->prot):
> 
> 	sk->prot->close(sk, timeout);
> 
> To wrap things up (for an AF_INET, SOCK_STREAM socket), the above
> line calls tcp_close(), which calls sock_put(sk), which calls
> sk_free().
> 
> Hope this helps.
> 
> Regards,
> 
> Nick Dronen

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux