Becoming an NFS server

I’m trying to write a user-space file system for a school project, and I’m going to do this on OS X. FUSE doesn’t seem to have been ported to OS X yet, so I’m trying instead to write it as a user-land NFS server. This seems to be problematic, though, so I’m asking you for help, my dear lazyweb:

I’ve used rpcgen on the NFS v2 XDF description to generate the stub code. This seems obvious enough: it generates a bunch of svc stubs that I need to implement, to implement the functionality of my file system. It does its magic by unregistering any other NFS server with portmap:

(void) pmap_unset(NFS_PROGRAM, NFS_VERSION);

Then it wraps up my socket (which I bind to 127.0.0.1, because I only want it available locally) into SVCXPRT object, and I pass this to:

svc_register(transp, NFS_PROGRAM, NFS_VERSION, nfs_program_2, IPPROTO_UDP)

Now, pmap_unset and svc_register both try to talk to the portmapper, which isn’t running on my machine, so they both hang for about a minute, then exit with a failure. Trying to launch portmap by hand results in:

portmap[1124]: PID 441 started this second instance of portmap (the first instance may not be running, as it launches on demand via launchd), exiting!

That’s nice. Thanks, Apple.

So, I have a variety of questions:

  • Do I really need portmap (and mountd, I guess) running? Or can I just write my damn NFS server, and tell Finder to mount it, with the port number I’m listening on?
  • Has anyone else ever successfully written a user-space NFS server to implement a file system like this? Is your code available?
  • More generally, is there a toolkit that lets you more easily write NFS based file systems?
  • Apple says that launchd automatically starts portmap when it is needed, which is full of lies. How can I really make it launch portmap?

Edit: why are all NFS-related packages dead on the Internet? Neither the “Universal” NFS server (a user-space NFS server), nor portmap seem to exist anywhere on the Internet. I can get the source for these from Debian, and through Apple’s open source page, but are these packages otherwise dead?