diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2009-01-04 22:48:23 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2009-01-04 22:48:23 +0100 |
commit | af744e0954bbe9ddfa2e3da173e79de65e640a4c (patch) | |
tree | 78b98c28e6d54c5339c12f2f942883d5088fda84 /source4/ntvfs/sysdep/inotify.c | |
parent | ce47b69d8e318bbb3642d27aa0451e2914c92be7 (diff) | |
parent | 2c0faaf5d921fe57a88d3b999067458e8774c6f6 (diff) | |
download | samba-af744e0954bbe9ddfa2e3da173e79de65e640a4c.tar.gz samba-af744e0954bbe9ddfa2e3da173e79de65e640a4c.tar.bz2 samba-af744e0954bbe9ddfa2e3da173e79de65e640a4c.zip |
Merge branch 'master' of ssh://git.samba.org/data/git/samba
Diffstat (limited to 'source4/ntvfs/sysdep/inotify.c')
-rw-r--r-- | source4/ntvfs/sysdep/inotify.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/source4/ntvfs/sysdep/inotify.c b/source4/ntvfs/sysdep/inotify.c index f7aa91dd0e..42aac0b097 100644 --- a/source4/ntvfs/sysdep/inotify.c +++ b/source4/ntvfs/sysdep/inotify.c @@ -23,8 +23,8 @@ #include "includes.h" #include "system/filesys.h" +#include <tevent.h> #include "ntvfs/sysdep/sys_notify.h" -#include "lib/events/events.h" #include "../lib/util/dlinklist.h" #include "libcli/raw/smb.h" #include "param/param.h" @@ -249,8 +249,11 @@ static void inotify_handler(struct tevent_context *ev, struct tevent_fd *fde, static NTSTATUS inotify_setup(struct sys_notify_context *ctx) { struct inotify_private *in; + struct tevent_fd *fde; + in = talloc(ctx, struct inotify_private); NT_STATUS_HAVE_NO_MEMORY(in); + in->fd = inotify_init(); if (in->fd == -1) { DEBUG(0,("Failed to init inotify - %s\n", strerror(errno))); @@ -263,8 +266,19 @@ static NTSTATUS inotify_setup(struct sys_notify_context *ctx) ctx->private_data = in; /* add a event waiting for the inotify fd to be readable */ - event_add_fd(ctx->ev, in, in->fd, EVENT_FD_READ|EVENT_FD_AUTOCLOSE, inotify_handler, in); - + fde = tevent_add_fd(ctx->ev, in, in->fd, + TEVENT_FD_READ, inotify_handler, in); + if (!fde) { + if (errno == 0) { + errno = ENOMEM; + } + DEBUG(0,("Failed to tevent_add_fd() - %s\n", strerror(errno))); + talloc_free(in); + return map_nt_error_from_unix(errno); + } + + tevent_fd_set_auto_close(fde); + return NT_STATUS_OK; } |