Charles.Forsyth20060303-partialeea662d19 years agoHistory
77 lines · 1.6 KB · Text
RawDownload
.TH STYXCONV 2.SH NAMEstyxconv \- convert between old and new Styx.SH SYNOPSIS.EXinclude "styxconv.m";styxconv := load Styxconv Styxconv->PATH; init:     fn();styxconv: fn(to: ref Sys->FD, from: ref Sys->FD, pid: chan of int);.EE.SH DESCRIPTION.B Styxconvconverts between the previous version of the Styx protocol,as used for instance in Inferno's Third Edition and earlier,and the current version of the protocol,based on 9P2000 and defined by.IR intro (5)..PP.B Initmust be called before any other function in the module..PPThe function.B styxconvtakes two file descriptors..I Frommust be a connection to a file server that serves the original, olderversion of Styx..I Tois a connection, perhaps a pipe, to something that requires the current protocol;.B Sys->mountfor instance(see.IR sys-bind (1))..B Styxconvis spawned by the caller, to create a process that copies messages between.I fromand.IR to ,converting as required as it goes.Its process ID is the only message sent onchannel.IR pidc ;it must be received by.BR styxconv 'scaller.See the example below..SH EXAMPLEApply.B styxconvto file descriptor.I fdconnected to an old Styx server:.IP.EXcvstyx(fd: ref Sys->FD): ref Sys->FD{	styxconv := load Styxconv Styxconv->PATH;	if(styxconv == nil)		return nil;	p := array[2] of ref Sys->FD;	if(sys->pipe(p) < 0)		return nil;	styxconv->init();	pidc := chan of int;	spawn styxconv->styxconv(p[1], fd, pidc);	<-pidc;	return p[0];}.EE.SH SOURCE.B /appl/lib/styxconv.SH SEE ALSO.IR bind (1),.IR sys-bind (2),.IR sys-pipe (2),.IR intro (5)