Skip to content

Commit

Permalink
Increase default watch count (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
int128 committed Dec 20, 2017
1 parent 91d65fa commit 5d8bb88
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions inotify.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ __asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
#define WATCH_COUNT_NAME "/proc/sys/fs/inotify/max_user_watches"

#define DEFAULT_SUBDIR_COUNT 5
#define DEFAULT_WATCH_COUNT 65535

typedef struct __watch_node {
int wd;
Expand Down Expand Up @@ -97,14 +98,14 @@ static void read_watch_descriptors_count() {
FILE* f = fopen(WATCH_COUNT_NAME, "r");
if (f == NULL) {
userlog(LOG_WARNING, "can't open %s: %s", WATCH_COUNT_NAME, strerror(errno));
watch_count = 1024;
watch_count = DEFAULT_WATCH_COUNT;
return;
}

char* str = read_line(f);
if (str == NULL) {
userlog(LOG_WARNING, "can't read from %s", WATCH_COUNT_NAME);
watch_count = 1024;
watch_count = DEFAULT_WATCH_COUNT;
}
else {
watch_count = atoi(str);
Expand Down

0 comments on commit 5d8bb88

Please sign in to comment.