[PATCH v3 1/1] os: added the -upstart option for Upstart's signaling method.

Peter Hutterer peter.hutterer at who-t.net
Tue Jul 13 23:16:03 PDT 2010


On Wed, Jul 14, 2010 at 07:49:39AM +0300, Oliver McFadden wrote:
> This is very similar to the RunFromSmartParent (implicit) option, except
> we do not send the signal to our parent process, but our own process
> instead, and that signal is SIGSTOP, not SIGUSR1.
> 
> Upstart will detect this, realize that we are ready to accept clients
> now, send us SIGCONT and move our job status from SPAWNED to RUNNING.
> 
> Signed-off-by: Oliver McFadden <oliver.mcfadden at nokia.com>
> ---
> v3: resend patch because it seems to have been idle for some time...
>     - changed kill(getpid()) to raise().

this seems rather oddly named to me. Ok, upstart may use this one now but
are any of the proposed alternatives using similar methods? (systemd maybe?) 

might be better to use a more descriptive flag like "-sigstop" that
describes what we actually do instead of hooking it onto a caller's name.
solves two future problems: 
- if upstart changes the signaling method we don't have a need for a
  -upstart2, -upstart3 flag
- if others use similar methods, you don't have to start with -upstart for
  systemd
both outcomes would be rather confusing, imo.

Cheers,
  Peter

>  include/opaque.h |    1 +
>  os/connection.c  |    5 +++++
>  os/utils.c       |    5 +++++
>  3 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/include/opaque.h b/include/opaque.h
> index b3c7c70..f8c0000 100644
> --- a/include/opaque.h
> +++ b/include/opaque.h
> @@ -55,6 +55,7 @@ extern _X_EXPORT int defaultBackingStore;
>  extern _X_EXPORT Bool disableBackingStore;
>  extern _X_EXPORT Bool enableBackingStore;
>  extern _X_EXPORT Bool PartialNetwork;
> +extern _X_EXPORT Bool RunFromUpstart;
>  #ifndef NOLOGOHACK
>  extern _X_EXPORT int logoScreenSaver;
>  #endif
> diff --git a/os/connection.c b/os/connection.c
> index c143fb6..53f7f8c 100644
> --- a/os/connection.c
> +++ b/os/connection.c
> @@ -146,6 +146,8 @@ Bool NewOutputPending;		/* not yet attempted to write some new output */
>  Bool AnyClientsWriteBlocked;	/* true if some client blocked on write */
>  
>  static Bool RunFromSmartParent;	/* send SIGUSR1 to parent process */
> +Bool RunFromUpstart;		/* send SIGSTOP to our own process;
> +				   Upstart will send SIGCONT back. */
>  Bool PartialNetwork;	/* continue even if unable to bind all addrs */
>  static Pid_t ParentProcess;
>  
> @@ -357,6 +359,9 @@ NotifyParentProcess(void)
>  	    kill (ParentProcess, SIGUSR1);
>  	}
>      }
> +    if (RunFromUpstart) {
> +	raise (SIGSTOP);
> +    }
>  #endif
>  }
>  
> diff --git a/os/utils.c b/os/utils.c
> index 51455cc..f176af4 100644
> --- a/os/utils.c
> +++ b/os/utils.c
> @@ -527,6 +527,7 @@ void UseMsg(void)
>  #endif
>      ErrorF("-dumbSched             Disable smart scheduling, enable old behavior\n");
>      ErrorF("-schedInterval int     Set scheduler interval in msec\n");
> +    ErrorF("-upstart               Enable support for Upstart's signaling method\n");
>      ErrorF("+extension name        Enable extension\n");
>      ErrorF("-extension name        Disable extension\n");
>  #ifdef XDMCP
> @@ -922,6 +923,10 @@ ProcessCommandLine(int argc, char *argv[])
>  	    else
>  		UseMsg ();
>  	}
> +	else if ( strcmp( argv[i], "-upstart") == 0)
> +	{
> +	    RunFromUpstart = TRUE;
> +	}
>  	else if ( strcmp( argv[i], "+extension") == 0)
>  	{
>  	    if (++i < argc)
> -- 
> 1.7.1.245.g7c42e


More information about the xorg-devel mailing list