From: Linus Torvalds <torvalds@linux-foundation.org>
To: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: David Miller <davem@davemloft.net>,
alan@lxorguk.ukuu.org.uk, drepper@redhat.com,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
akpm@linux-foundation.org
Subject: Re: [PATCH] alternative to sys_indirect, part 1
Date: Thu, 24 Apr 2008 09:30:35 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.1.10.0804240921460.2779@woody.linux-foundation.org> (raw)
In-Reply-To: <517f3f820804240903y788102bar5c7d1fa9bcee1c8a@mail.gmail.com>
On Thu, 24 Apr 2008, Michael Kerrisk wrote:
>
> It strikes me to be cleanest to use the same solution for all of them
> -- i.e., new syscalls (seems simplest) or sys_indirect() -- including
> socket().
I certainly don't dislike sys_indirect either, but I've also done user
mode programming, and when it comes to OS-specific things (and especially
if they are even _version_-specific) I can tell you that basically nobody
will ever use them if you cannot decide to use them dynamically.
Here's an example of a *successful* use of something like that:
#ifndef O_NOATIME
#define O_NOATIME 0
#endif
static unsigned int sha1_file_open_flag = O_NOATIME;
...
fd = open(filename, O_RDONLY | sha1_file_open_flag);
if (fd < 0) {
/* See if it works without O_NOATIME */
switch (sha1_file_open_flag) {
default:
fd = open(filename, O_RDONLY);
if (fd >= 0)
break;
/* Fallthrough */
case 0:
return NULL;
}
/* If it failed once, it will probably fail again.
* Stop using O_NOATIME
*/
sha1_file_open_flag = 0;
}
...
see? This is soemthing where I actually used Linux-specific code. And
dammit, I'm _Linus_. Think of your normal programmer that isn't quite as
Linux-oriented.
And that's the problem with anything that isn't flags-based. Once you do
new system calls, doing the above is really quite nasty. How do you
statically even _test_ that you have a system call? Now you need to add a
whole autoconf thing for it existing, and when it does exist you still
need to test whether it works, and you can't even do it in the slow-path
like the above (which turns the failure into a fast-path _without_ the
flag).
So while I don't dislike the indirect system call, I do think that if we
can handle a large case of the problems with an added flag to already
existing system calls, that does have huge advantages. Because it allows
code like the above, which needs absolutely zero autoconf for linking
errors etc..
Linus
next prev parent reply other threads:[~2008-04-24 16:31 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-24 4:03 Ulrich Drepper
2008-04-24 10:25 ` Alan Cox
2008-04-24 12:34 ` Michael Kerrisk
2008-04-24 14:49 ` Ulrich Drepper
2008-04-24 14:42 ` Alan Cox
2008-04-24 15:19 ` Ulrich Drepper
2008-04-24 15:05 ` Michael Kerrisk
2008-04-24 14:18 ` Ulrich Drepper
2008-04-24 14:24 ` Alan Cox
2008-04-24 15:16 ` Ulrich Drepper
2008-04-24 15:03 ` Alan Cox
2008-04-24 15:44 ` Jakub Jelinek
2008-04-24 15:24 ` Alan Cox
2008-04-24 16:00 ` David Miller
2008-04-24 15:38 ` Alan Cox
2008-04-24 16:09 ` David Miller
2008-04-24 16:45 ` Michael Kerrisk
2008-04-26 22:41 ` dean gaudet
2008-04-24 15:45 ` Ulrich Drepper
2008-04-24 15:27 ` Alan Cox
2008-04-24 16:04 ` Ulrich Drepper
2008-04-24 15:45 ` Alan Cox
2008-04-24 16:06 ` Michael Kerrisk
2008-04-24 16:49 ` Evgeniy Polyakov
2008-04-24 15:29 ` Linus Torvalds
2008-04-24 15:39 ` David Miller
2008-04-24 16:03 ` Michael Kerrisk
2008-04-24 15:42 ` Alan Cox
2008-04-24 16:48 ` Michael Kerrisk
2008-04-24 17:20 ` H. Peter Anvin
2008-04-24 17:31 ` Ulrich Drepper
2008-04-24 17:34 ` H. Peter Anvin
2008-04-24 16:30 ` Linus Torvalds [this message]
2008-04-24 16:52 ` Ulrich Drepper
2008-04-24 12:27 ` Michael Kerrisk
2008-04-24 12:46 ` David Collier-Brown
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=alpine.LFD.1.10.0804240921460.2779@woody.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=davem@davemloft.net \
--cc=drepper@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
--cc=netdev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome