* [PATCH] fs: point out any processes using O_PONIES
@ 2009-04-01 4:18 Josef 'Jeff' Sipek
0 siblings, 0 replies; only message in thread
From: Josef 'Jeff' Sipek @ 2009-04-01 4:18 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Josef 'Jeff' Sipek
From: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
>From the recent discussions all over several mailing lists, and other
internet fora, it is obvious that userspace is looking for semantics the
kernel does not provide. It is obvious that while today these applications
merely insist on the kernel knowing better and implicitly syncing the data
on the applications' behalf, it will not take long before the applications
will demand more (e.g., pink ponies).
Any applications wishing to inform the kernel that it has these unreasonable
assumptions (POSIX does not guarantee this, and thefore any application
which makes the assumption that the OS does sync data implicitly is by
definition non portable and/or broken) should open all files with the
O_PONIES flag.
This patch introduces a new open(2) flag, O_PONIES, and whenever it is used,
it printks a message identifying the process (pid & comm). This is
analogous to the printks used to point out processes using old and/or
depricated interfaces.
(Note: compile tested only)
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
---
fs/open.c | 3 +++
include/asm-generic/fcntl.h | 3 +++
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/fs/open.c b/fs/open.c
index a3a78ce..e162a6e 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -1039,6 +1039,9 @@ long do_sys_open(int dfd, const char __user *filename, int flags, int mode)
} else {
fsnotify_open(f->f_path.dentry);
fd_install(fd, f);
+ if (flags & O_PONIES)
+ printk(KERN_WARNING "'%s' uses O_PONIES\n",
+ current->comm);
}
}
putname(tmp);
diff --git a/include/asm-generic/fcntl.h b/include/asm-generic/fcntl.h
index b847741..9648af4 100644
--- a/include/asm-generic/fcntl.h
+++ b/include/asm-generic/fcntl.h
@@ -51,6 +51,9 @@
#ifndef O_CLOEXEC
#define O_CLOEXEC 02000000 /* set close_on_exec */
#endif
+#ifndef O_PONIES
+#define O_PONIES 04000000 /* unreasonable fs assumptions */
+#endif
#ifndef O_NDELAY
#define O_NDELAY O_NONBLOCK
#endif
--
1.6.2.107.ge47ee
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2009-04-01 4:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-01 4:18 [PATCH] fs: point out any processes using O_PONIES Josef 'Jeff' Sipek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).