[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140826130820.GA3330@kernel.org>
Date: Tue, 26 Aug 2014 10:08:20 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Namhyung Kim <namhyung@...il.com>
Cc: Jiri Olsa <jolsa@...hat.com>, linux-kernel@...r.kernel.org,
Adrian Hunter <adrian.hunter@...el.com>,
Borislav Petkov <bp@...e.de>,
Corey Ashford <cjashfor@...ux.vnet.ibm.com>,
David Ahern <dsahern@...il.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Ingo Molnar <mingo@...nel.org>,
Jean Pihet <jean.pihet@...aro.org>,
Jiri Olsa <jolsa@...nel.org>,
Paul Mackerras <paulus@...ba.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: Re: [PATCH 10/10] tools lib api: Adopt fdarray class from perf's
evlist
Em Tue, Aug 26, 2014 at 04:46:18PM +0900, Namhyung Kim escreveu:
> Hi Arnaldo,
>
> On Fri, 22 Aug 2014 17:59:50 -0300, Arnaldo Carvalho de Melo wrote:
> > +int fdarray__add(struct fdarray *fda, int fd)
> > +{
> > + /*
> > + * XXX: 64 is arbitrary, just not to call realloc at each fd.
> > + * Find a better autogrowing heuristic
> > + */
> > + if (fda->nr == fda->nr_alloc &&
> > + fdarray__grow(fda, 64) < 0)
> > + return -ENOMEM;
> > +
> > + fcntl(fd, F_SETFL, O_NONBLOCK);
> > + fda->entries[fda->nr].fd = fd;
> > + fda->entries[fda->nr].events = POLLIN | POLLERR | POLLHUP;
> > + fda->nr++;
> > + return 0;
> > +}
>
> To be more generic api, I think it'd be better receiving events from
> user rather than hard-coding. Also it might be useful to let user
Agreed, will do.
> sets a grow hint (during init?) as well.
Sure, that can be done as well, and with that, ditch that hard coded
value.
Thanks,
- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists