Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Apr 2012 09:40:14 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-hackers@freebsd.org
Cc:        Sebastian Huber <sebastian.huber@embedded-brains.de>, Robert Watson <rwatson@freebsd.org>
Subject:   Re: thread0 usage in syncache_socket()
Message-ID:  <201204270940.14939.jhb@freebsd.org>
In-Reply-To: <4F9A5116.6080908@embedded-brains.de>
References:  <4F9A5116.6080908@embedded-brains.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday, April 27, 2012 3:56:06 am Sebastian Huber wrote:
> Hi,
> 
> in syncache_socket() in tcp_syncache.c the global variable thread0 is used to 
> do a in6_pcbconnect() with the ucread of thread0.  Why is the thread0 used here 
> and not the one of the current thread?

The current thread is generally not all that interesting in this case.  Note that
this is used for building a socket that will be returned by accept(), not due to
a call to connect(), so the only credential establishing this connection would
be the user on the remote machine that opened the connection.  The current thread
for this call is typically an interrupt thread of some sort, but it can also be
a netisr thread, or a device driver taskqueue thread, etc.  thread0 gives a stable
credential to use for creating accepted connections.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204270940.14939.jhb>