Guys,
it appears that I'm missing something fundamental in how
9pfuse (the one written by Russ) works when it is given
"-" as an address. The source looks like it should be
simply using stdin for R/W instead of dialing out the
connection first, but it doesn't really seem to work.
Here's the simplest way of reproducing what I'm
seeing:
$ cat connector.c
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <error.h>
#include <errno.h>
void socket012(int fd)
{
int i;
for (i=0; i<3; i++) {
close(i);
dup2(fd, i);
}
close(fd);
}
int main()
{
int fd[2];
if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNIX, fd) < 0)
error(-1, errno, "socketpair failed");
if (fork()) {
socket012(fd[0]);
execlp("9pfuse", "9pfuse", "-", "/tmp/fuse", (char*)0);
} else {
socket012(fd[1]);
execlp("ramfs", "ramfs", "-i", (char*)0);
}
}
$ cc connector.c
$ ./a.out
Now, in a different terminal I do this:
# ls /tmp/fuse
ls: cannot access /tmp/fuse: Permission denied
Also apparently the processes are there (although
a zombie ramfs looks suspicious -- the second ramfs
is fully functional):
$ ps -alef | egrep "9p|ramfs"
0 S roman 22661 18264 0 78 0 - 2575 wait 12:13 pts/4 00:00:00
9pfuse -D - /tmp/fuse
1 S roman 22663 22661 0 78 0 - 12906 stext 12:13 ? 00:00:00
9pfuse -D - /tmp/fuse
1 S roman 22666 1 0 79 0 - 2725 - 12:13 pts/4 00:00:00 ramfs
-i
0 Z roman 22662 22661 0 78 0 - 0 exit 12:13 pts/4 00:00:00
[ramfs] <defunct>
Now, if I enable -D in 9pfuse (by dup2'ing only 0 instead of
0,1 and 2) here's the output I get:
<- Tversion tag 0 msize 8192 version '9P2000.u'
-> Rversion tag 65535 msize 8192 version '9P2000'
<- Tattach tag 0 fid 0 afid -1 uname roman aname
-> Rattach tag 0 qid (0000000000000000 0 d)
FUSE -> len 16 unique 0x1 uid 0 gid 0 pid 0 Init major 7 minor 8
FUSE <- unique 0x1 (Init) major 7 minor 5 max_write 4096
And it stops there no matter what I do from then on.
Well, I'm baffled. Any help would be tremendously appreciated.
Thanks,
Roman.