[<prev] [next>] [day] [month] [year] [list]
Message-ID: <9641a91e0905011711j75e33219yf520d0e40171908e@mail.gmail.com>
Date: Sat, 2 May 2009 10:11:21 +1000
From: john slee <indigoid@...corollas.org>
To: linux-kernel@...r.kernel.org
Subject: [proposal] creating anonymous files
Hi,
At present developers seem to go through all kinds of ridiculous
antics to try to open a temporary file with some degree of safety.
Most of these seem to revolve around choosing a name, and in
many cases it gets unlinked immediately after open() anyway.
Temporary file creation/handling would be far less unpleasant if
it went something like this:
/* need to establish which fs the new inode goes on */
dirfd = open("/etc", O_RDONLY);
fd = openfdat(dirfd, O_CREAT, S_IWUSR|S_IRUSR);
/* file has no links, no need to unlink. now use fd */
/* if we want to keep the file, add a link */
if (all_ok) {
linkfdat(dirfd, fd, "nsswitch.conf");
} else {
/* no cleanup required, inode has no links and */
/* disappears at process exit */
}
I had a quick look through the Free/OpenBSD and Solaris 10
manpages in case they had implemented something similar, but
it seems that they haven't.
Sorry about lack of attached patch. I did have a good look through
fs/namei.c and fs/open.c but I am more a sysadmin than a kernel
hacker
Comments/constructive abuse appreciated...
John
--
P-plate adventurer -- http://indigoid.org/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists