[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHGf_=rsJ8o8Fnd2z5Z8jHGc=cz370ay0_t3bhkiYRCBh3puVw@mail.gmail.com>
Date: Tue, 10 Apr 2012 20:09:56 -0400
From: KOSAKI Motohiro <kosaki.motohiro@...il.com>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: Alexey Dobriyan <adobriyan@...il.com>, akpm@...ux-foundation.org,
viro@...iv.linux.org.uk, torvalds@...ux-foundation.org,
drepper@...il.com, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH] nextfd(2)
On Fri, Apr 6, 2012 at 12:23 PM, H. Peter Anvin <hpa@...or.com> wrote:
> On 04/06/2012 02:54 AM, Alexey Dobriyan wrote:
>>
>> Without proc knowledge about fdtable is gathered linearly and still unreliable.
>> With nextfd(2), even procful environments could lose several failure branches.
>> And they can keep old dumb fd++ or smart /proc/self/fd loops for a change.
>>
>
> Incidentally, if we were to create a system call for this -- which I so
> far see no reason for -- I would make it return a select-style bitmask
> of file descriptors in use, not a "next fd" which would require a system
> call per iteration.
I know the reason. fcntl(F_NEXT) is one of a proposal of next SUS enhancement.
http://austingroupbugs.net/view.php?id=149
nextfd() has a semantics of F_NEXT.
Next, why shoundn't we implement fcntl(F_NEXT) in our kernel? I think
we have two reason.
1) As linus pointed out, linux specific "flags" argument may be useful.
2) The name of F_NEXT is not fixed yet. another url of the austin says
it is FD_NEXT.
So, we can't choose right name yet. Moreover, A meanings of 3rd
argument of F_NEXT
haven't been fixed.
I dont think following #ifdef is insane. but glibc also can provide
correct F_NEXT when next SUS is published.
#ifdef FOO
#define NEXTFD(fd) nextfd(fd, flags)
#else
#define NEXTFD(fd) fcntl(fd, F_NEXT, O_FDWR)
#endif
In short, kernel developer don't care any standard at all. but
application programmer usually care it.
--
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