This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Introduce tids cache for dwfl_getthreads


On Mon, 16 Dec 2013 16:24:26 +0100, Mark Wielaard wrote:
> On Mon, 2013-12-16 at 15:07 +0900, Masatake YAMATO wrote:
> > dwfl_getthreads can be called once for the same Dwfl object.  In
> > dwfl_getthreads, directory entries under /proc/$pid/tasks are
> > traversed and the directory descriptor points the end of
> > /proc/$pid/tasks. Even if dwfl_getthreads called again, no
> > more directory entry can be read from the descriptor.
> 
> Yes, that seems like a bug indeed.

This all changed from the original design and it is true this issue has been
forgotten.


> --- a/libdwfl/linux-pid-attach.c
> +++ b/libdwfl/linux-pid-attach.c
> @@ -164,6 +164,9 @@ pid_next_thread (Dwfl *dwfl __attribute__
> ((unused)), void *
>  {
>    struct pid_arg *pid_arg = dwfl_arg;
>    struct dirent *dirent;
> +  /* Start fresh on first traversal. */
> +  if (*thread_argp == NULL)
> +    rewinddir (pid_arg->dir);
>    do
>      {
>        errno = 0;

I also find this patch somehow more suitable / good enough.


Thanks,
Jan

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]