Align event buffer to what inotify(7) says
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
#include <stdalign.h>
|
||||
#include <dirent.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
@ -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) {
|
||||
|
Reference in New Issue
Block a user