term% cat index.txt FVERSION(2) System Calls Manual FVERSION(2)
NAME
fversion - initialize 9P connection and negotiate version
SYNOPSIS
#include <u.h>
#include <libc.h>
int fversion(int fd, int bufsize, char *version, int nversion)
DESCRIPTION
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 re‐
quests to the server, subject to the constraints of the server itself.
The version is a text string that represents the highest version 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 re‐
turned 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.
SOURCE
/sys/src/libc/9syscall
SEE ALSO
intro(5), version(5), fauth(2).
DIAGNOSTICS
Sets errstr.
FVERSION(2)