lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YBwKKVRN1M8glFyN@krava>
Date:   Thu, 4 Feb 2021 15:52:25 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     Jiri Olsa <jolsa@...nel.org>, lkml <linux-kernel@...r.kernel.org>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Ingo Molnar <mingo@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Namhyung Kim <namhyung@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Michael Petlan <mpetlan@...hat.com>,
        Ian Rogers <irogers@...gle.com>,
        Stephane Eranian <eranian@...gle.com>,
        Alexei Budankov <abudankov@...wei.com>
Subject: Re: [PATCH 08/24] perf daemon: Add background support

On Wed, Feb 03, 2021 at 06:16:11PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Sun, Jan 31, 2021 at 12:48:40AM +0100, Jiri Olsa escreveu:
> > Adding support to put daemon process in the background.
> > 
> > It's now enabled by default and -f option is added to
> > keep daemon process on the console for debugging.
> > 
> > Signed-off-by: Jiri Olsa <jolsa@...nel.org>
> > ---
> >  tools/perf/builtin-daemon.c | 66 +++++++++++++++++++++++++++++++++++--
> >  1 file changed, 63 insertions(+), 3 deletions(-)
> > 
> > diff --git a/tools/perf/builtin-daemon.c b/tools/perf/builtin-daemon.c
> > index d0a0a998e073..324666058842 100644
> > --- a/tools/perf/builtin-daemon.c
> > +++ b/tools/perf/builtin-daemon.c
> > @@ -488,6 +488,13 @@ static void daemon__kill(struct daemon *daemon)
> >  	daemon__signal(daemon, SIGTERM);
> >  }
> >  
> > +static void __daemon__free(struct daemon *daemon)
> > +{
> > +	free(daemon->config_real);
> > +	free(daemon->config_base);
> > +	free(daemon->base);
> > +}
> 
> Please use zfree(), and also please rename it to __daemon__delete(), in
> other cases this pattern would be daemon__exit(), as the daemon
> structure itself is not being freed, just its members, ditto for
> foo__new() calling foo__init().

ok, will change

SNIP

> >  static int __cmd_start(struct daemon *daemon, struct option parent_options[],
> >  		       int argc, const char **argv)
> >  {
> > +	bool foreground = false;
> >  	struct option start_options[] = {
> > +		OPT_BOOLEAN('f', "foreground", &foreground, "stay on console"),
> 
> 
> You forgot to add the entry to the man page

it's in the man page patch later in the patchset

thanks,
jirka

> 
> >  		OPT_PARENT(parent_options),
> >  		OPT_END()
> >  	};
> > @@ -667,6 +716,17 @@ static int __cmd_start(struct daemon *daemon, struct option parent_options[],
> >  	if (setup_server_config(daemon))
> >  		return -1;
> >  
> > +	if (!foreground) {
> > +		err = go_background(daemon);
> > +		if (err) {
> > +			/* original process, exit normally */
> > +			if (err == 1)
> > +				err = 0;
> > +			__daemon__free(daemon);
> > +			return err;
> > +		}
> > +	}
> > +
> >  	debug_set_file(daemon->out);
> >  	debug_set_display_time(true);
> >  
> > -- 
> > 2.29.2
> > 
> 
> -- 
> 
> - Arnaldo
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ