fversion 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. .TH FVERSION 2
  2. .SH NAME
  3. fversion \- initialize 9P connection and negotiate version
  4. .SH SYNOPSIS
  5. .nf
  6. .PP
  7. .ft L
  8. #include <u.h>
  9. #include <libc.h>
  10. .PP
  11. .ft P
  12. .B
  13. int fversion(int fd, int bufsize, char *version, int nversion)
  14. .SH DESCRIPTION
  15. .PP
  16. .I Fversion
  17. is used to initialize the 9P connection represented by
  18. .I fd
  19. and to negotiate the version of the protocol to be used.
  20. .PP
  21. The
  22. .I bufsize
  23. determines the size of the I/O buffer used to stage 9P requests to the server,
  24. subject to the constraints of the server itself.
  25. The
  26. .I version
  27. is a text string that represents the highest version level the protocol will support.
  28. The
  29. .I version
  30. will be overwritten with the negotiated, possibly lower, version of the protocol.
  31. The return value of
  32. .I fversion
  33. is the length of the returned version string; the value of
  34. .I nversion
  35. is therefore not the length of the version string presented to the system call,
  36. but the total length of the buffer to accept the final result, in the manner of a read system call.
  37. .PP
  38. Default values of zero for
  39. .I bufsize
  40. and the empty string for
  41. .I version
  42. will negotiate sensible defaults for the connection.
  43. If
  44. .I version
  45. is the empty string,
  46. .I nversion
  47. must still be large enough to receive the returned version string.
  48. .PP
  49. The interpretation of the version strings is defined in
  50. .IR version (5).
  51. .PP
  52. It is rare to use
  53. .IR fversion
  54. directly; usually the default negotiation performed
  55. by the kernel during
  56. .B mount
  57. (see
  58. .IR bind (2))
  59. or even more commonly
  60. .B amount
  61. (see
  62. .IR auth (2))
  63. is sufficient.
  64. .SH SOURCE
  65. .B /sys/src/libc/9syscall
  66. .SH SEE ALSO
  67. .IR intro (5),
  68. .IR version (5),
  69. .IR fauth (2).
  70. .SH DIAGNOSTICS
  71. Sets
  72. .IR errstr .