Re: [PATCH] proc: restore seekdir("/proc", 256) semantics

From: Pavel Machek
Date: Wed May 02 2018 - 15:10:19 EST


Hi!

> Long time ago "/proc/self" was an honest symlink and all not-PID entries
> were output before /proc/$PID. To not lose /proc/self in readdir output
> after it became permanently positive dentry it was stuck before /proc/1.
>
> One side effect of the change was that the code
>
> d = opendir("/proc");
> seekdir(d, 256);
>
> stopped pointing to the first PID for applications that want to skip all
> the crap.
>
> Later "/proc/thread-self" was added in the same way.
>
> It looks like ps and top aren't seeking over /proc but are simply
> skipping over so nobody noticed.
>
> Restore old behaviour, make seekdir(254) point to /proc/self and
> seekdir(255) point to /proc/thread-self.

Is there anyone relying on the old behaviour?

Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html