On Tue, Apr 16, 2019 at 10:17:13AM -0700, Stanislav Fomichev wrote:
> On 04/16, Jiri Olsa wrote:
> > Moving file specific code in dso_cache__read function
> > into separate file_read function. I'll add bpf specific
> > code in following patches.
> > 
> > Link: http://lkml.kernel.org/n/tip-7f7d717uzrqt5ka2xp29i...@git.kernel.org
> > Signed-off-by: Jiri Olsa <jo...@kernel.org>
> > ---
> >  tools/perf/util/dso.c | 47 ++++++++++++++++++++++++-------------------
> >  1 file changed, 26 insertions(+), 21 deletions(-)
> > 
> > diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
> > index cb6199c1390a..6baad22ec8a9 100644
> > --- a/tools/perf/util/dso.c
> > +++ b/tools/perf/util/dso.c
> > @@ -794,6 +794,30 @@ dso_cache__memcpy(struct dso_cache *cache, u64 offset,
> >     return cache_size;
> >  }
> >  
> > +static ssize_t file_read(struct dso *dso, struct machine *machine,
> > +                    u64 offset, char *data)
> > +{
> > +   ssize_t ret;
> > +
> > +   pthread_mutex_lock(&dso__data_open_lock);
> > +
> > +   /*
> > +    * dso->data.fd might be closed if other thread opened another
> > +    * file (dso) due to open file limit (RLIMIT_NOFILE).
> > +    */
> > +   try_to_open_dso(dso, machine);
> > +
> > +   if (dso->data.fd < 0) {
> > +           dso->data.status = DSO_DATA_STATUS_ERROR;
> pthread_mutex_unlock(&dso__data_open_lock) here?

oops, yea.. thanks

jirka

Reply via email to