Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Aug 2009 08:18:22 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-hackers@freebsd.org
Cc:        Dag-Erling =?utf-8?q?Sm=C3=B8rgrav?= <des@des.no>, Maslan <maslanbsd@gmail.com>, Max Laier <max@love2party.net>, Ed Schouten <ed@80386.nl>
Subject:   Re: sosend() and mbuf
Message-ID:  <200908060818.23158.jhb@freebsd.org>
In-Reply-To: <86ab2f34ay.fsf@ds4.des.no>
References:  <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <20090804093036.GN1292@hoeg.nl> <86ab2f34ay.fsf@ds4.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday 04 August 2009 12:57:25 pm Dag-Erling Sm=C3=B8rgrav wrote:
> Ed Schouten <ed@80386.nl> writes:
> > Maslan <maslanbsd@gmail.com> writes:
> > > However, when i checked the pid & tid of the new created thread it
> > > was not the same as the parent nor as the proc0 & thread0
> > I am not sure, but sharing another process's address space doesn't have
> > to imply it shares the same pid, right?
>=20
> The man page explicitly states that if no process is specified, the new
> thread is assigned to proc0, which has a valid filedesc table, valid
> creds etc., so this shouldn't be a problem.  However, he's getting a
> different PID, which shouldn't happen.  Either the man page is wrong, or
> things were different in 7.

proc0 does not have a fully valid file descriptor table.  It has a structur=
e,=20
but fd_[cjr]dir are not initialized to point at anything.  File descriptors=
=20
are a property of userland processes, not of kernel processes.  However,=20
fd_[cjr]dir need to be valid to perform any namei() lookup even if one is=20
simply going to do a vn_open() on the resulting vnode (which is more=20
approprate for kernel code to do, if it is to open a file at all).

=2D-=20
John Baldwin



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