STYXCONV(2) STYXCONV(2)
NAME
styxconv - convert between old and new Styx
SYNOPSIS
include "styxconv.m";
styxconv := load Styxconv Styxconv->PATH;
init: fn();
styxconv: fn(to: ref Sys->FD, from: ref Sys->FD, pid: chan of int);
DESCRIPTION
Styxconv converts 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 intro(5).
Init must be called before any other function in the module.
The function styxconv takes two file descriptors. From must
be a connection to a file server that serves the original,
older version of Styx. To is a connection, perhaps a pipe,
to something that requires the current protocol; Sys->mount
for instance (see sys-bind(1)). Styxconv is spawned by the
caller, to create a process that copies messages between
from and to, converting as required as it goes. Its process
ID is the only message sent on channel pidc; it must be
received by styxconv's caller. See the example below.
EXAMPLE
Apply styxconv to file descriptor fd connected to an old
Styx server:
cvstyx(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];
}
SOURCE
/appl/lib/styxconv
Page 1 Plan 9 (printed 10/25/25)
STYXCONV(2) STYXCONV(2)
SEE ALSO
bind(1), sys-bind(2), sys-pipe(2), intro(5)
Page 2 Plan 9 (printed 10/25/25)