On Sun, Oct 1, 2017 at 5:12 PM, Benoît Canet <benoit.canet.cont...@gmail.com
> wrote:

> /proc/stat was in the wrong place.
> Move it.
>

> Signed-off-by: Benoît Canet <ben...@scylladb.com>
> ---
>  fs/procfs/procfs_vnops.cc | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/procfs/procfs_vnops.cc b/fs/procfs/procfs_vnops.cc
> index dc66ff59..437f8302 100644
> --- a/fs/procfs/procfs_vnops.cc
> +++ b/fs/procfs/procfs_vnops.cc
> @@ -357,9 +357,8 @@ procfs_mount(mount* mp, const char *dev, int flags,
> const void* data)
>
>      auto self = make_shared<proc_dir_node>(inode_count++);
>      self->add("maps", inode_count++, mmu::procfs_maps);
> -    self->add("stat", inode_count++, procfs_stats);
> -
>      auto* root = new proc_dir_node(vp->v_ino);
> +    root->add("stat", inode_count++, procfs_stats);
>      root->add("self", self);
>      root->add("0", self); // our standard pid
>      root->add("mounts", inode_count++, procfs_mounts);
>


It took me a while to understand this code :-) I didn't when I talked to
you earlier...

"root" is the /proc root, while "self" is the directory /proc/<pid> - in
our case either /proc/0/ or /proc/self/ work.

So, we added "stat" to self (not to root), means we implemented
/proc/$$/stat here, not /proc/stat.
Commit e7bfa6cb1bb043d6ea66e03b32981e26965d2da3 agrees with this
understanding.

If I understand correctly, Linux's /proc/stat is *not* the same as
/proc/$$/stat, so just moving it is wrong.
You'll need to create a new function which generates the appropriate
/proc/stat :-(

Nadav.

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to