On Tue, Apr 27, 2021 at 08:14:05AM +0300, Amir Goldstein wrote: > 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? > > > > 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. OK, fair. > 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? Not necessarily, but you're right, the ordering doesn't really matter too much. /M