fversion – initialize 9P connection and negotiate version
int fversion(int fd, int bufsize, char *version, int nversion)
is used to initialize the 9P connection represented by
and to negotiate the version of the protocol to be used.
determines the size of the I/O buffer used to stage 9P requests to the server,
subject to the constraints of the server itself.
is a text string that represents the highest version level the protocol will support.
will be overwritten with the negotiated, possibly lower, version of the protocol.
The return value of
is the length of the returned version string; the value of
is therefore not the length of the version string presented to the system call,
but the total length of the buffer to accept the final result, in the manner of a read system call.
Default values of zero for
and the empty string for
will negotiate sensible defaults for the connection.
is the empty string,
must still be large enough to receive the returned version string.
The interpretation of the version strings is defined in
It is rare to use
directly; usually the default negotiation performed
by the kernel during
or even more commonly