lock_sock()

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

 



Hi,
 
I noticed that the TCP code (linux 2.2.14) locks the
socket (using lock_sock()) before doing a send
(tcp_do_sendmsg), and during a receive
(tcp_recvmsg).
Besides that, I have seen lock_sock() being called
at a number of other places in the TCP code.
 
Could someone please explain to me the working of
lock_sock(), and in what cases it should be called?

The reason I am looking at lock_sock is because I
have a project in which I create 2 INET sockets (say
s1
and s2), and each socket can receive data, that it
sends down through the other. For ex: s1 receives some
data, processes it, and sends it through s2, and vice
versa.
I think I have to lock the socket that I am sending
data down on, but am not too sure if I have to lock
the receiving socket as well.
Any help or tips would be very much appreciated.

Thanks,
Mahesh.


__________________________________________________
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.com/
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.rutgers.edu


[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