[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YRGP3DR8f6ZEvn/P@kernel.org>
Date: Mon, 9 Aug 2021 17:28:12 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Riccardo Mancini <rickyman7@...il.com>
Cc: Ian Rogers <irogers@...gle.com>,
Namhyung Kim <namhyung@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Jiri Olsa <jolsa@...hat.com>, linux-kernel@...r.kernel.org,
linux-perf-users@...r.kernel.org
Subject: Re: [PATCH] perf bench: add benchmark for evlist open/close
operations
Em Mon, Aug 09, 2021 at 05:23:31PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Mon, Aug 09, 2021 at 10:11:02PM +0200, Riccardo Mancini escreveu:
> > +static struct evlist *bench__create_evlist(char *evstr)
> > +{
> > + struct evlist *evlist;
> > + struct parse_events_error err;
> > + int ret;
> > + evlist = evlist__new();
> > + if (!evlist) {
> > + pr_err("Not enough memory to create evlist\n");
> > + return NULL;
> > + }
> > + bzero(&err, sizeof(err));
> man bzero
>
> The bzero() function is deprecated (marked as LEGACY in POSIX.1-2001); use memset(3) in new programs. POSIX.1-2008 removes the specification of bzero(). The bzero() function first appeared in 4.3BSD.
> I'm replacing it with a memset().
This one is also equivalent:
tools/perf/tests/pmu-events.c: struct parse_events_error error = { .idx = 0, };
https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html
That text is a bit roundabout, as it says that the members that are not
explicitely initialized will be initialized as variables with static
storage duration, i.e. zeroed.
- Arnaldo
Powered by blists - more mailing lists