> Ok, I can understand why devproc.c does it: it is easy to discover the
> name of the actual Chan if you know the node in /srv:
>    fd = open("#s/stuff", OREAD);
>    fd2chan(fd, buf, sizeof(buf));
>    close(fd);
> but not the other way around. Buit why ns(1) doesn't have the above
> code?

i assume that you mean fd2path.  as in

minooka; cat fd2path.c
#include <u.h>
#include <libc.h>

void
main(void)
{
        char buf[1024];
        int fd;

        fd = open ("#s/boot", OREAD);
        if(fd != -1 && fd2path(fd, buf, sizeof buf) != -1)
                fprint(2, "%s\n", buf);
        close(fd);
        exits("");
}
minooka; fd2path
/net/il/0/data

i think the answer to your question is that it's a lot more useful
to know that it's #s/boot rather than /net/il/0/data.  generally
one cares more about what it does than the particulars of the
connection.  the fact that #s/boot is the 0th il connection and
not the nth wouldn't matter much unless you were debugging
the ip stack.

or is there some reason why this is interesting that i'm missing?

- erik


Reply via email to