diff --git a/watcher.c b/watcher.c index 98e537d..c0230b6 100644 --- a/watcher.c +++ b/watcher.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -9,7 +10,8 @@ #define GEBS_IMPLEMENTATION #include "gebs/gebs.h" -#define EVENT_BUFFER_SIZE (1 * (sizeof(struct inotify_event) + NAME_MAX + 1)) +#define EVENT_BUFFER_SIZE (5 * (sizeof(struct inotify_event) + NAME_MAX + 1)) +#define EVENT_BUFFER_ALIGNMENT __attribute__((aligned(alignof(struct inotify_event)))) typedef struct { int key; // watch descriptor @@ -153,7 +155,7 @@ int main(int argc, char ** argv) pid_t cmd_pid = cmd_run_async(&cmd); - char event_buffer[EVENT_BUFFER_SIZE] __attribute__((aligned(8))); + char event_buffer[EVENT_BUFFER_SIZE] EVENT_BUFFER_ALIGNMENT; while (running) { ssize_t nread; if ((nread = read(watcher.fd, event_buffer, EVENT_BUFFER_SIZE)) < 0) {