Date: Thu, 27 Mar 2014 19:46:50 +0100 From: Mateusz Guzik <mjguzik@gmail.com> To: Warner Losh <imp@bsdimp.com> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, David Xu <davidxu@freebsd.org>, Mateusz Guzik <mjg@FreeBSD.org> Subject: Re: svn commit: r263755 - head/sys/kern Message-ID: <20140327184650.GC4730@dft-labs.eu> In-Reply-To: <54C6CC48-3B3B-412C-8C74-1A0A32534CC4@gmail.com> References: <201403252330.s2PNUaei052956@svn.freebsd.org> <5333D70D.7050306@freebsd.org> <20140327083730.GA22942@dft-labs.eu> <54C6CC48-3B3B-412C-8C74-1A0A32534CC4@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Mar 27, 2014 at 11:08:34AM -0600, Warner Losh wrote: > > On Mar 27, 2014, at 2:37 AM, Mateusz Guzik <mjguzik@gmail.com> wrote: > > > On Thu, Mar 27, 2014 at 03:45:17PM +0800, David Xu wrote: > >> I think the async process pointer can be cleared when a process exits > >> by registering an event handler. please see attached patch. > >> > > > > Sure, but I'm not very fond of this solution. > > > > This is a rather obscure bug you wont hit unless you explicitly try, > > and even then you need root privs by default. > > > > As such writing a callback function which will be executed for all exiting > > processes seems unjustified for me. > > > > Ideally we would get some mechanism which would allow to register > > callbacks for events related to given entity. Then it could be used to > > provide a "call this function when process p exits", amongst other things. > > I’m wondering why the FD isn’t getting closed and the close() routine being called > which should clear this pointer. Since we can only ever have one opener, we > know the close will always be called. > > What am I missing? Seems like an invented non-issue. > This happens if you set yourself as async_proc and fork (so the child has the fd as well) or pass the fd to some other process before exiting. As was noted, this is not the case with devd so no rush. -- Mateusz Guzik <mjguzik gmail.com>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140327184650.GC4730>