[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YyXoVxS5+FUA+vat@mit.edu>
Date: Sat, 17 Sep 2022 11:31:35 -0400
From: "Theodore Ts'o" <tytso@....edu>
To: Ivan Babrou <ivan@...udflare.com>
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel-team@...udflare.com,
Andrew Morton <akpm@...ux-foundation.org>,
Kalesh Singh <kaleshsingh@...gle.com>
Subject: Re: [RFC] proc: report open files as size in stat() for /proc/pid/fd
On Fri, Sep 16, 2022 at 04:08:52PM -0700, Ivan Babrou wrote:
> We considered putting the number of open files in /proc/pid/stat.
> Unfortunately, counting the number of fds involves iterating the fdtable,
> which means that it might slow down /proc/pid/stat for processes
> with many open files. Instead we opted to put this info in /proc/pid/fd
> as a size member of the stat syscall result. Previously the reported
> number was zero, so there's very little risk of breaking anything,
> while still providing a somewhat logical way to count the open files.
Instead of using the st_size of /proc/<pid>/fd, why not return that
value in st_nlink? /proc/<pid>/fd is a directory, so having st_nlinks
return number of fd's plus 2 (for . and ..) would be much more natural.
Cheers,
- Ted
Powered by blists - more mailing lists