lkml.org 
[lkml]   [2012]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCH] nextfd(2)
    On Sat, Apr 7, 2012 at 5:21 PM, Ben Pfaff <blp@cs.stanford.edu> wrote:
    > "H. Peter Anvin" <hpa@zytor.com> writes:
    >
    >> 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.
    >
    > It's already possible to do something a little like that with the
    > existing "poll" system call:
    >
    > #include <stdio.h>
    > #include <sys/poll.h>
    >
    > int
    > main(void)
    > {
    >  enum { N_FDS = 1024 };
    >  struct pollfd fds[N_FDS];

    Your code has a muximum fd assumption here. that is one of that we
    really want to avoid.
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2012-04-11 02:15    [W:0.029 / U:3.664 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site