blob: 2dfa4f6d11bf9700d69b9dabd3fb4165b8b8bb59 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package com.yahoo.nativec;
/**
* Gives access to the C library version.
*
* @author baldersheim
*/
public class GLibcVersion {
private final static Throwable initException = NativeC.loadLibrary(GLibcVersion.class);
public static Throwable init() {
return initException;
}
private final String version;
private final int major;
private final int minor;
public GLibcVersion() {
version = gnu_get_libc_version();
String [] parts = version.split("\\.");
major = parts.length > 0 ? Integer.valueOf(parts[0]) : -1;
minor = parts.length > 1 ? Integer.valueOf(parts[1]) : -1;
}
private native static String gnu_get_libc_version();
public String version() { return version; }
public int major() { return major; }
public int minor() { return minor; }
}
|