mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-22 20:31:16 +00:00
Forum discussion: https://forum.syncthing.net/t/android-failed-to-set-up-inotify-handler-please-increase-inotify-limits/11924/15
This commit is contained in:
parent
4b7024bf8a
commit
3bd1c753a6
1 changed files with 15 additions and 0 deletions
|
@ -130,6 +130,7 @@ public class SyncthingRunnable implements Runnable {
|
|||
try {
|
||||
if (wakeLock != null)
|
||||
wakeLock.acquire();
|
||||
increaseInotifyWatches();
|
||||
|
||||
HashMap<String, String> targetEnv = buildEnvironment();
|
||||
process = setupAndLaunch(targetEnv);
|
||||
|
@ -260,6 +261,20 @@ public class SyncthingRunnable implements Runnable {
|
|||
return syncthingPIDs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Root-only: Temporarily increase "fs.inotify.max_user_watches"
|
||||
* as Android has a default limit of 8192 watches.
|
||||
* Manually run "sysctl fs.inotify" in a root shell terminal to check current limit.
|
||||
*/
|
||||
private void increaseInotifyWatches() {
|
||||
if (!mUseRoot || !Shell.SU.available()) {
|
||||
Log.i(TAG, "increaseInotifyWatches: Root is not available. Cannot increase inotify limit.");
|
||||
return;
|
||||
}
|
||||
int exitCode = Util.runShellCommand("sysctl -n -w fs.inotify.max_user_watches=131072\n", true);
|
||||
Log.i(TAG, "increaseInotifyWatches: sysctl returned " + Integer.toString(exitCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* Look for a running libsyncthing.so process and nice its IO.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue