summaryrefslogtreecommitdiffstats
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-10-27 13:26:35 +0000
committerJeremy Allison <jra@samba.org>2014-12-09 04:12:09 +0100
commitf530d6d97bfb7c64ede37ad8d2ee33118ddcf3d1 (patch)
treefcf7542e5ef22ebe3b489302e83ff53dceade94d /source3/smbd
parent9b474456b8133bd82c14cd097a6df2380b55b423 (diff)
downloadsamba-f530d6d97bfb7c64ede37ad8d2ee33118ddcf3d1.tar.gz
samba-f530d6d97bfb7c64ede37ad8d2ee33118ddcf3d1.tar.xz
samba-f530d6d97bfb7c64ede37ad8d2ee33118ddcf3d1.zip
notify_inotify: Make inotify_watch return 0/errno
More like a cleanup, but I want to use inotify_watch in notifyd that I would like to keep as light as possible Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/notify_inotify.c30
-rw-r--r--source3/smbd/proto.h18
2 files changed, 24 insertions, 24 deletions
diff --git a/source3/smbd/notify_inotify.c b/source3/smbd/notify_inotify.c
index 3e4e2e6a56..ad670affcd 100644
--- a/source3/smbd/notify_inotify.c
+++ b/source3/smbd/notify_inotify.c
@@ -346,15 +346,15 @@ static int watch_destructor(struct inotify_watch_context *w)
add a watch. The watch is removed when the caller calls
talloc_free() on *handle
*/
-NTSTATUS inotify_watch(struct sys_notify_context *ctx,
- const char *path,
- uint32_t *filter,
- uint32_t *subdir_filter,
- void (*callback)(struct sys_notify_context *ctx,
- void *private_data,
- struct notify_event *ev),
- void *private_data,
- void *handle_p)
+int inotify_watch(struct sys_notify_context *ctx,
+ const char *path,
+ uint32_t *filter,
+ uint32_t *subdir_filter,
+ void (*callback)(struct sys_notify_context *ctx,
+ void *private_data,
+ struct notify_event *ev),
+ void *private_data,
+ void *handle_p)
{
struct inotify_private *in;
uint32_t mask;
@@ -367,7 +367,7 @@ NTSTATUS inotify_watch(struct sys_notify_context *ctx,
int ret;
ret = inotify_setup(ctx);
if (ret != 0) {
- return map_nt_error_from_unix(ret);
+ return ret;
}
}
@@ -376,7 +376,7 @@ NTSTATUS inotify_watch(struct sys_notify_context *ctx,
mask = inotify_map(filter);
if (mask == 0) {
/* this filter can't be handled by inotify */
- return NT_STATUS_INVALID_PARAMETER;
+ return EINVAL;
}
/* using IN_MASK_ADD allows us to cope with inotify() returning the same
@@ -386,7 +386,7 @@ NTSTATUS inotify_watch(struct sys_notify_context *ctx,
w = talloc(in, struct inotify_watch_context);
if (w == NULL) {
*filter = orig_filter;
- return NT_STATUS_NO_MEMORY;
+ return ENOMEM;
}
w->in = in;
@@ -398,7 +398,7 @@ NTSTATUS inotify_watch(struct sys_notify_context *ctx,
if (w->path == NULL) {
*filter = orig_filter;
TALLOC_FREE(w);
- return NT_STATUS_NO_MEMORY;
+ return ENOMEM;
}
/* get a new watch descriptor for this path */
@@ -408,7 +408,7 @@ NTSTATUS inotify_watch(struct sys_notify_context *ctx,
*filter = orig_filter;
TALLOC_FREE(w);
DEBUG(1, ("inotify_add_watch returned %s\n", strerror(err)));
- return map_nt_error_from_unix(err);
+ return err;
}
DEBUG(10, ("inotify_add_watch for %s mask %x returned wd %d\n",
@@ -421,7 +421,7 @@ NTSTATUS inotify_watch(struct sys_notify_context *ctx,
/* the caller frees the handle to stop watching */
talloc_set_destructor(w, watch_destructor);
- return NT_STATUS_OK;
+ return 0;
}
#endif
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 9980d03132..0e43aaf0df 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -531,15 +531,15 @@ struct sys_notify_context *sys_notify_context_create(TALLOC_CTX *mem_ctx,
/* The following definitions come from smbd/notify_inotify.c */
-NTSTATUS inotify_watch(struct sys_notify_context *ctx,
- const char *path,
- uint32_t *filter,
- uint32_t *subdir_filter,
- void (*callback)(struct sys_notify_context *ctx,
- void *private_data,
- struct notify_event *ev),
- void *private_data,
- void *handle_p);
+int inotify_watch(struct sys_notify_context *ctx,
+ const char *path,
+ uint32_t *filter,
+ uint32_t *subdir_filter,
+ void (*callback)(struct sys_notify_context *ctx,
+ void *private_data,
+ struct notify_event *ev),
+ void *private_data,
+ void *handle_p);
/* The following definitions come from smbd/notify_internal.c */