* [PATCH 0/3] inotify_add_watch_at
@ 2010-09-22 5:16 cdahlin
2010-09-22 5:16 ` [PATCH 1/3] Introduce inotify_add_watch_at system call cdahlin
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: cdahlin @ 2010-09-22 5:16 UTC (permalink / raw)
To: linux-kernel
I had use for this system call recently when I was trying to monitor a lockfile
to see when it disappeared. Its semantics are as you'd expect; it has over
inotify_add_watch what openat(2) has over open(2).
Currently compile-tested only, and missing hookups for arches I don't have
around.
--CJD
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] Introduce inotify_add_watch_at system call
2010-09-22 5:16 [PATCH 0/3] inotify_add_watch_at cdahlin
@ 2010-09-22 5:16 ` cdahlin
2010-09-22 5:16 ` [PATCH 2/3] Add inotify_add_watch_at to asm-generic/unistd.h cdahlin
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: cdahlin @ 2010-09-22 5:16 UTC (permalink / raw)
To: linux-kernel
Cc: Casey Dahlin, John McCutchan, Robert Love, Eric Paris, Al Viro,
Eric W. Biederman
From: Casey Dahlin <cdahlin@redhat.com>
This adds inotify to the *at family of system calls (openat(2), unlinkat(2),
etc) and lets you specify a directory file descriptor as a root for the
pathname argument. It is otherwise the same as the inotify_add_watch system
call.
Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
---
fs/notify/inotify/inotify_user.c | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index bf7f6d7..ed110ca 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -108,7 +108,7 @@ static inline u32 inotify_mask_to_arg(__u32 mask)
IN_Q_OVERFLOW);
}
-/* intofiy userspace file descriptor functions */
+/* inotfiy userspace file descriptor functions */
static unsigned int inotify_poll(struct file *file, poll_table *wait)
{
struct fsnotify_group *group = file->private_data;
@@ -350,11 +350,11 @@ static const struct file_operations inotify_fops = {
/*
* find_inode - resolve a user-given path to a specific inode
*/
-static int inotify_find_inode(const char __user *dirname, struct path *path, unsigned flags)
+static int inotify_find_inode(int dfd, const char __user *dirname, struct path *path, unsigned flags)
{
int error;
- error = user_path_at(AT_FDCWD, dirname, flags, path);
+ error = user_path_at(dfd, dirname, flags, path);
if (error)
return error;
/* you can only watch an inode if you have read permissions on it */
@@ -762,8 +762,8 @@ SYSCALL_DEFINE0(inotify_init)
return sys_inotify_init1(0);
}
-SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
- u32, mask)
+SYSCALL_DEFINE4(inotify_add_watch_at, int, fd, int, dfd, const char __user *,
+ pathname, u32, mask)
{
struct fsnotify_group *group;
struct inode *inode;
@@ -787,7 +787,7 @@ SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
if (mask & IN_ONLYDIR)
flags |= LOOKUP_DIRECTORY;
- ret = inotify_find_inode(pathname, &path, flags);
+ ret = inotify_find_inode(dfd, pathname, &path, flags);
if (ret)
goto fput_and_out;
@@ -803,6 +803,12 @@ fput_and_out:
return ret;
}
+SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
+ u32, mask)
+{
+ return sys_inotify_add_watch_at(fd, AT_FDCWD, pathname, mask);
+}
+
SYSCALL_DEFINE2(inotify_rm_watch, int, fd, __s32, wd)
{
struct fsnotify_group *group;
--
1.7.2.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/3] Add inotify_add_watch_at to asm-generic/unistd.h
2010-09-22 5:16 [PATCH 0/3] inotify_add_watch_at cdahlin
2010-09-22 5:16 ` [PATCH 1/3] Introduce inotify_add_watch_at system call cdahlin
@ 2010-09-22 5:16 ` cdahlin
2010-09-22 5:16 ` [PATCH 3/3] hook up inotify_add_watch_at for x86 cdahlin
2010-09-23 21:37 ` [PATCH 0/3] inotify_add_watch_at Andrew Morton
3 siblings, 0 replies; 5+ messages in thread
From: cdahlin @ 2010-09-22 5:16 UTC (permalink / raw)
To: linux-kernel
Cc: Casey Dahlin, Arnd Bergmann, Chris Metcalf, Andrew Morton,
Chen Liqin, André Goddard Rosa, linux-arch
From: Casey Dahlin <cdahlin@redhat.com>
Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
---
include/asm-generic/unistd.h | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h
index b969770..fd7b127 100644
--- a/include/asm-generic/unistd.h
+++ b/include/asm-generic/unistd.h
@@ -646,9 +646,11 @@ __SYSCALL(__NR_prlimit64, sys_prlimit64)
__SYSCALL(__NR_fanotify_init, sys_fanotify_init)
#define __NR_fanotify_mark 263
__SYSCALL(__NR_fanotify_mark, sys_fanotify_mark)
+#define __NR_inotify_add_watch_at 264
+__SYSCALL(__NR_inotify_add_watch_at, sys_inotify_add_watch)
#undef __NR_syscalls
-#define __NR_syscalls 264
+#define __NR_syscalls 265
/*
* All syscalls below here should go away really,
--
1.7.2.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/3] hook up inotify_add_watch_at for x86
2010-09-22 5:16 [PATCH 0/3] inotify_add_watch_at cdahlin
2010-09-22 5:16 ` [PATCH 1/3] Introduce inotify_add_watch_at system call cdahlin
2010-09-22 5:16 ` [PATCH 2/3] Add inotify_add_watch_at to asm-generic/unistd.h cdahlin
@ 2010-09-22 5:16 ` cdahlin
2010-09-23 21:37 ` [PATCH 0/3] inotify_add_watch_at Andrew Morton
3 siblings, 0 replies; 5+ messages in thread
From: cdahlin @ 2010-09-22 5:16 UTC (permalink / raw)
To: linux-kernel
Cc: Casey Dahlin, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
Christoph Hellwig, Andrew Morton, Eric Paris, Roland McGrath,
Russell King, David Howells, Jiri Slaby,
Arnaldo Carvalho de Melo, David S. Miller
From: Casey Dahlin <cdahlin@redhat.com>
Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
---
arch/x86/ia32/ia32entry.S | 1 +
arch/x86/include/asm/unistd_32.h | 3 ++-
arch/x86/include/asm/unistd_64.h | 2 ++
arch/x86/kernel/syscall_table_32.S | 1 +
4 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index 518bb99..1edff69 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -851,4 +851,5 @@ ia32_sys_call_table:
.quad sys_fanotify_init
.quad sys32_fanotify_mark
.quad sys_prlimit64 /* 340 */
+ .quad sys_inotify_add_watch_at
ia32_syscall_end:
diff --git a/arch/x86/include/asm/unistd_32.h b/arch/x86/include/asm/unistd_32.h
index b766a5e..ae82b2b 100644
--- a/arch/x86/include/asm/unistd_32.h
+++ b/arch/x86/include/asm/unistd_32.h
@@ -346,10 +346,11 @@
#define __NR_fanotify_init 338
#define __NR_fanotify_mark 339
#define __NR_prlimit64 340
+#define __NR_inotify_add_watch_at 341
#ifdef __KERNEL__
-#define NR_syscalls 341
+#define NR_syscalls 342
#define __ARCH_WANT_IPC_PARSE_VERSION
#define __ARCH_WANT_OLD_READDIR
diff --git a/arch/x86/include/asm/unistd_64.h b/arch/x86/include/asm/unistd_64.h
index 363e9b8..f9c704a 100644
--- a/arch/x86/include/asm/unistd_64.h
+++ b/arch/x86/include/asm/unistd_64.h
@@ -669,6 +669,8 @@ __SYSCALL(__NR_fanotify_init, sys_fanotify_init)
__SYSCALL(__NR_fanotify_mark, sys_fanotify_mark)
#define __NR_prlimit64 302
__SYSCALL(__NR_prlimit64, sys_prlimit64)
+#define __NR_inotify_add_watch_at 303
+__SYSCALL(__NR_inotify_add_watch_at, sys_inotify_add_watch_at)
#ifndef __NO_STUBS
#define __ARCH_WANT_OLD_READDIR
diff --git a/arch/x86/kernel/syscall_table_32.S b/arch/x86/kernel/syscall_table_32.S
index b35786d..a9b3682 100644
--- a/arch/x86/kernel/syscall_table_32.S
+++ b/arch/x86/kernel/syscall_table_32.S
@@ -340,3 +340,4 @@ ENTRY(sys_call_table)
.long sys_fanotify_init
.long sys_fanotify_mark
.long sys_prlimit64 /* 340 */
+ .long sys_inotify_add_watch_at
--
1.7.2.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] inotify_add_watch_at
2010-09-22 5:16 [PATCH 0/3] inotify_add_watch_at cdahlin
` (2 preceding siblings ...)
2010-09-22 5:16 ` [PATCH 3/3] hook up inotify_add_watch_at for x86 cdahlin
@ 2010-09-23 21:37 ` Andrew Morton
3 siblings, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2010-09-23 21:37 UTC (permalink / raw)
To: cdahlin; +Cc: linux-kernel
On Wed, 22 Sep 2010 01:16:55 -0400
cdahlin@redhat.com wrote:
> I had use for this system call recently when I was trying to monitor a lockfile
> to see when it disappeared. Its semantics are as you'd expect; it has over
> inotify_add_watch what openat(2) has over open(2).
>
> Currently compile-tested only, and missing hookups for arches I don't have
> around.
When adding new syscalls it's nice to include a testcase for the arch
maintainers, please. Paste it into the changelog, add a link to it,
etc.
Also please cc linux-arch@vger.kernel.org so they find out about it
earlier.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-09-23 21:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-22 5:16 [PATCH 0/3] inotify_add_watch_at cdahlin
2010-09-22 5:16 ` [PATCH 1/3] Introduce inotify_add_watch_at system call cdahlin
2010-09-22 5:16 ` [PATCH 2/3] Add inotify_add_watch_at to asm-generic/unistd.h cdahlin
2010-09-22 5:16 ` [PATCH 3/3] hook up inotify_add_watch_at for x86 cdahlin
2010-09-23 21:37 ` [PATCH 0/3] inotify_add_watch_at Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®