Package org.apache.cassandra.utils
Class NativeLibraryLinux
- java.lang.Object
-
- org.apache.cassandra.utils.NativeLibraryLinux
-
- All Implemented Interfaces:
NativeLibraryWrapper
public class NativeLibraryLinux extends java.lang.Object implements NativeLibraryWrapper
ANativeLibraryWrapperimplementation 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:
NativeLibraryWrapper,NativeLibrary
-
-
Constructor Summary
Constructors Constructor Description NativeLibraryLinux()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcallClose(int fd)intcallFcntl(int fd, int command, long flags)intcallFsync(int fd)longcallGetpid()intcallMlockall(int flags)intcallMunlockall()intcallOpen(java.lang.String path, int flags)intcallPosixFadvise(int fd, long offset, int len, int flag)com.sun.jna.PointercallStrerror(int errnum)booleanisAvailable()Checks if the library has been successfully linked.
-
-
-
Method Detail
-
callMlockall
public int callMlockall(int flags) throws java.lang.UnsatisfiedLinkError, java.lang.RuntimeException- Specified by:
callMlockallin interfaceNativeLibraryWrapper- Throws:
java.lang.UnsatisfiedLinkErrorjava.lang.RuntimeException
-
callMunlockall
public int callMunlockall() throws java.lang.UnsatisfiedLinkError, java.lang.RuntimeException- Specified by:
callMunlockallin interfaceNativeLibraryWrapper- Throws:
java.lang.UnsatisfiedLinkErrorjava.lang.RuntimeException
-
callFcntl
public int callFcntl(int fd, int command, long flags) throws java.lang.UnsatisfiedLinkError, java.lang.RuntimeException- Specified by:
callFcntlin interfaceNativeLibraryWrapper- Throws:
java.lang.UnsatisfiedLinkErrorjava.lang.RuntimeException
-
callPosixFadvise
public int callPosixFadvise(int fd, long offset, int len, int flag) throws java.lang.UnsatisfiedLinkError, java.lang.RuntimeException- Specified by:
callPosixFadvisein interfaceNativeLibraryWrapper- Throws:
java.lang.UnsatisfiedLinkErrorjava.lang.RuntimeException
-
callOpen
public int callOpen(java.lang.String path, int flags) throws java.lang.UnsatisfiedLinkError, java.lang.RuntimeException- Specified by:
callOpenin interfaceNativeLibraryWrapper- Throws:
java.lang.UnsatisfiedLinkErrorjava.lang.RuntimeException
-
callFsync
public int callFsync(int fd) throws java.lang.UnsatisfiedLinkError, java.lang.RuntimeException- Specified by:
callFsyncin interfaceNativeLibraryWrapper- Throws:
java.lang.UnsatisfiedLinkErrorjava.lang.RuntimeException
-
callClose
public int callClose(int fd) throws java.lang.UnsatisfiedLinkError, java.lang.RuntimeException- Specified by:
callClosein interfaceNativeLibraryWrapper- Throws:
java.lang.UnsatisfiedLinkErrorjava.lang.RuntimeException
-
callStrerror
public com.sun.jna.Pointer callStrerror(int errnum) throws java.lang.UnsatisfiedLinkError, java.lang.RuntimeException- Specified by:
callStrerrorin interfaceNativeLibraryWrapper- Throws:
java.lang.UnsatisfiedLinkErrorjava.lang.RuntimeException
-
callGetpid
public long callGetpid() throws java.lang.UnsatisfiedLinkError, java.lang.RuntimeException- Specified by:
callGetpidin interfaceNativeLibraryWrapper- Throws:
java.lang.UnsatisfiedLinkErrorjava.lang.RuntimeException
-
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.
-
-