[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 11 Nov 2020 12:34:51 -0800
From: Erik Kline <ek@...n.com>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: Cong Wang <xiyou.wangcong@...il.com>,
杜英杰 <leondyj@....edu.cn>,
Linux Kernel Network Developers <netdev@...r.kernel.org>
Subject: Re: some question about "/sys/class/net/<iface>/operstate"
On Wed, Nov 11, 2020 at 11:55 AM Stephen Hemminger
<stephen@...workplumber.org> wrote:
>
> On Wed, 11 Nov 2020 11:02:14 -0800
> Cong Wang <xiyou.wangcong@...il.com> wrote:
>
> > On Tue, Nov 10, 2020 at 8:32 PM 杜英杰 <leondyj@....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 && 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.
Related question: could/should modify time and/or inotify be made to
work? I genuinely don't know if that would even be possible (separate
from "desirable").
Powered by blists - more mailing lists