On Wed, 14 Oct 2009 11:14:47 -0700, Peter Memishian <peter.memish...@sun.com> wrote: >> how do I get notifications when hardware (e.g. USB devices) is > > hotplugged from a C/C++ application? On Linux, I can listen for those > > events on a socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT) -- > > there's probably something similar in OpenSolaris? > > Will the rcmscript(4) mechanism do what you need? >
A higher-level API for device detection and hotplug notification is provided by HAL, see http://opensolaris.org/os/project/tamarack/hal_re.html for details. There should also be various guides online. As a bonus, the API is also available on some other OSes including FreeBSD and Linux. There is some concern about lack of maintainership in the implementation but it is currently still the standard. > > Also, is there a way to get notifications when a network cable is > > plugged in or out (equivalent to monitoring ifi_flags on a > > socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE) on Linux)? > > If you're only concerned with link up/down events for datalinks associated > with IP interfaces, you can use a routing socket (see route(7P)) and track > changes to the IFF_RUNNING flag. If IFF_RUNNING is clear, the IP > interface is not usable, usually because the cable has been unplugged. -Albert _______________________________________________ opensolaris-code mailing list opensolaris-code@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/opensolaris-code