FVERSION(2)FVERSION(2)NAMEfversion - initialize 9P connection and negotiate version
int fversion(int fd, int bufsize, char *version, int nversion)
Fversion is used to initialize the 9P connection represented by fd and
to negotiate the version of the protocol to be used.
The bufsize determines the size of the I/O buffer used to stage 9P
requests to the server, subject to the constraints of the server
itself. The version is a text string that represents the highest ver‐
sion level the protocol will support. The version will be overwritten
with the negotiated, possibly lower, version of the protocol. The
return value of fversion is the length of the returned version string;
the value of nversion 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 bufsize and the empty string for version
will negotiate sensible defaults for the connection. If version is the
empty string, nversion must still be large enough to receive the
returned version string.
The interpretation of the version strings is defined in version(5).
It is rare to use fversion directly; usually the default negotiation
performed by the kernel during mount (see bind(2)) or even more com‐
monly amount (see auth(2)) is sufficient.
SEE ALSOintro(5), version(5), fauth(2).