diff options
author | Petter Rodhelind <petter.rodhelind@gmail.com> | 2021-02-18 20:21:24 +0100 |
---|---|---|
committer | Petter Rodhelind <petter.rodhelind@gmail.com> | 2021-02-18 20:21:24 +0100 |
commit | 181d56ee64da53279bb6ecf49c24ab54cfb7193f (patch) | |
tree | fc6c8736bb97790a257c5514998c583ffce7c41c /src/cmd/9pfuse | |
parent | 94c521bf102a74aec7e1a5c3a9ef5eaa968d4e14 (diff) | |
parent | 90971376a5e8620fc62579aa1b3be26245ec8c06 (diff) | |
download | plan9port-181d56ee64da53279bb6ecf49c24ab54cfb7193f.tar.gz plan9port-181d56ee64da53279bb6ecf49c24ab54cfb7193f.tar.bz2 plan9port-181d56ee64da53279bb6ecf49c24ab54cfb7193f.zip |
Diffstat (limited to 'src/cmd/9pfuse')
-rw-r--r-- | src/cmd/9pfuse/fuse.c | 31 | ||||
-rw-r--r-- | src/cmd/9pfuse/main.c | 6 |
2 files changed, 36 insertions, 1 deletions
diff --git a/src/cmd/9pfuse/fuse.c b/src/cmd/9pfuse/fuse.c index 4c9aac9b..ea8e3bbf 100644 --- a/src/cmd/9pfuse/fuse.c +++ b/src/cmd/9pfuse/fuse.c @@ -798,16 +798,19 @@ mountfuse(char *mtpt) } return fd; #elif defined(__APPLE__) - int i, pid, fd, r; + int i, pid, fd, r, p[2]; char buf[20]; struct vfsconf vfs; char *f, *v; if(getvfsbyname(v="osxfusefs", &vfs) < 0 && + getvfsbyname(v="macfuse", &vfs) < 0 && getvfsbyname(v="osxfuse", &vfs) < 0 && getvfsbyname(v="fusefs", &vfs) < 0){ if(access((v="osxfusefs", f="/Library/Filesystems/osxfusefs.fs" "/Support/load_osxfusefs"), 0) < 0 && + access((v="macfuse", f="/Library/Filesystems/macfuse.fs" + "/Contents/Resources/load_macfuse"), 0) < 0 && access((v="osxfuse", f="/Library/Filesystems/osxfuse.fs" "/Contents/Resources/load_osxfuse"), 0) < 0 && access((v="osxfuse", f="/opt/local/Library/Filesystems/osxfuse.fs" @@ -837,6 +840,32 @@ mountfuse(char *mtpt) } } + /* MacFUSE >=4 dropped support for passing fd */ + if (strcmp(v, "macfuse") == 0) { + if(socketpair(AF_UNIX, SOCK_STREAM, 0, p) < 0) + return -1; + pid = fork(); + if(pid < 0) + return -1; + if(pid == 0){ + close(p[1]); + snprint(buf, sizeof buf, "%d", p[0]); + putenv("_FUSE_COMMFD", buf); + putenv("_FUSE_COMMVERS", "2"); + putenv("_FUSE_CALL_BY_LIB", "1"); + putenv("_FUSE_DAEMON_PATH", + "/Library/Filesystems/macfuse.fs/Contents/Resources/mount_macfus"); + execl("/Library/Filesystems/macfuse.fs/Contents/Resources/mount_macfuse", + "mount_macfuse", mtpt, nil); + fprint(2, "exec mount_macfuse: %r\n"); + _exit(1); + } + close(p[0]); + fd = recvfd(p[1]); + close(p[1]); + return fd; + } + /* Look for available FUSE device. */ /* * We need to truncate `fs` from the end of the vfs name if diff --git a/src/cmd/9pfuse/main.c b/src/cmd/9pfuse/main.c index 69d1ad75..4fa330a0 100644 --- a/src/cmd/9pfuse/main.c +++ b/src/cmd/9pfuse/main.c @@ -98,6 +98,12 @@ usage(void) void fusereader(void*); void watchfd(void*); +int +threadmaybackground(void) +{ + return 1; +} + void threadmain(int argc, char **argv) { |