mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Compare commits
1 Commits
feature-fl
...
detect-gli
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d2cc4c3c1 |
@@ -14,12 +14,18 @@ import org.briarproject.bramble.api.system.ResourceProvider;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import javax.net.SocketFactory;
|
import javax.net.SocketFactory;
|
||||||
|
|
||||||
|
import static java.util.logging.Level.INFO;
|
||||||
|
import static java.util.logging.Logger.getLogger;
|
||||||
|
|
||||||
@NotNullByDefault
|
@NotNullByDefault
|
||||||
class UnixTorPlugin extends JavaTorPlugin {
|
class UnixTorPlugin extends JavaTorPlugin {
|
||||||
|
|
||||||
|
private static final Logger LOG = getLogger(UnixTorPlugin.class.getName());
|
||||||
|
|
||||||
UnixTorPlugin(Executor ioExecutor,
|
UnixTorPlugin(Executor ioExecutor,
|
||||||
Executor wakefulIoExecutor,
|
Executor wakefulIoExecutor,
|
||||||
NetworkManager networkManager,
|
NetworkManager networkManager,
|
||||||
@@ -41,6 +47,8 @@ class UnixTorPlugin extends JavaTorPlugin {
|
|||||||
circumventionProvider, batteryManager, backoff,
|
circumventionProvider, batteryManager, backoff,
|
||||||
torRendezvousCrypto, callback, architecture,
|
torRendezvousCrypto, callback, architecture,
|
||||||
maxLatency, maxIdleTime, torDirectory);
|
maxLatency, maxIdleTime, torDirectory);
|
||||||
|
boolean isGlibc = isGlibc();
|
||||||
|
if (LOG.isLoggable(INFO)) LOG.info("System uses glibc: " + isGlibc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -48,10 +56,27 @@ class UnixTorPlugin extends JavaTorPlugin {
|
|||||||
return CLibrary.INSTANCE.getpid();
|
return CLibrary.INSTANCE.getpid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean isGlibc() {
|
||||||
|
try {
|
||||||
|
GnuCLibrary glibc = Native.loadLibrary("c", GnuCLibrary.class);
|
||||||
|
if (LOG.isLoggable(INFO)) {
|
||||||
|
LOG.info("glibc version " + glibc.gnu_get_libc_version());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} catch (UnsatisfiedLinkError e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private interface CLibrary extends Library {
|
private interface CLibrary extends Library {
|
||||||
|
|
||||||
CLibrary INSTANCE = Native.loadLibrary("c", CLibrary.class);
|
CLibrary INSTANCE = Native.loadLibrary("c", CLibrary.class);
|
||||||
|
|
||||||
int getpid();
|
int getpid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private interface GnuCLibrary extends Library {
|
||||||
|
|
||||||
|
String gnu_get_libc_version();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user