- From ff60d93e2556e8ff61a526735979a6c33bc2d7ee Mon Sep 17 00:00:00 2001
 - From: Roland Mainz <roland.mainz@nrubsig.org>
 - Date: Thu, 21 Mar 2024 12:26:45 +0100
 - Subject: [PATCH 1/3] tests: Document workaround for sporadic gcc build
 - failures (gcc bugzilla #114381)
 - Document workaround (configure option "--disable-libstdcxx-pch") for
 - sporadic gcc build failures when building
 - "x86_64-pc-cygwin/bits/extc++.h.gch/O2g.gch".
 - See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114381
 - ("(Sporadic) crash generating x86_64-pc-cygwin/bits/extc++.h.gch/O2g.gch")
 - Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
 - ---
 - tests/manual_testing.txt | 5 ++++-
 - 1 file changed, 4 insertions(+), 1 deletion(-)
 - diff --git a/tests/manual_testing.txt b/tests/manual_testing.txt
 - index 8ebe9a6..f8fc3b8 100644
 - --- a/tests/manual_testing.txt
 - +++ b/tests/manual_testing.txt
 - @@ -204,6 +204,9 @@ MSBuild.exe build.vc19/nfs41-client.sln -t:Build -p:Configuration=Release -p:Pl
 - # max_path_length=131
 - # ---- snip ----
 - # - Full build can easily take ~~16 hours minutes
 - +# - Option "--disable-libstdcxx-pch" is used due to bug
 - +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114381 ("(Sporadic)
 - +# crash generating x86_64-pc-cygwin/bits/extc++.h.gch/O2g.gch")
 - #
 - git clone -b 'releases/gcc-13.2.0' git://gcc.gnu.org/git/gcc.git
 - cd gcc/
 - @@ -212,7 +215,7 @@ cd gcc/
 - # ancient workarounds for issues which no longer exists)
 - (set -o xtrace ; sed -i "s/as_ln_s='cp -pR'/as_ln_s='ln -s'/g" $(find . -name configure) )
 - # run configure
 - -./configure
 - +./configure --disable-libstdcxx-pch
 - # repeat:
 - make -j4 clean
 - (yes | make -j32 all)
 - --
 - 2.43.0
 - From 201309492f1c8a14bbb2b8f2d3ee3080530bee83 Mon Sep 17 00:00:00 2001
 - From: Roland Mainz <roland.mainz@nrubsig.org>
 - Date: Thu, 21 Mar 2024 12:36:53 +0100
 - Subject: [PATCH 2/3] daemon: Add WinNT major/minor/buildnumber+hostname to
 - |nii_name|
 - Add WinNT major/minor/buildnumber+hostname to |nii_name|.
 - Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
 - ---
 - build.vc19/nfsd/nfsd.vcxproj | 8 ++--
 - daemon/nfs41_daemon.c | 92 +++++++++++++++++++++++-------------
 - daemon/util.c | 24 ++++++++++
 - daemon/util.h | 4 ++
 - 4 files changed, 91 insertions(+), 37 deletions(-)
 - diff --git a/build.vc19/nfsd/nfsd.vcxproj b/build.vc19/nfsd/nfsd.vcxproj
 - index ea755d1..ee7a8be 100644
 - --- a/build.vc19/nfsd/nfsd.vcxproj
 - +++ b/build.vc19/nfsd/nfsd.vcxproj
 - @@ -97,7 +97,7 @@
 - <Link>
 - <SubSystem>Console</SubSystem>
 - <GenerateDebugInformation>true</GenerateDebugInformation>
 - - <AdditionalDependencies>iphlpapi.lib;ws2_32.lib;wldap32.lib;..\$(Configuration)\libtirpc.lib;%(AdditionalDependencies)</AdditionalDependencies>
 - + <AdditionalDependencies>iphlpapi.lib;ws2_32.lib;wldap32.lib;ntdll.lib;..\$(Configuration)\libtirpc.lib;%(AdditionalDependencies)</AdditionalDependencies>
 - </Link>
 - </ItemDefinitionGroup>
 - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
 - @@ -116,7 +116,7 @@
 - <Link>
 - <SubSystem>Console</SubSystem>
 - <GenerateDebugInformation>true</GenerateDebugInformation>
 - - <AdditionalDependencies>iphlpapi.lib;ws2_32.lib;wldap32.lib;..\$(Platform)\$(Configuration)\libtirpc.lib;%(AdditionalDependencies)</AdditionalDependencies>
 - + <AdditionalDependencies>iphlpapi.lib;ws2_32.lib;wldap32.lib;ntdll.lib;..\$(Platform)\$(Configuration)\libtirpc.lib;%(AdditionalDependencies)</AdditionalDependencies>
 - </Link>
 - </ItemDefinitionGroup>
 - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
 - @@ -138,7 +138,7 @@
 - <GenerateDebugInformation>true</GenerateDebugInformation>
 - <EnableCOMDATFolding>true</EnableCOMDATFolding>
 - <OptimizeReferences>true</OptimizeReferences>
 - - <AdditionalDependencies>iphlpapi.lib;ws2_32.lib;wldap32.lib;..\$(Configuration)\libtirpc.lib;%(AdditionalDependencies)</AdditionalDependencies>
 - + <AdditionalDependencies>iphlpapi.lib;ws2_32.lib;wldap32.lib;ntdll.lib;..\$(Configuration)\libtirpc.lib;%(AdditionalDependencies)</AdditionalDependencies>
 - </Link>
 - </ItemDefinitionGroup>
 - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
 - @@ -160,7 +160,7 @@
 - <GenerateDebugInformation>true</GenerateDebugInformation>
 - <EnableCOMDATFolding>true</EnableCOMDATFolding>
 - <OptimizeReferences>true</OptimizeReferences>
 - - <AdditionalDependencies>iphlpapi.lib;ws2_32.lib;wldap32.lib;..\$(Platform)\$(Configuration)\libtirpc.lib;%(AdditionalDependencies)</AdditionalDependencies>
 - + <AdditionalDependencies>iphlpapi.lib;ws2_32.lib;wldap32.lib;ntdll.lib;..\$(Platform)\$(Configuration)\libtirpc.lib;%(AdditionalDependencies)</AdditionalDependencies>
 - </Link>
 - </ItemDefinitionGroup>
 - <ItemGroup>
 - diff --git a/daemon/nfs41_daemon.c b/daemon/nfs41_daemon.c
 - index 9ba7885..5b9c48d 100644
 - --- a/daemon/nfs41_daemon.c
 - +++ b/daemon/nfs41_daemon.c
 - @@ -523,59 +523,85 @@ void nfsd_crt_debug_init(void)
 - static
 - void init_version_string(void)
 - {
 - - char uname_buff[256];
 - - char *s;
 - - DWORD buff_read;
 - + DWORD WinNT_MajorVersion = 0;
 - + DWORD WinNT_MinorVersion = 0;
 - + DWORD WinNT_BuildNumber = 0;
 - + char *niin_ptr = nfs41_dg.nfs41_nii_name;
 - + char hostnamebuf[128];
 - +
 - +#define IVS_REMAINING_NIINAME_BYTES \
 - + (sizeof(nfs41_dg.nfs41_nii_name) - (niin_ptr-nfs41_dg.nfs41_nii_name))
 - +
 - + /*
 - + * Add our own name
 - + */
 - + niin_ptr += snprintf(niin_ptr, IVS_REMAINING_NIINAME_BYTES,
 - + "msnfs41client 0.1");
 - +
 - + /* FIXME: Add git tag */
 - /*
 - - * gisburn: fixme:
 - - * We should get the Windows version numbers from the
 - - * Windows registry, unfortunately this is going to be a
 - - * another variantion of vesion hell, as |GetVersionEx()|
 - - * is depreciated
 - + * Add Windows version numbers
 - */
 - - subcmd_popen_context *scmd_uname = subcmd_popen("C:\\cygwin64\\bin\\uname.exe -a");
 - + if (getwinntversionnnumbers(&WinNT_MajorVersion,
 - + &WinNT_MinorVersion, &WinNT_BuildNumber)) {
 - + niin_ptr += snprintf(niin_ptr, IVS_REMAINING_NIINAME_BYTES,
 - + ", WinNT %u.%u-%u",
 - + (unsigned int)WinNT_MajorVersion,
 - + (unsigned int)WinNT_MinorVersion,
 - + (unsigned int)WinNT_BuildNumber);
 - + }
 - +
 - + /*
 - + * Add hostname
 - + */
 - + if (!gethostname(hostnamebuf, sizeof(hostnamebuf))) {
 - + niin_ptr += snprintf(niin_ptr, IVS_REMAINING_NIINAME_BYTES,
 - + ", hostname='%s'", hostnamebuf);
 - + }
 - +
 - +#ifdef NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN
 - + /*
 - + * Add cygwin version, if Cygwin idmapper is enabled
 - + */
 - + subcmd_popen_context *scmd_uname =
 - + subcmd_popen("C:\\cygwin64\\bin\\uname.exe -a");
 - if (scmd_uname) {
 - + char unamebuf[256];
 - + char *s;
 - + DWORD buff_read;
 - +
 - buff_read = 0;
 - - if (subcmd_readcmdoutput(scmd_uname, uname_buff, sizeof(uname_buff), &buff_read)) {
 - + if (subcmd_readcmdoutput(scmd_uname, unamebuf,
 - + sizeof(unamebuf)-1, &buff_read)) {
 - /* Remove trailing newline */
 - - if ((buff_read > 0) && (uname_buff[buff_read-1] == '\n'))
 - - uname_buff[buff_read-1] = '\0';
 - + if ((buff_read > 0) && (unamebuf[buff_read-1] == '\n'))
 - + unamebuf[buff_read-1] = '\0';
 - else
 - - uname_buff[buff_read] = '\0';
 - + unamebuf[buff_read] = '\0';
 - /* Stomp newline&co. */
 - - for (s = uname_buff ; *s != '\0' ; s++) {
 - + for (s = unamebuf ; *s != '\0' ; s++) {
 - if ((*s == '\n') || (*s == '\r'))
 - *s = ' ';
 - }
 - +
 - + niin_ptr += snprintf(niin_ptr, IVS_REMAINING_NIINAME_BYTES,
 - + ", cygwin_vers='%s'", unamebuf);
 - }
 - else {
 - - eprintf("init_version_string: subcmd_readcmdoutput() for 'uname -a' failed\n");
 - - uname_buff[0] = '\0';
 - + eprintf("init_version_string: subcmd_readcmdoutput() "
 - + "for 'uname -a' failed\n");
 - + unamebuf[0] = '\0';
 - }
 - subcmd_pclose(scmd_uname);
 - }
 - else {
 - - eprintf("init_version_string: subcmd_popen() for 'uname -a' failed\n");
 - - uname_buff[0] = '\0';
 - + eprintf("init_version_string: subcmd_popen() for "
 - + "'uname -a' failed\n");
 - }
 - +#endif /* NFS41_DRIVER_FEATURE_IDMAPPER_CYGWIN */
 - - /*
 - - * gisburn: fixme:
 - - * 1. We should include cygwin uname output only in Cygwin mode
 - - * 2. We should determinate the Windows version numvber ourselves
 - - * 3. We should include our own version and git tag
 - - * 4. We should honor RFC5661: "... it is RECOMMENDED
 - - * that the nii_name be used to distinguish machine architecture,
 - - * machine platforms, revisions, versions, and patch levels. The
 - - * nii_date field is the timestamp of when the software instance
 - - * was published or built..."
 - - */
 - - (void)snprintf(nfs41_dg.nfs41_nii_name,
 - - sizeof(nfs41_dg.nfs41_nii_name),
 - - "msnfs41client 0.1 WinNT NFSv4.1 client, cygwin_vers='%s'",
 - - uname_buff);
 - DPRINTF(1, ("init_version_string: versionstring='%s'\n",
 - nfs41_dg.nfs41_nii_name));
 - }
 - diff --git a/daemon/util.c b/daemon/util.c
 - index e2774d0..382944a 100644
 - --- a/daemon/util.c
 - +++ b/daemon/util.c
 - @@ -628,3 +628,27 @@ bool_t waitcriticalsection(LPCRITICAL_SECTION cs)
 - }
 - return cs_locked;
 - }
 - +
 - +/*
 - + * Get WinNT version numbers
 - + *
 - + * We use this wrapper function because |RtlGetNtVersionNumbers()|
 - + * is a private API, but it should be safe to use as Cygwin and
 - + * other software relies on it
 - + */
 - +bool getwinntversionnnumbers(
 - + DWORD *MajorVersionPtr,
 - + DWORD *MinorVersionPtr,
 - + DWORD *BuildNumberPtr)
 - +{
 - + NTSTATUS RtlGetNtVersionNumbers(LPDWORD, LPDWORD, LPDWORD);
 - +
 - + /*
 - + * Reference:
 - + * https://cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/wincap.cc
 - + */
 - + (void)RtlGetNtVersionNumbers(MajorVersionPtr, MinorVersionPtr, BuildNumberPtr);
 - + *BuildNumberPtr &= 0xffff;
 - +
 - + return true;
 - +}
 - diff --git a/daemon/util.h b/daemon/util.h
 - index 2bc2ec9..73bfc54 100644
 - --- a/daemon/util.h
 - +++ b/daemon/util.h
 - @@ -22,6 +22,8 @@
 - #ifndef __NFS41_DAEMON_UTIL_H__
 - #define __NFS41_DAEMON_UTIL_H__
 - +#include <stdbool.h>
 - +
 - #include "nfs41_types.h"
 - #include "from_kernel.h"
 - @@ -269,4 +271,6 @@ BOOL subcmd_readcmdoutput(subcmd_popen_context *pinfo, char *buff, size_t buff_s
 - bool_t waitSRWlock(PSRWLOCK srwlock);
 - bool_t waitcriticalsection(LPCRITICAL_SECTION cs);
 - +bool getwinntversionnnumbers(DWORD *MajorVersionPtr, DWORD *MinorVersionPtr, DWORD *BuildNumberPtr);
 - +
 - #endif /* !__NFS41_DAEMON_UTIL_H__ */
 - --
 - 2.43.0
 - From 3736f9402c213c2929fce4d1d46241d2e87f2fde Mon Sep 17 00:00:00 2001
 - From: Roland Mainz <roland.mainz@nrubsig.org>
 - Date: Thu, 21 Mar 2024 14:20:01 +0100
 - Subject: [PATCH 3/3] libtirpc: Add new build option
 - "NFS41_DRIVER_USE_LARGE_SOCKET_RCVSND_BUFFERS"
 - Add new build option "NFS41_DRIVER_USE_LARGE_SOCKET_RCVSND_BUFFERS".
 - It enables the use of fixed-size large buffers for socket receive and
 - send buffers.
 - Using a large fixed-size buffer avoids the erratic behaviour
 - caused by automatic scaling, and avoids that the code
 - spends lots of time waiting for the data to be split into
 - smaller chunks - this results in much reduced LATENCY.
 - Another benefit is that this gives a larger TCP window
 - (as Windows has no public API to set the TCP window size
 - per socket), resulting in better performance over WLAN
 - connections.
 - This still needs detailed testing for performace (and more important)
 - reduced latency.
 - Signed-off-by: Cedric Blancher <cedric.blancher@gmail.com>
 - ---
 - libtirpc/src/clnt_generic.c | 4 +-
 - libtirpc/src/svc_vc.c | 19 ++++--
 - libtirpc/src/wintirpc.c | 132 ++++++++++++++++++++++++++++++++++++
 - libtirpc/tirpc/wintirpc.h | 1 +
 - nfs41_build_features.h | 16 +++++
 - 5 files changed, 165 insertions(+), 7 deletions(-)
 - diff --git a/libtirpc/src/clnt_generic.c b/libtirpc/src/clnt_generic.c
 - index 2e64b11..fca8707 100644
 - --- a/libtirpc/src/clnt_generic.c
 - +++ b/libtirpc/src/clnt_generic.c
 - @@ -356,7 +356,6 @@ clnt_tli_create(const int fd_in, const struct netconfig *nconf,
 - CLIENT *cl; /* client handle */
 - bool_t madefd = FALSE; /* whether fd opened here */
 - long servtype;
 - - BOOL one = TRUE;
 - struct __rpc_sockinfo si;
 - extern int __rpc_minfd;
 - int fd = fd_in;
 - @@ -404,8 +403,7 @@ clnt_tli_create(const int fd_in, const struct netconfig *nconf,
 - if (nconf &&
 - ((strcmp(nconf->nc_protofmly, "inet") == 0) ||
 - (strcmp(nconf->nc_protofmly, "inet6") == 0))) {
 - - wintirpc_setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (const char *)&one,
 - - sizeof (one));
 - + wintirpc_setnfsclientsockopts(fd);
 - }
 - cl = clnt_vc_create(fd, svcaddr, prog, vers, sendsz, recvsz,
 - callback_xdr, callback_function, callback_args);
 - diff --git a/libtirpc/src/svc_vc.c b/libtirpc/src/svc_vc.c
 - index 83c58fe..9ea907f 100644
 - --- a/libtirpc/src/svc_vc.c
 - +++ b/libtirpc/src/svc_vc.c
 - @@ -356,10 +356,21 @@ again:
 - __xprt_set_raddr(newxprt, &addr);
 - - if (__rpc_fd2sockinfo(sock, &si) && si.si_proto == IPPROTO_TCP) {
 - - len = 1;
 - - /* XXX fvdl - is this useful? */
 - - wintirpc_setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (const char *)&len, sizeof (len));
 - + if (__rpc_fd2sockinfo(sock, &si)) {
 - + if (si.si_proto == IPPROTO_TCP) {
 - + wintirpc_setnfsclientsockopts(sock);
 - + }
 - + else {
 - + wintirpc_warnx("rendezvous_request: "
 - + "Unexpected sock=%d, si.si_proto=%d\n",
 - + sock,
 - + (int)si.si_proto);
 - + }
 - + }
 - + else {
 - + wintirpc_warnx("rendezvous_request: "
 - + "__rpc_fd2sockinfo(sock=%d) failed\n",
 - + sock);
 - }
 - cd = (struct cf_conn *)newxprt->xp_p1;
 - diff --git a/libtirpc/src/wintirpc.c b/libtirpc/src/wintirpc.c
 - index 003958a..88fac01 100644
 - --- a/libtirpc/src/wintirpc.c
 - +++ b/libtirpc/src/wintirpc.c
 - @@ -25,6 +25,8 @@
 - #include <stdio.h>
 - #include <winsock.h>
 - +#include "../../nfs41_build_features.h"
 - +
 - WSADATA WSAData;
 - static int init = 0;
 - @@ -396,6 +398,136 @@ int wintirpc_setsockopt(int socket, int level, int option_name,
 - option_value, option_len);
 - }
 - +void wintirpc_setnfsclientsockopts(int sock)
 - +{
 - + DWORD one;
 - + int rcvbufvalue;
 - + int sndbufvalue;
 - + socklen_t bufsize;
 - +
 - + one = 1;
 - + /* XXX fvdl - is this useful? */
 - + if (wintirpc_setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,
 - + (const char *)&one, sizeof(one)))
 - + wintirpc_warnx("wintirpc_setnfsclientsockopts(sock=%d):"
 - + " Error setting TCP_NODELAY\n", sock);
 - +
 - + /* gisburn: Is this useful ? */
 - + one = 1;
 - + if (wintirpc_setsockopt(sock, IPPROTO_TCP, TCP_TIMESTAMPS,
 - + (const char *)&one, sizeof(one)))
 - + wintirpc_warnx("wintirpc_setnfsclientsockopts(sock=%d):"
 - + " Error setting TCP_TIMESTAMPS\n", sock);
 - +
 - +#ifdef NFS41_DRIVER_USE_LARGE_SOCKET_RCVSND_BUFFERS
 - + /*
 - + * Print default values
 - + */
 - + rcvbufvalue = 0;
 - + bufsize = sizeof(rcvbufvalue);
 - + if (wintirpc_getsockopt(sock, SOL_SOCKET, SO_RCVBUF,
 - + (char *)&rcvbufvalue, &bufsize))
 - + wintirpc_warnx("wintirpc_setnfsclientsockopts(sock=%d):"
 - + " Error getting SO_RCVBUF\n", sock);
 - +
 - + sndbufvalue = 0;
 - + bufsize = sizeof(sndbufvalue);
 - + if (wintirpc_getsockopt(sock, SOL_SOCKET, SO_SNDBUF,
 - + (char *)&sndbufvalue, &bufsize))
 - + wintirpc_warnx("wintirpc_setnfsclientsockopts(sock=%d):"
 - + " Error getting SO_SNDBUF\n", sock);
 - +
 - +#ifdef _DEBUG
 - + (void)printf("wintirpc_setnfsclientsockopts(sock=%d): "
 - + "SO_RCVBUF=%d\n", sock, (int)rcvbufvalue);
 - + (void)printf("wintirpc_setnfsclientsockopts(sock=%d): "
 - + "SO_SNDBUF=%d\n", sock, (int)sndbufvalue);
 - +#endif
 - +
 - + /*
 - + * Set socket rcv and snd buffer sizes to 8M if the current
 - + * value is smaller
 - + *
 - + * Windows 10 defaults to 64k, which is far too small for most
 - + * NFS read&&write requests, which causes significant delays
 - + * for each request
 - + *
 - + * Using a large static buffer avoids the erratic behaviour
 - + * caused by automatic scaling, and avoids that the code
 - + * spends lots of time waiting for the data to be split into
 - + * smaller chunks - this results in much reduced latency.
 - + *
 - + * Another benefit is that this gives a larger TCP window
 - + * (as Windows has no public API to set the TCP window size
 - + * per socket), resulting in better performance over WLAN
 - + * connections.
 - + */
 - +#define NFSRV_TCPSOCKBUF (8 * 1024 * 1024)
 - +
 - + if (rcvbufvalue < NFSRV_TCPSOCKBUF) {
 - + rcvbufvalue = NFSRV_TCPSOCKBUF;
 - + bufsize = sizeof(rcvbufvalue);
 - + if (wintirpc_setsockopt(sock, SOL_SOCKET, SO_RCVBUF,
 - + (const char *)&rcvbufvalue, sizeof(bufsize)))
 - + wintirpc_warnx(
 - + "wintirpc_setnfsclientsockopts(sock=%d): "
 - + "Error setting SO_RCVBUF\n", sock);
 - +
 - + rcvbufvalue = 0;
 - + bufsize = sizeof(rcvbufvalue);
 - + if (wintirpc_getsockopt(sock, SOL_SOCKET, SO_RCVBUF,
 - + (char *)&rcvbufvalue, &bufsize))
 - + wintirpc_warnx(
 - + "wintirpc_setnfsclientsockopts(sock=%d): "
 - + "Error getting SO_RCVBUF\n", sock);
 - +
 - + if (rcvbufvalue != NFSRV_TCPSOCKBUF) {
 - + wintirpc_warnx(
 - + "wintirpc_setnfsclientsockopts(sock=%d): "
 - + "SO_RCVBUF expected size=%d, got size=%d\n",
 - + sock,
 - + (int)NFSRV_TCPSOCKBUF, (int)rcvbufvalue);
 - + }
 - +
 - +#ifdef _DEBUG
 - + (void)printf("wintirpc_setnfsclientsockopts(sock=%d): "
 - + "set SO_RCVBUF to %d\n", sock, (int)rcvbufvalue);
 - +#endif
 - + }
 - +
 - +
 - + if (sndbufvalue < NFSRV_TCPSOCKBUF) {
 - + sndbufvalue = NFSRV_TCPSOCKBUF;
 - + bufsize = sizeof(sndbufvalue);
 - + if (wintirpc_setsockopt(sock, SOL_SOCKET, SO_SNDBUF,
 - + (const char *)&sndbufvalue, sizeof(bufsize)))
 - + wintirpc_warnx(
 - + "wintirpc_setnfsclientsockopts(sock=%d): "
 - + "Error setting SO_SNDBUF\n", sock);
 - +
 - + sndbufvalue = 0;
 - + bufsize = sizeof(sndbufvalue);
 - + if (wintirpc_getsockopt(sock, SOL_SOCKET, SO_SNDBUF,
 - + (char *)&sndbufvalue, &bufsize))
 - + wintirpc_warnx(
 - + "wintirpc_setnfsclientsockopts(sock=%d): "
 - + "Error getting SO_SNDBUF\n", sock);
 - +
 - + if (sndbufvalue != NFSRV_TCPSOCKBUF) {
 - + wintirpc_warnx(
 - + "wintirpc_setnfsclientsockopts(sock=%d): "
 - + "SO_SNDBUF expected size=%d, got size=%d\n",
 - + sock, (int)NFSRV_TCPSOCKBUF, (int)sndbufvalue);
 - + }
 - +
 - +#ifdef _DEBUG
 - + (void)printf("wintirpc_setnfsclientsockopts(sock=%d): "
 - + "set SO_SNDBUF to %d\n", sock, (int)sndbufvalue);
 - +#endif
 - + }
 - +#endif /* NFS41_DRIVER_USE_LARGE_SOCKET_RCVSND_BUFFERS */
 - +}
 - +
 - void wintirpc_syslog(int prio, const char *format, ...)
 - {
 - const char *prio_s;
 - diff --git a/libtirpc/tirpc/wintirpc.h b/libtirpc/tirpc/wintirpc.h
 - index c1f7f22..4d70be4 100644
 - --- a/libtirpc/tirpc/wintirpc.h
 - +++ b/libtirpc/tirpc/wintirpc.h
 - @@ -157,6 +157,7 @@ int wintirpc_getsockopt(int socket, int level, int option_name,
 - void *restrict option_value, socklen_t *restrict option_len);
 - int wintirpc_setsockopt(int socket, int level, int option_name,
 - const void *option_value, socklen_t option_len);
 - +void wintirpc_setnfsclientsockopts(int sock);
 - void wintirpc_syslog(int prio, const char *format, ...);
 - void wintirpc_warnx(const char *format, ...);
 - void wintirpc_register_osfhandle_fd(SOCKET handle, int fd);
 - diff --git a/nfs41_build_features.h b/nfs41_build_features.h
 - index 61a37dd..2e18150 100644
 - --- a/nfs41_build_features.h
 - +++ b/nfs41_build_features.h
 - @@ -77,4 +77,20 @@
 - */
 - #define NFS41_DRIVER_WORKAROUND_FOR_GETATTR_AFTER_CLOSE_HACKS 1
 - +/*
 - + * NFS41_DRIVER_USE_LARGE_SOCKET_RCVSND_BUFFERS - use
 - + * static, large buffer size for socket receive and send buffers
 - + *
 - + * Using a large static buffer avoids the erratic behaviour
 - + * caused by automatic scaling, and avoids that the code
 - + * spends lots of time waiting for the data to be split into
 - + * smaller chunks - this results in much reduced latency.
 - + *
 - + * Another benefit is that this gives a larger TCP window
 - + * (as Windows has no public API to set the TCP window size
 - + * per socket), resulting in better performance over WLAN
 - + * connections.
 - + */
 - +#define NFS41_DRIVER_USE_LARGE_SOCKET_RCVSND_BUFFERS 1
 - +
 - #endif /* !_NFS41_DRIVER_BUILDFEATURES_ */
 - --
 - 2.43.0
 
msnfs41client: WinNT-Version+hostname in "niiname", fixed-size libtirpc buffers+misc, 2024-03-21
Posted by Anonymous on Thu 21st Mar 2024 13:56
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.
 rovema.kpaste.net RSS