Package com.sun.jna.platform.mac
Class IOKitUtil
java.lang.Object
com.sun.jna.platform.mac.IOKitUtil
Provides utilities for IOKit.
-
Method Summary
Modifier and TypeMethodDescriptiongetBSDNameMatchingDict(String bsdName) Convenience method to get the IO dictionary matching a bsd name.static intGets a pointer to the Mach Master Port.static IOKit.IOServicegetMatchingService(CoreFoundation.CFDictionaryRef matchingDictionary) Opens a the first IOService matching a dictionary.static IOKit.IOServicegetMatchingService(String serviceName) Opens a the first IOService matching a service name.static IOKit.IOIteratorgetMatchingServices(CoreFoundation.CFDictionaryRef matchingDictionary) Convenience method to get IOService objects matching a dictionary.static IOKit.IOIteratorgetMatchingServices(String serviceName) Convenience method to get IOService objects matching a service name.static IOKit.IORegistryEntrygetRoot()Gets the IO Registry root.
-
Method Details
-
getMasterPort
public static int getMasterPort()Gets a pointer to the Mach Master Port.- Returns:
- The master port.
Multiple calls to
getMasterPort()will not result in leaking ports (each call toIOKit.IOMasterPort(int, com.sun.jna.ptr.IntByReference)adds another send right to the port) but it is considered good programming practice to deallocate the port when you are finished with it, usingSystemB.mach_port_deallocate(int, int).
-
getRoot
Gets the IO Registry root.- Returns:
- a handle to the IORoot. Callers should release when finished, using
IOKit.IOObjectRelease(com.sun.jna.platform.mac.IOKit.IOObject).
-
getMatchingService
Opens a the first IOService matching a service name.- Parameters:
serviceName- The service name to match- Returns:
- a handle to an IOService if successful,
nullif failed. Callers should release when finished, usingIOKit.IOObjectRelease(com.sun.jna.platform.mac.IOKit.IOObject).
-
getMatchingService
Opens a the first IOService matching a dictionary.- Parameters:
matchingDictionary- The dictionary to match. This method will consume a reference to the dictionary.- Returns:
- a handle to an IOService if successful,
nullif failed. Callers should release when finished, usingIOKit.IOObjectRelease(com.sun.jna.platform.mac.IOKit.IOObject).
-
getMatchingServices
Convenience method to get IOService objects matching a service name.- Parameters:
serviceName- The service name to match- Returns:
- a handle to an IOIterator if successful,
nullif failed. Callers should release when finished, usingIOKit.IOObjectRelease(com.sun.jna.platform.mac.IOKit.IOObject).
-
getMatchingServices
public static IOKit.IOIterator getMatchingServices(CoreFoundation.CFDictionaryRef matchingDictionary) Convenience method to get IOService objects matching a dictionary.- Parameters:
matchingDictionary- The dictionary to match. This method will consume a reference to the dictionary.- Returns:
- a handle to an IOIterator if successful,
nullif failed. Callers should release when finished, usingIOKit.IOObjectRelease(com.sun.jna.platform.mac.IOKit.IOObject).
-
getBSDNameMatchingDict
Convenience method to get the IO dictionary matching a bsd name.- Parameters:
bsdName- The bsd name of the registry entry- Returns:
- The dictionary ref if successful,
nullif failed. Callers should release when finished, usingIOKit.IOObjectRelease(com.sun.jna.platform.mac.IOKit.IOObject).
-