Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Jan 2020 11:42:44 +0000
From:      Steve O'Hara-Smith <steve@sohara.org>
To:        "Ronald F. Guilmette" <rfg@tristatelogic.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Independence of file descriptor flags across forks (or lack thereof)
Message-ID:  <20200108114244.b431a9ae0170ec947e6fb7d8@sohara.org>
In-Reply-To: <94417.1578474619@segfault.tristatelogic.com>
References:  <94417.1578474619@segfault.tristatelogic.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 08 Jan 2020 01:10:19 -0800
"Ronald F. Guilmette" <rfg@tristatelogic.com> wrote:

> Quite simply, I started some development work recently with the
> (apparently naive) belief that when a process forks, and its child
> process get its own "independent" copy of all of the file descriptors

	It does - but file descriptors are just integers - see the open
manpage.

> that are currently open in the parent process, the child would also get
> its own independent copy of the system-maintained "flags word" for each
> of those inherited file descriptor copies.

	The fork manpage tells you that the descriptors reference the same
underlying object. It is that object (the open file) which holds the "flags
word".

> So dear friends, I must ask you, am I delusional?  Is this all just some
> massive misunderstanding on my part?

	Yep.

-- 
Steve O'Hara-Smith <steve@sohara.org>



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