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, 20 Apr 2020 22:16:09 -0500
bijan tabatabai <bijan311@xxxxxxxxx> wrote:

> > 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?

Not a stupid question at all.

The way to check is to call the system call and see if it works. If it
doesn't simply fall back to the original behavior (to have the user do the
Ctrl^C). A system call should error (errno) with -ENOSYS, if the kernel
does not support the system call.

As I stated, the pidfd is a new feature, but so is stopping trace-cmd when
the pids end. This wouldn't be a regression. It is just an enhancement if
the kernel supports it, which there's lots of other cases in trace-cmd that
does the same thing (add features depending on support of the kernel).

-- Steve



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

  Powered by Linux