From: Jan Kara <firstname.lastname@example.org> To: Nixiaoming <email@example.com> Cc: Jan Kara <firstname.lastname@example.org>, "email@example.com" <firstname.lastname@example.org>, Amir Goldstein <email@example.com> Subject: Re: [PATCH v3 7/8] fanotify: support reporting thread id instead of process id Date: Tue, 16 Oct 2018 14:06:28 +0200 [thread overview] Message-ID: <20181016120628.GL18918@quack2.suse.cz> (raw) In-Reply-To: <E490CD805F7529488761C40FD9D26EF12A801F5E@DGGEMM527-MBS.china.huawei.com> On Fri 12-10-18 02:43:02, Nixiaoming wrote: > On Thu, Oct 11, 2018 at 6:16 PM Jan Kara <mailto:firstname.lastname@example.org> wrote: > >On Thu 04-10-18 00:25:38, Amir Goldstein wrote: > >> In order to identify which thread triggered the event in a > >> multi-threaded program, add the FAN_EVENT_INFO_TID flag in fanotify_init > >> to opt-in for reporting the event creator's thread id information. > >> > >> Signed-off-by: nixiaoming <email@example.com> > >> Signed-off-by: Amir Goldstein <firstname.lastname@example.org> > > > >Just one question occurred to me (after discussion with a colleague about > >this feature): Ming, why do you actually need to know thread ID and > >thread-group ID is not enough? Also note that standard glibc threading > >functions are *not* going to be compatible with the ID returned from > >fanotify (e.g. it will be different from POSIX thread ID as returned by > >pthread_self()). So the feature is somewhat difficult to use from > >userspace... (at least you could use gettid() systemcall to get the ID of > >current thread but there's not glibc wrapper for it). > > > > When using fanotify to monitor system critical directories or files, > the monitor and event trigger are not the same process. > The monitoring task wants to know which task triggers the event. > If the event is triggered by multiple threads, > I hope to know which thread is triggered by the task, > can't see the pthread id here, but I can see the tid. OK, thanks for clarification. Honza -- Jan Kara <email@example.com> SUSE Labs, CR
next prev parent reply other threads:[~2018-10-16 19:56 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-10-03 21:25 [PATCH v3 0/8] New fanotify event info API Amir Goldstein 2018-10-03 21:25 ` [PATCH v3 1/8] fanotify: fix collision of internal and uapi mark flags Amir Goldstein 2018-10-03 21:25 ` [PATCH v3 2/8] fsnotify: generalize handling of extra event flags Amir Goldstein 2018-10-03 21:25 ` [PATCH v3 3/8] fanotify: simplify handling of FAN_ONDIR Amir Goldstein 2018-10-03 21:25 ` [PATCH v3 4/8] fanotify: deprecate uapi FAN_ALL_* constants Amir Goldstein 2018-10-03 21:25 ` [PATCH v3 5/8] fsnotify: convert runtime BUG_ON() to BUILD_BUG_ON() Amir Goldstein 2018-10-03 21:25 ` [PATCH v3 6/8] fanotify: add BUILD_BUG_ON() to count the bits of fanotify constants Amir Goldstein 2018-10-04 8:41 ` Jan Kara 2018-10-04 10:24 ` Amir Goldstein 2018-10-03 21:25 ` [PATCH v3 7/8] fanotify: support reporting thread id instead of process id Amir Goldstein 2018-10-04 8:46 ` Jan Kara 2018-10-04 10:27 ` Amir Goldstein 2018-10-11 10:16 ` Jan Kara 2018-10-12 2:43 ` Nixiaoming 2018-10-16 12:06 ` Jan Kara [this message] 2018-10-03 21:25 ` [PATCH v3 8/8] fsnotify: optimize away srcu_read_lock() for events on directories Amir Goldstein 2018-10-04 9:09 ` Jan Kara 2018-10-04 10:30 ` Amir Goldstein 2018-10-04 11:26 ` Jan Kara 2018-10-04 22:05 ` Amir Goldstein
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20181016120628.GL18918@quack2.suse.cz \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --subject='Re: [PATCH v3 7/8] fanotify: support reporting thread id instead of process id' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).