lkml.org 
[lkml]   [2001]   [Apr]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: light weight user level semaphores
    Date
    From
    > Ehh.. I will bet you $10 USD that if libc allocates the next file
    > descriptor on the first "malloc()" in user space (in order to use the
    > semaphores for mm protection), programs _will_ break.

    Of course, but this is a result from sloppy coding. In general, open()
    can just return anything and about the only case where you can even
    think of ignoring its result is this:
    close(0); close(1); close(2);
    open("/dev/null", O_RDWR); dup(0); dup(0);
    (which is even not clean for other reasons).

    I can't imagine depending on the "fact" that the first fd I open is 3,
    the next is 4, etc. And what if the routine in question is not
    malloc() but e.g. getpwuid()? Both are just arbitrary library
    functions, and one of them clearly does open file descriptors,
    depending on their implementation.

    What would the reason[1] be for wanting contiguous fd space anyway?

    Olaf

    [1] apart from not having understood how poll() works of course.
    -
    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: 2005-03-22 13:26    [W:4.248 / U:0.352 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site