> 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?

 > 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.

-- 
meem
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to