5 ms·
Lots of the plan9 code is written in a style like this but with enums A bit tricky to find the best example on my phone while on the bus but here's a flavour,
by wendroid 17y ago
Lots of the plan9 code is written in a style like this but with enums
A bit tricky to find the best example on my phone while on the bus but here's a flavour, the in-memory file system
http://plan9.bell-labs.com/sources/plan9/sys/src/cmd/ramfs.c http://plan9.bell-labs.com/sources/plan9/sys/src/cmd/ramfs.c
Edit : can anyone see how to add a comment to the article, I wanted to share the above info with him but comments don't seem open to me now I'm at my desk.
The plan9 way uses an interface style, the sort that is made explicit in Go :
from http://plan9.bell-labs.com/sources/plan9/sys/src/cmd/nntpfs.c http://plan9.bell-labs.com/sources/plan9/sys/src/cmd/nntpfs....
Srv nntpsrv = {
.destroyfid= fsdestroyfid,
.attach= fsattach,
.clone= fsclone,
.walk1= fswalk1,
.open= fsopen,
.read= fsread,
.write= fswrite,
.stat= fsstat,
};
These file systems all run in user mode btw (as can all the disk based ones). Mycrotiv has even done a kernel with a built in rc shell that you attach your file systems after booting as yourself - a disk failure will not take down your system!
- cturner 17y agoOfftopic. That pipe(3) function I saw in ramfx.c is cool (http://swtch.com/plan9port/man/man3/pipe.html http://swtch.com/plan9port/man/man3/pipe.html). Bidirectional - unlike *nix. I think life would be easier if it were more straightforward to build applications as chains of little utilities with one-to-one protocols of integer exchange, rather than having to go to socket (more complex, and port management overhead) or file (ugly). I have a things-might-have-been-very-different feeling. When is Team Plan9 going to produce a distribution that we can get into using as easily as Linux or the BSD kernels? :) (Or would inferno be a better focus? Same issue though - it's not as easy as ubuntu or even small projects like haiku) Also offtopic - I like doing switch statements in python like this: def fn_a(input_tokens): pass def fn_b(input_tokens): pass user_cmd = raw_input().split() # look mum, no hands { 'a': fn_a , 'b': fn_b }[user_cmd[0]](usr_cmd)
- wendroid 17y agoThe notion you talk of with your integer exchange is called "channels" which are typed pipes. see http://plan9.bell-labs.com/magic/man2html/2/thread http://plan9.bell-labs.com/magic/man2html/2/thread for the C library On Inferno the Limbo language has channels as a type with their own operators Send an integer down chan <- = 5; and read it out i = <- chan I don't understand what you mean by "get into as easily". The distribution CD is also a Live CD so you can boot right into it. The kernel code can be understood by one person. There are commentaries such as http://lsub.org/who/nemo/papers.html http://lsub.org/who/nemo/papers.html It runs in qemu, vmware player, Xen, Lguest We are thinking of doing a qemu image release but not worked out an auto installation system quite yet (the distribution cd is rebuilt every night with the new commits). We have irc://irc.freenode.org/#plan9 for unofficial chat (though with the usual caveats) And a mailing list where you might get your question answered by Rob Pike, Dennis Ritchie, Russ Cox or one of the many knowledgable people involved in or using the project (plan9 runs on IBM's Blue Gene supercomputer for instance and is used at LANL, Sandanista, NASA JPL, MIT). There's also Russ' usermode projects : 9vx - http://swtch.com/9vx/ http://swtch.com/9vx/ a plan9 that runs in the vx32 x86 sandboxing environment and plan9port - http://swtch.com/plan9port/ http://swtch.com/plan9port/ - which is the plan9 user tools ported to Lunix I'd say that was a quite comprehensive set of "get into" tools :>
- deleted 17y ago[deleted]