From 391089144f320eca4563b8c6c6008698bb5b14cb Mon Sep 17 00:00:00 2001 From: Dagobert Michelsen Date: Fri, 21 Feb 2020 16:18:55 +0100 Subject: [PATCH] Warn user on unimplemented NFS stat requests on NetBSD --- src/nfs.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/nfs.c b/src/nfs.c index cbb4d1df9..ba9bc068c 100644 --- a/src/nfs.c +++ b/src/nfs.c @@ -621,9 +621,24 @@ static int nfs_read(void) { int i; /* NetBSD reports v2 statistics mapped to v3 and doen't yet support v4 */ - if (!report_v3) + if (report_v2) { + if (!suppress_warning) { + WARNING( + "nfs plugin: NFSv2 statistics have been requested " + "but they are mapped to NFSv3 statistics in the kernel on NetBSD."); + } return 0; - if (sysctl(mib, 3, &ns, &size, NULL, 0) != 0) + } + + if (report_v4) { + if (!suppress_warning) { + WARNING("nfs plugin: NFSv4 statistics have been requested " + "but they are not yet supported on NetBSD."); + } + return 0; + } + + if (sysctl(mib, STATIC_ARRAY_SIZE(mib), &ns, &size, NULL, 0) != 0) return 1; for (i = 0; i < nfs3_procedures_names_num; i++) -- 2.47.2