From owner-freebsd-hackers@FreeBSD.ORG Fri Apr 27 13:40:24 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 39A551065670; Fri, 27 Apr 2012 13:40:24 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 112718FC16; Fri, 27 Apr 2012 13:40:24 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 81125B91C; Fri, 27 Apr 2012 09:40:23 -0400 (EDT) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Fri, 27 Apr 2012 09:40:14 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p13; KDE/4.5.5; amd64; ; ) References: <4F9A5116.6080908@embedded-brains.de> In-Reply-To: <4F9A5116.6080908@embedded-brains.de> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201204270940.14939.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 27 Apr 2012 09:40:23 -0400 (EDT) Cc: Sebastian Huber , Robert Watson Subject: Re: thread0 usage in syncache_socket() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Apr 2012 13:40:24 -0000 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