On Sun, Sep 24, 2017 at 1:06 PM, Alexey Dobriyan <adobriyan@xxxxxxxxx> wrote: > From: Aliaksandr Patseyenak <Aliaksandr_Patseyenak1@xxxxxxxx> > > Implement system call for bulk retrieveing of opened descriptors > in binary form. > > Some daemons could use it to reliably close file descriptors > before starting. Currently they close everything upto some number > which formally is not reliable. Other natural users are lsof(1) and CRIU > (although lsof does so much in /proc that the effect is thoroughly buried). > > /proc, the only way to learn anything about file descriptors may not be > available. There is unavoidable overhead associated with instantiating > 3 dentries and 3 inodes and converting integers to strings and back. > > Benchmark: > > N=1<<22 times > 4 opened descriptors (0, 1, 2, 3) > opendir+readdir+closedir /proc/self/fd vs fdmap > > /proc 8.31 ą 0.37% > fdmap 0.32 ą 0.72% This doesn't have the semantic problem that pidmap does, but I still wonder why this can't be accomplished by adding a new file in /proc. -- To unsubscribe from this list: send the line "unsubscribe linux-api" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html