From: Oleg Verych <olecom@flower.upol.cz>
To: linux fs <linux-fsdevel@vger.kernel.org>
Subject: code example (Re: euidaccess() as syscall)
Date: Mon, 5 May 2008 21:21:44 +0200 [thread overview]
Message-ID: <E1Jt6Fs-0005uc-8Z@flower> (raw)
In-Reply-To: <8499950a0805021145l6df18c1ew425a2398589ad7f7@mail.gmail.com>
> Unneeded code path is there, but i'm not sure run overhead is
> measurable. Inflexibility and bug reports are, however.
Based on stripped, thus raceless-in-kernel
linux-2.6/fs/open.c:sys_faccessat()
Example expects non-error part to be likely, doesn't use "goto" in basic
stuff, isn't going to be used with unlikely_buggy(optimizing) GCC.
Comments?
# lang:C
asmlinkage long sys_feuidaccessat(int dfd, const char __user *filename, int mode)
{
struct nameidata nd;
int res;
/* where's F_OK, X_OK, W_OK, R_OK? */
if (!(mode & ~S_IRWXO)) {
/* here */
res = __user_walk_fd(dfd, filename, LOOKUP_FOLLOW|LOOKUP_ACCESS, &nd);
if (!res) {
res = vfs_permission(&nd, mode);
/* SuS v2 requires we report a read only fs too */
if (res || special_file(nd.dentry->d_inode->i_mode)
|| !(mode & S_IWOTH))
{} else if (IS_RDONLY(nd.dentry->d_inode))
res = -EROFS;
path_release(&nd);
}
return res;
}
return -EINVAL;
}
#
--
sed 'sed && sh + olecom = love' << ''
-o--=O`C
#oo'L O
<___=E M
next prev parent reply other threads:[~2008-05-05 19:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-02 16:59 euidaccess() as syscall Oleg Verych
2008-05-02 17:06 ` Matthew Wilcox
2008-05-02 17:13 ` Oleg Verych
2008-05-02 17:33 ` Jamie Lokier
2008-05-02 18:45 ` Oleg Verych
2008-05-05 19:21 ` Oleg Verych [this message]
2008-05-02 17:35 ` Matthew Wilcox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1Jt6Fs-0005uc-8Z@flower \
--to=olecom@flower.upol.cz \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.