Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Oct 2014 22:00:50 +0200
From:      Polytropon <freebsd@edvax.de>
To:        freebsd-questions@freebsd.org
Cc:        Lowell Gilbert <freebsd-questions-local@be-well.ilk.org>
Subject:   Re: exiting Xorg locks up 9.2-STABLE system
Message-ID:  <20141015220050.337de77d.freebsd@edvax.de>
In-Reply-To: <44tx35w4ix.fsf@be-well.ilk.org>
References:  <20141015162547.GJ3963@itcom245.staff.itd.umich.edu> <20141015185327.4fc2590d.freebsd@edvax.de> <44tx35w4ix.fsf@be-well.ilk.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 15 Oct 2014 14:51:02 -0400, Lowell Gilbert wrote:
> Polytropon <freebsd@edvax.de> writes:
> 
> > On Wed, 15 Oct 2014 12:25:47 -0400, William Bulley wrote:
> >> According to Polytropon <freebsd@edvax.de> on Wed, 10/15/14 at 12:18:
> >> > 
> >> > The last line of your ~/.xinitrc file should be:
> >> > 
> >> > 	exec /usr/local/bin/mwm
> >> > 
> >> > This makes sure that the process "continues" as mwm, and when
> >> > mwm exits, then X also exists.
> >> 
> >> Thanks.  The last line of my ~/.xinitrc file is:
> >> 
> >>    /usr/local/bin/mwm 2>&1 /dev/null
> >> 
> >> and since I start Xorg thusly:
> >> 
> >>    /usr/local/bin/xinit -- /usr/local/bin/Xorg
> >> 
> >> I had thought when I exit mwm(1) using the "f.quit_mwm" feature,
> >> that then Xorg would exit.  Is that not the case?  Or am I missing
> >> your point above?  This configuration has been working for me for
> >> about fifteen years.   :-)
> >
> > Interesting, but it's not what The FreeBSD Handbook suggests
> > and what _I_ have been using for about fifteen years. :-)
> >
> > The "exec" statement makes the xinit process "continue" as
> > the window manager process. Its f.quit_mwm function exits
> > the mwm program, but that does not have any effect on the
> > X session - the session continues without a window manager
> > (which is possible). Only if the X process is "connected"
> > to the window manager process using "exec", it will exit,
> > and so quit the X session entirely.
> 
> Without "exec", the windows manager is running as a subprocess of
> shell executing the .xinitrc file. When it exits, the shell continues,
> runs the shell input to completion, and the shell process terminates,
> which also terminates the X server session. 
> 
> In other words, either way will work fine as far as this situation is
> concerned. Using "exec" avoids having an extra process sticking around,
> which is slightly more efficient -- but keeps your .xinitrc from being
> able to do any custom cleanup after the window manager exits. I venture
> to say that only a vanishing few would ever notice the difference.

This is a very good description. :-)



> > This is what "init" or "startx" help to do: They source
> > the .xinitrc file and execute it. Its last line, the "exec"
> > statement, creates the "connection" between the X session
> > and the program which has control over its life, usually
> > the window manager - but it could also be an xterm, and
> > when _that_ xterm is closed, the X session terminates.
> > The line "exec /usr/local/bin/mwm" will do this.
> 
> There are several factual errors in here, although nothing that the
> original poster would need to know. It's mostly a matter of not properly
> conveying the concept of a child process, or of the fact that a parent
> process (in these cases) waits for its child process to complete before
> continuing on with its own business.

Yes, I didn't want to go too deeply into process chemistry,
but your description is fully correct. That's what I wanted
to express with "connection". :-)



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



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