summaryrefslogtreecommitdiff
path: root/source4/ntvfs
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-01-03 12:43:18 +0100
committerStefan Metzmacher <metze@samba.org>2009-01-03 19:58:52 +0100
commitb1be241ca5d7f02be93bd3582b98d428b1e207ce (patch)
tree2a5d4156671be51f01e9dda3690fc4fe9830bdeb /source4/ntvfs
parent193eba85a9a6eff7c314f6afaaeff6bf3cff1399 (diff)
downloadsamba-b1be241ca5d7f02be93bd3582b98d428b1e207ce.tar.gz
samba-b1be241ca5d7f02be93bd3582b98d428b1e207ce.tar.bz2
samba-b1be241ca5d7f02be93bd3582b98d428b1e207ce.zip
s4:sysdep/inotify: use tevent_fd_set_auto_close()
metze
Diffstat (limited to 'source4/ntvfs')
-rw-r--r--source4/ntvfs/sysdep/inotify.c20
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;
}