linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason <lcprog@lakedaemon.net>
To: linux-c-programming@vger.kernel.org
Subject: select() / inotify / sysfs
Date: Tue, 18 Mar 2008 11:59:41 -0400	[thread overview]
Message-ID: <47DFE6ED.9030908@lakedaemon.net> (raw)

All,

I've discovered that my physical environment causes intermittent wifi 
connectivity (drops for a few seconds, then returns).  My program can 
work through this, but needs to know that the connection has been 
interrupted.

I've placed a watch on different files in /sys/class/net/ath0/* and 
found that operstate changes (from 'up' to 'down') when I experience 
these network drops.  So, I used inotify to detect changes to the file 
as a proof of concept:

# inotifywatch -v -r /sys/class/net/ath0/operstate

No go.  It detects when I cat the file, but doesn't detect when the 
kernel changes it (which make sense on an academic note, since it 
doesn't have a value until it's read by userspace).

So, does anyone know of a good (hopefully select() based) method to 
detect this change?  It doesn't have to use sysfs, that's just the 
dragon I'm chasing right now.  ;-)  I'd really prefer not to poll the 
file...

tia,

Jason.

             reply	other threads:[~2008-03-18 15:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-18 15:59 Jason [this message]
2008-03-19 21:10 ` select() / inotify / sysfs Jason

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=47DFE6ED.9030908@lakedaemon.net \
    --to=lcprog@lakedaemon.net \
    --cc=linux-c-programming@vger.kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).