Re: [PATCH 2/2] fanotify: Add pidfd support to the fanotify API

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

 



On Tue, Apr 27, 2021 at 6:35 AM Matthew Bobrowski <repnop@xxxxxxxxxx> wrote:
>
> On Mon, Apr 26, 2021 at 02:11:30PM +0300, Amir Goldstein wrote:
> > > Amir, I was just thinking about this a little over the weekend and I
> > > don't think we discussed how to handle the FAN_REPORT_PIDFD |
> > > FAN_REPORT_FID and friends case? My immediate thought is to make
> > > FAN_REPORT_PIDFD mutually exclusive with FAN_REPORT_FID and friends,
> > > but then again receiving a pidfd along with FID events may be also
> > > useful for some? What are your thoughts on this? If we don't go ahead
> > > with mutual exclusion, then this multiple event types alongside struct
> > > fanotify_event_metadata starts getting a little clunky, don't you
> > > think?
> > >
> >
> > The current format of an fanotify event already supports multiple info records:
> >
> > [fanotify_event_metadata]
> > [[fanotify_event_info_header][event record #1]]
> > [[fanotify_event_info_header][event record #2]]...
> >
> > (meta)->event_len is the total event length including all info records.
> >
> > For example, FAN_REPORT_FID | FAN_REPORT_DFID_MAME produces
> > (for some events) two info records, one FAN_EVENT_INFO_TYPE_FID
> > record and one FAN_EVENT_INFO_TYPE_DFID_NAME record.
>
> Ah, that's right! I now remember reviewing some patches associated
> with the FID change series which mentioned the possibility of
> receiving multiple FID info records. As the implementation currently
> stands, AFAIK there's not possibility for fanotify to ever return more
> than two info records, right?
>

Right.
Record types FAN_EVENT_INFO_TYPE_DFID_NAME and
FAN_EVENT_INFO_TYPE_DFID are mutually exclusive.

> > So I see no problem with combination of FAN_REPORT_FID
> > and FAN_REPORT_PIDFD.
>
> OK.
>
> Is there any preference in terms of whether the new FAN_REPORT_PIDFD
> info records precede or come after FAN_REPORT_FID/FAN_REPORT_DFID_NAME
> info records in FAN_REPORT_FID or FAN_REPORT_FID |
> FAN_REPORT_DFID_NAME configurations?
>

Doesn't matter.
Your typical application would first filter by pid/pidfd and only if process
matches the filters would it care to examine the event fid info, correct?
So you go first :)

Thanks,
Amir.



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux