CC src/rfkill.o
In file included from ./ell/ell.h:1,
from src/rfkill.c:35:
src/rfkill.c: In function ‘rfkill_init’:
src/rfkill.c:282:49: error: ‘O_CLOEXEC’ undeclared (first use in this function); did you mean ‘FD_CLOEXEC’?
282 | fd = L_TFR(open("/dev/rfkill", O_RDWR | O_CLOEXEC));
| ^~~~~~~~~
./ell/util.h:348:34: note: in definition of macro ‘L_TFR’
348 | do __result = (long int) (expression); \
| ^~~~~~~~~~
src/rfkill.c:282:49: note: each undeclared identifier is reported only once for each function it appears in
282 | fd = L_TFR(open("/dev/rfkill", O_RDWR | O_CLOEXEC));
| ^~~~~~~~~
./ell/util.h:348:34: note: in definition of macro ‘L_TFR’
348 | do __result = (long int) (expression); \
| ^~~~~~~~~~
map_wiphy made the assumption that phy names follow the "phyN" pattern
but phys created or renamed by the "iw" command can have arbitrary
names. It seems that /sys/class/rfkill/rfkill%u/name is not updated on
a phy rename, so we can't use it to subsequently read
/sys/class/ieee80211/<name>/index but both
/sys/class/rfkill/rfkill%u/../index and
/sys/class/rfkill/rfkill%u/device/index point to that file.
Add rfkill.c/rfkill.h to be used for watching per-wiphy RFkill state.
It uses both /dev/rfkill and /sys because /dev/rfkill is the recommended
way of interfacing with rfkill but at the same time it doesn't provide
the information on mapping to wiphy IDs.