From: "Roman V. Shaposhnik" <rvs@Sun.COM>
To: 9fans <9fans@9fans.net>
Subject: [9fans] mounting stdin using 9pfuse
Date: Fri, 3 Oct 2008 12:18:19 -0700 [thread overview]
Message-ID: <1223061499.22031.9.camel@goose.sun.com> (raw)
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.
next reply other threads:[~2008-10-03 19:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-03 19:18 Roman V. Shaposhnik [this message]
2008-10-05 15:35 ` sqweek
2008-10-06 3:46 ` Roman V. Shaposhnik
2008-10-06 4:56 ` sqweek
2008-10-06 16:31 ` Russ Cox
2008-10-07 3:47 ` Roman V. Shaposhnik
2008-10-07 7:48 ` sqweek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1223061499.22031.9.camel@goose.sun.com \
--to=rvs@sun.com \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).