URI: 
       tMac FUSE support (thanks to Jeff Sickel) - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 9b3fcf01c5d22d7be320a0e194cc54579f71c409
   DIR parent e290e875f350dbbc2288ec988d939a57cc8f9bf2
  HTML Author: rsc <devnull@localhost>
       Date:   Thu, 18 Jan 2007 12:52:54 +0000
       
       Mac FUSE support (thanks to Jeff Sickel)
       
       Diffstat:
         M bin/mount                           |       5 +++++
         M bin/unmount                         |       4 ++--
         M man/man4/9pfuse.4                   |       3 +++
         M src/cmd/9pfuse/fuse.c               |      49 +++++++++++++++++++++++++++++++
         M src/libthread/Darwin-386.c          |       1 -
       
       5 files changed, 59 insertions(+), 3 deletions(-)
       ---
   DIR diff --git a/bin/mount b/bin/mount
       t@@ -18,6 +18,11 @@ case FreeBSD
                if(kldstat|9 grep -si ' fuse')
                        exec 9pfuse $1 $2
                echo 'don''t know how to mount (no fuse)' >[1=2]
       +case Darwin
       +        if(sysctl fuse.version >[2=1] |9 grep -si 'fuse.version' ||
       +           test -d /System/Library/Extensions/fusefs.kext)
       +                exec 9pfuse $1 $2
       +        echo 'don''t know how to mount (no fuse)' >[1=2]
        case *
                echo 'can''t mount on' `{uname} >[1=2]
        }
   DIR diff --git a/bin/unmount b/bin/unmount
       t@@ -1,10 +1,10 @@
       -#!/usr/local/plan9/bin/rc
       +l#!/usr/local/plan9/bin/rc
        
        if(! ~ $#* 1){
                echo 'usage: unmount mtpt' >[1=2]
                exit usage
        }
        f=`{u mount | grep $1}
       -if(echo $f | 9 grep -s 'type fuse')
       +if(echo $f | 9 grep -s 'type fuse' && ! ~ `{uname} Darwin)
                exec fusermount -u -z $1
        exec u umount $1
   DIR diff --git a/man/man4/9pfuse.4 b/man/man4/9pfuse.4
       t@@ -58,5 +58,8 @@ FUSE Homepage,
        .PP
        FUSE for FreeBSD,
        .HR http://fuse4bsd.creo.hu
       +.PP
       +MacFUSE,
       +.HR http://code.google.com/p/macfuse
        .SH SOURCE
        .B \*9/src/cmd/9pfuse
   DIR diff --git a/src/cmd/9pfuse/fuse.c b/src/cmd/9pfuse/fuse.c
       t@@ -742,6 +742,11 @@ fusefmt(Fmt *fmt)
                return 0;
        }
        
       +#if defined(__APPLE__)
       +#include <sys/param.h>
       +#include <sys/mount.h>
       +#endif
       +
        /*
         * Mounts a fuse file system on mtpt and returns
         * a file descriptor for the corresponding fuse 
       t@@ -788,6 +793,50 @@ mountfuse(char *mtpt)
                        _exit(1);
                }
                return fd;
       +#elif defined(__APPLE__)
       +        int i, pid, fd, r;
       +        char buf[20];
       +        struct vfsconf vfs;
       +        
       +        if(getvfsbyname("fusefs", &vfs) < 0){
       +                if((r=system("/System/Library/Extensions/fusefs.kext"
       +                                "/Contents/Resources/load_fusefs")) < 0){
       +                        werrstr("load fusefs: %r");
       +                        return -1;
       +                }
       +                if(r != 0){
       +                        werrstr("load_fusefs failed: exit %d", r);
       +                        return -1;
       +                }
       +                if(getvfsbyname("fusefs", &vfs) < 0){
       +                        werrstr("getvfsbyname fusefs: %r");
       +                        return -1;
       +                }
       +        }
       +        
       +        /* Look for available FUSE device. */
       +        for(i=0;; i++){
       +                snprint(buf, sizeof buf, "/dev/fuse%d", i);
       +                if(access(buf, 0) < 0){
       +                        werrstr("no available fuse devices");
       +                        return -1;
       +                }
       +                if((fd = open(buf, ORDWR)) >= 0)
       +                        break;
       +        }
       +
       +        pid = fork();
       +        if(pid < 0)
       +                return -1;
       +        if(pid == 0){
       +                snprint(buf, sizeof buf, "%d", fd);
       +                putenv("MOUNT_FUSEFS_CALL_BY_LIB", "");
       +                execl("mount_fusefs", "mount_fusefs", buf, mtpt, nil);
       +                fprint(2, "exec mount_fusefs: %r\n");
       +                _exit(1);
       +        }
       +        return fd;
       +        
        #else
                werrstr("cannot mount fuse on this system");
                return -1;
   DIR diff --git a/src/libthread/Darwin-386.c b/src/libthread/Darwin-386.c
       t@@ -3,7 +3,6 @@
        void
        makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
        {
       -        int n;
                int *sp;
        
                sp = (int*)ucp->uc_stack.ss_sp+ucp->uc_stack.ss_size/4;