On Wed, 11 Nov 2020 11:02:14 -0800
Cong Wang <xiyou.wangc...@gmail.com> wrote:

> On Tue, Nov 10, 2020 at 8:32 PM 杜英杰 <leon...@pku.edu.cn> wrote:
> >
> > I want to use inotify to monitor /sys/class/net//operstate  to detect 
> > status of a iface in real time.
> > when I ifdown &amp;&amp; ifup eth3, the content of operstate changed, but 
> > the file's Modify time didn't change.
> > I don't know the reason, is there any file which can be monitored by 
> > inotify to get iface status in real time?
> > Much appreciation for any advice!  
> 
> You need to listen to netdev netlink messages for changes like
> this. These messages are generated in real-time.

The /sys and /proc are pseudo-filesystems. The file modify time and inotify do 
not work
as expected on these files. Cong is right you need to use netlink for this.

Reply via email to