lkml.org 
[lkml]   [2000]   [Nov]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: bug in count_open_files() or a strange granularity?
       Date:   Tue, 28 Nov 2000 15:13:44 +0000 (GMT)
    From: Tigran Aivazian <tigran@veritas.com>

    I know that there is no problem due to the way it is called in
    copy_files() -- it would only be above 32. But for what I want to
    use it, I need the _correct_ number of open file descriptors and
    not some "rounded up to 32" one.

    That function is static for a reason :-) It is not meant
    for external use. What it gives you is the smallest multiple
    of (8 * sizeof(long)) which is larger than the largest file
    descriptor the task has open.

    What you want is something like:

    static int num_open_files(struct files_struct *files, int size)
    {
    total = 0;
    for (i = size / (8 * sizeof(long)); i > 0; )
    total += count_bits(files->open_fds->fds_bits[--i]);

    return total;
    }

    Later,
    David S. Miller
    davem@redhat.com
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 12:47    [W:4.149 / U:1.340 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site