Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1586948pxb; Thu, 4 Feb 2021 17:43:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJwCfbi+9/OKfE4x8A7nmLgIHY5VaIkkJvwP0DBgqVQ0F9/zs7+GSSn99vxsRTiEIwdf4ZS9 X-Received: by 2002:a05:6402:1b91:: with SMTP id cc17mr1335830edb.259.1612489431827; Thu, 04 Feb 2021 17:43:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612489431; cv=none; d=google.com; s=arc-20160816; b=JMXYJs2vD+biq31DvD+CI5qWzRdFjnQqgCauZyAWiz8MWdpAZc6HycS02gGsvr+txp QyL9Pv8/mq7s3ZHjNGMICiduPx52HEyYlEI7IkECy6PLI+jRKFAQm24yjl+NAf4zSlJn V8Ne4A9sAn7FHE3YP2TCt+q2lZSLYGSqLLITSouT7WN0MezwEVAgzHvIxLAXD3/quipQ jWmCWe++MwpMM4ABUrWwdYPoY5g+6zXsPp7umpHcx24a5jfj0uozlMAwJO++hXHXm9sB gFK5/BDvHGAixsQz4CB5PksCYgK6CXLb4IwmMb8UdibBWajNcXmIEGbn9hNQtmDzpCpF jX/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zAESHwW0WdZS/OpPzSsfCxam/5nXUCVRWHrWA65Cmj0=; b=v/xwBrn6fAil11n5WS4bZB9GRRzoyTocUzl1Ey4bSqw7zp9w6fdlXXljsWxgs4LRXT f5bKp59dlq+LmbYmBWoYTGsrvWVRB14kKW5mMC63+pcY9S7AROFB6EZ/WP4Z9QH4Kk9H EcpoHhsDcdd9CuIkdoT/bbYbLtKGMa4LrC61N71nL4f8Pk0ezoWPZ3IBWj/dI8X6fmmB yRTPVrTdSuGzSRHkPgevxV5tjH5H9MUfIp0LyVNLzXt1CAjvJ/h4C/ra4O3EwYHZjGAz l8ZQanew3jPKw4KcRW/yOz8ocoCYjSxkREYeFa6ENyjPEB1LjSUGuX81VSbXZJO/3wEu Sdlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bL9Azq2H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t1si4325959ejd.359.2021.02.04.17.43.27; Thu, 04 Feb 2021 17:43:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bL9Azq2H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239773AbhBDTao (ORCPT + 99 others); Thu, 4 Feb 2021 14:30:44 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:44923 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236945AbhBDOyA (ORCPT ); Thu, 4 Feb 2021 09:54:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612450353; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zAESHwW0WdZS/OpPzSsfCxam/5nXUCVRWHrWA65Cmj0=; b=bL9Azq2HJHfhyV2q98GSbHLzRJnTEA3Slp+6tjYLJMzyl0NXkJKq1oEmDW/i1LrdpR2xVW 6ed4pYvzaET5NE4Doxw5ow3qWUqkVRHIHsB/L7p3Ai9XRoa0QfvnVvlqm5/m6HrqMwpuz6 Kr/aems5TEX+3reMVkYzOE74t2FQuSY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-475-EBK9w85QO6SBYoI8R0sZ5Q-1; Thu, 04 Feb 2021 09:52:31 -0500 X-MC-Unique: EBK9w85QO6SBYoI8R0sZ5Q-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 41653100C615; Thu, 4 Feb 2021 14:52:29 +0000 (UTC) Received: from krava (unknown [10.40.194.33]) by smtp.corp.redhat.com (Postfix) with SMTP id BD78C19708; Thu, 4 Feb 2021 14:52:26 +0000 (UTC) Date: Thu, 4 Feb 2021 15:52:25 +0100 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Namhyung Kim , Alexander Shishkin , Michael Petlan , Ian Rogers , Stephane Eranian , Alexei Budankov Subject: Re: [PATCH 08/24] perf daemon: Add background support Message-ID: References: <20210129134855.195810-1-jolsa@redhat.com> <20210130234856.271282-1-jolsa@kernel.org> <20210130234856.271282-9-jolsa@kernel.org> <20210203211611.GU854763@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210203211611.GU854763@kernel.org> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > --- > > 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 >