Re: [PATCH] trace-cmd: Stop recording when processes traced with -P exit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 20, 2020 at 9:31 PM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> > Hi Steve,
> >
> > > Won't that while loop just go into a spin?
> > >
> > > What about something like a fsnotify on a /proc/<pid>/ file?
> > >
> > > I rather have trace-cmd sleep and wake up when a task exits, than to do a
> > > spin. Like it does for the -F option.
> >
> > I just tried doing this using the inotify API and hit a snag.
> > It turns out inotify can't monitor pseudo-filesystems like /proc, so I
> > don't think that suggestion will work.
> >
> > What if I put a call to sleep in the loop?
> > It's not the most elegant solution, but that way it wouldn't be too
> > different from the current code that sleeps for 10 seconds after
> > checking if finished is set to true.
>
> Perhaps using the new pidfd interface may work here.
>
>   https://lwn.net/Articles/794707/
>
> It was added in 5.4 (which is still rather new), but this would be a
> new trace-cmd feature as well.
>
> -- Steve
>
This is a stupid question, but what would be the best way to use the
pidfd interface and also keep backwards compatibility with older
kernel versions?
Or is that not really a concern?

Bijan



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux