From: "David S. Miller" <davem@redhat.com>
To: tigran@veritas.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: bug in count_open_files() or a strange granularity?
Date: Tue, 28 Nov 2000 07:06:27 -0800 [thread overview]
Message-ID: <200011281506.HAA02318@pizda.ninka.net> (raw)
In-Reply-To: <Pine.LNX.4.21.0011281459080.1254-100000@penguin.homenet> (message from Tigran Aivazian on Tue, 28 Nov 2000 15:13:44 +0000 (GMT))
In-Reply-To: <Pine.LNX.4.21.0011281459080.1254-100000@penguin.homenet>
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/
next prev parent reply other threads:[~2000-11-28 15:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-11-28 15:13 Tigran Aivazian
2000-11-28 15:06 ` David S. Miller [this message]
2000-11-28 15:40 ` Tigran Aivazian
2000-11-28 15:55 ` Alexander Viro
2000-11-28 16:09 ` Tigran Aivazian
2000-11-28 16:01 ` David S. Miller
2000-11-28 15:48 ` Alexander Viro
2000-11-28 15:55 ` Tigran Aivazian
2000-11-28 16:06 ` Alexander Viro
2000-11-28 16:25 ` Tigran Aivazian
2000-11-28 17:45 ` Alexander Viro
2000-11-28 18:05 ` Tigran Aivazian
2000-11-28 15:44 ` Richard B. Johnson
2000-11-28 16:41 ` Tigran Aivazian
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=200011281506.HAA02318@pizda.ninka.net \
--to=davem@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tigran@veritas.com \
/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
all inboxes | Powered by JetHome®