Re: [PATCH 09/10] logger: add process --id=parent optional argument

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

 



On Tue, Jul 22, 2014 at 11:00:58PM +0100, Sami Kerola wrote:

> +	unsigned int	parent:1,

  ppid : 1

> +			rfc5424_time:1,
>  			rfc5424_tq:1,
>  			rfc5424_host:1;
>  };
> @@ -281,15 +282,29 @@ static char *xgetlogin()
>  	return cp;
>  }
>  
> +static pid_t get_process_id(struct logger_ctl *ctl)
> +{
> +	pid_t id = 0;
> +
> +	if (ctl->logflags & LOG_PID) {
> +		if (ctl->parent)
> +			id = getppid();
> +		else
> +			id = getpid();

  id = ctl->ppid ? getppid() : getpid();

 :-)

> -	fputs(_(" -i, --id              log the process ID too\n"), out);
> +	fputs(_(" -i, --id[=parent]     log the [parent] process ID too\n"), out);

 what about:

              -i, --id[=pid|ppid]   log PID or PPID (default is PID)


 I think it's more robust and readable when you can specify also
 default setting in scripts.

 And please, don't use "parent" in code and in the man page. It's
 confusing. It's PID and PPID. 


 (I personally don't like "process ID" too, "PID" is the term.)

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux