--check option seems not to work from su(1) as daemon user

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2014-08-26 at 07:18 -0600, Glenn Golden wrote:
> Here are some pre-questions that I'll need to understand before even starting
> to tackle the Wiki description of the runtime dirs and pid files:
> 
> ============================================================================
> * --start:
>     "Start PulseAudio if it is not running  yet. This  is different from 
>      starting PulseAudio without --start which would fail if PA is already
>      running."
> 
>   Q1: What is the semantic distinction between those two sentences?  
>       Parsing straightforwardly seems to lead to this:
> 
>       If (--start option is specified on cmdline)
>       {
> 	if (PA is not running)		
> 	{
> 	    Start PA;
> 	}
> 	else			# PA is running
> 	{
> 	    Don't start PA;	# What exit code is supplied?

Zero.

> 	}
>       }
> 
>       else			# PA is not specfied on cmdline
>       {
> 	if (PA running)
> 	{
> 	    Don't start PA, and return nonzero exit code;
> 	}
> 	else			# PA is not running
> 	{
> 	    Start PA;
> 	}
>      }
> 
>      But the outer if/else seem to have no distinction between them, other
>      than (perhaps) the exit code supplied by the top clause may differ from
>      the explicitly nonzero error code of the bottom clause. Is there any other
>      difference?

No, the exit code is the only significant difference.

> 
>   Q2: In the above pseudocode, how are the tests for running-ness performed?

It's done by creating the pid file. pa_pid_file_create() returns -1, 0
or 1 depending on whether the creation failed due to an error (-1), the
creation succeeded (0) or the creation failed due to there being already
a daemon running (1).

>   Q3: Related to Q2 and Q7 below: What if there are multiple PAs running,
>       some of which may have been started with --use-pid-file=0?.  Are these
>       non-PIDfile-d PA's included in the notion of "running" as used in
>       the above --start option description?

Gah, I wasn't aware of this silly option... No, the daemons started with
--use-pid-file=0 are invisible to the --start logic.

> ============================================================================
> * --kill:
>   "Kill an already running PulseAudio daemon of the calling user.
>    (Equivalent to sending a SIGTERM)."
> 
>   Q4: (Ok, this not really a question but an obsevation): The same ambiguity
>       issue exists here as for --check, i.e regarding which PA daemon is being
>       referred to, and what "calling user" might mean. Whatever way I wind up
>       solving the doc issue for --check will have to be applied here as well.

True.

> ============================================================================
> * --daemonize[=BOOL]
>   "Daemonize after startup, i.e. detach from the terminal." 
> 
>   Q5: Is there any interaction between this option and the creation (or not)
>       of a PID file?  I.e., if --daemonize=0, does it still create a pid file?
>   
>       Please tell me the answer to the latter question is "yes", otherwise
>       I'm going to have to start drinking heavily because it will roughly
>       quadruple the complexity of what I need to describe in the Wiki writeup.
> 
>       (So you should feel free to lie to me about it and say "yes", lol...)

The answer is "yes", and I don't lie, I promise :)

> ============================================================================
> * --use-pid-file=[BOOL]
>   "Create a PID file. If this options is disabled it is possible to run
>    multiple sound servers per user."
> 
>   Q6: Suppose one or more PA daemons have been started with --use-pid-file=0
>       (hence there are no pid files corresponding to these daemon processes.)
>       In this case, is it possible to use --kill or --check to refer to such
>       daemon process(es)? [Quick experiments seem to indicate answer is "no"]

The answer is indeed "no".

>   Q7: Same as Q7, but w.r.t. "--start" option: How is the "--start" pseudocode
>       in Q1 affected by the possible presence of running PA daemon(s) that have 
>       no associated PID file(s)?

Daemons without pid files are invisible to the --start logic.

-- 
Tanu



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux