Package org.apache.cassandra.utils
Class NativeLibraryLinux
java.lang.Object
org.apache.cassandra.utils.NativeLibraryLinux
- All Implemented Interfaces:
NativeLibraryWrapper
A
NativeLibraryWrapper implementation for Linux.
When JNA is initialized, all methods that have the 'native' keyword will be attmpted to be linked against. As Java doesn't have the equivalent of a #ifdef, this means if a native method like posix_fadvise is defined in the class but not available on the target operating system (e.g. posix_fadvise is not availble on Darwin/Mac) this will cause the entire initial linking and initialization of JNA to fail. This means other native calls that are supported on that target operating system will be unavailable simply because of one native defined method not supported on the runtime operating system.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcallClose(int fd) intcallFcntl(int fd, int command, long flags) intcallFsync(int fd) longintcallMlockall(int flags) intintintcallPosixFadvise(int fd, long offset, int len, int flag) com.sun.jna.PointercallStrerror(int errnum) booleanChecks if the library has been successfully linked.
-
Constructor Details
-
NativeLibraryLinux
public NativeLibraryLinux()
-
-
Method Details
-
callMlockall
- Specified by:
callMlockallin interfaceNativeLibraryWrapper- Throws:
UnsatisfiedLinkErrorRuntimeException
-
callMunlockall
- Specified by:
callMunlockallin interfaceNativeLibraryWrapper- Throws:
UnsatisfiedLinkErrorRuntimeException
-
callFcntl
- Specified by:
callFcntlin interfaceNativeLibraryWrapper- Throws:
UnsatisfiedLinkErrorRuntimeException
-
callPosixFadvise
public int callPosixFadvise(int fd, long offset, int len, int flag) throws UnsatisfiedLinkError, RuntimeException - Specified by:
callPosixFadvisein interfaceNativeLibraryWrapper- Throws:
UnsatisfiedLinkErrorRuntimeException
-
callOpen
- Specified by:
callOpenin interfaceNativeLibraryWrapper- Throws:
UnsatisfiedLinkErrorRuntimeException
-
callFsync
- Specified by:
callFsyncin interfaceNativeLibraryWrapper- Throws:
UnsatisfiedLinkErrorRuntimeException
-
callClose
- Specified by:
callClosein interfaceNativeLibraryWrapper- Throws:
UnsatisfiedLinkErrorRuntimeException
-
callStrerror
- Specified by:
callStrerrorin interfaceNativeLibraryWrapper- Throws:
UnsatisfiedLinkErrorRuntimeException
-
callGetpid
- Specified by:
callGetpidin interfaceNativeLibraryWrapper- Throws:
UnsatisfiedLinkErrorRuntimeException
-
isAvailable
public boolean isAvailable()Description copied from interface:NativeLibraryWrapperChecks if the library has been successfully linked.- Specified by:
isAvailablein interfaceNativeLibraryWrapper- Returns:
trueif the library has been successfully linked,falseotherwise.
-