Date: Sun, 29 Jun 2003 16:36:03 -0700 From: "George V. Neville-Neil" <gnn@neville-neil.com> To: freebsd-net@freebsd.org Subject: Another question on locking... Message-ID: <87y8zkwj6k.wl@jchurch.neville-neil.com.neville-neil.com>
next in thread | raw e-mail | index | archive | help
Hi, Looking at the code in uipc_socket.c and udp_usrreq.c I am a bit confused as to how the locking mechanism works between the sockets and the protocols. The socket calls all occur under Giant, which the protocols do not deal with, and the protocols all lock on the inp mutex, which the socket calls do not deal with. Furthermore the sblock/sbunlock calls are only use by the socket layer. I'm reading udp_input() as it's simpler to follow. Have I missed something? What prevents a protocol from writing to a socket buffer at the wrong time or the socket code from tweaking it at the wrong time? Is this handled simply because of the priority of the threads doing the work? Thanks, George
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?87y8zkwj6k.wl>