Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/usr.bin/sockstat Pull up following revision(s) (requested...



details:   https://anonhg.NetBSD.org/src/rev/20d7837b4ba9
branches:  netbsd-9
changeset: 458223:20d7837b4ba9
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Aug 19 16:01:52 2019 +0000

description:
Pull up following revision(s) (requested by kamil in ticket #96):

        usr.bin/sockstat/sockstat.c: revision 1.21
        usr.bin/sockstat/prog_ops.h: revision 1.2
        usr.bin/sockstat/sockstat_rumpops.c: revision 1.2
        usr.bin/sockstat/sockstat_hostops.c: revision 1.2
        usr.bin/sockstat/Makefile: revision 1.4

sockstat: Add indirection of symbols to remove clash with sanitizers

Add indirection and symbol renaming under MKSANITIZER for the linked in
version of sysctlgetmibinfo and sysctlnametomib.

diffstat:

 usr.bin/sockstat/Makefile           |   6 +++++-
 usr.bin/sockstat/prog_ops.h         |  15 ++++++++++++++-
 usr.bin/sockstat/sockstat.c         |   8 ++++----
 usr.bin/sockstat/sockstat_hostops.c |   8 ++++++--
 usr.bin/sockstat/sockstat_rumpops.c |   9 +++++++--
 5 files changed, 36 insertions(+), 10 deletions(-)

diffs (156 lines):

diff -r f85df2b458d6 -r 20d7837b4ba9 usr.bin/sockstat/Makefile
--- a/usr.bin/sockstat/Makefile Mon Aug 19 16:00:03 2019 +0000
+++ b/usr.bin/sockstat/Makefile Mon Aug 19 16:01:52 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.3 2011/01/28 18:52:49 pooka Exp $
+#      $NetBSD: Makefile,v 1.3.46.1 2019/08/19 16:01:52 martin Exp $
 
 .include <bsd.own.mk>
 
@@ -8,6 +8,10 @@
 CPPFLAGS+= -DRUMP_ACTION
 RUMPSRCS+=     sysctlgetmibinfo.c sysctlnametomib.c
 
+SANITIZER_RENAME_CLASSES+=     rump
+SANITIZER_RENAME_FILES.rump+=  ${PROG}_rumpops.c ${RUMPSRCS}
+SANITIZER_RENAME_SYMBOL.rump+= sysctlgetmibinfo sysctlnametomib
+
 .if (${USE_INET6} != "no")
 CPPFLAGS+=-DINET6
 .endif
diff -r f85df2b458d6 -r 20d7837b4ba9 usr.bin/sockstat/prog_ops.h
--- a/usr.bin/sockstat/prog_ops.h       Mon Aug 19 16:00:03 2019 +0000
+++ b/usr.bin/sockstat/prog_ops.h       Mon Aug 19 16:01:52 2019 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: prog_ops.h,v 1.1 2011/01/28 18:52:49 pooka Exp $      */
+/*      $NetBSD: prog_ops.h,v 1.1.48.1 2019/08/19 16:01:52 martin Exp $        */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -32,19 +32,32 @@
 #include <sys/types.h>
 
 #ifndef CRUNCHOPS
+struct sysctlnode;
+
 struct prog_ops {
        int (*op_init)(void);
 
        int (*op_sysctl)(const int *, u_int, void *, size_t *,
                         const void *, size_t);
+
+       /* Indirection needed for sanitizers. */
+
+       int (*op_sysctlgetmibinfo)(const char *, int *, u_int *, char *,
+                        size_t *, struct sysctlnode **, int);
+
+       int (*op_sysctlnametomib)(const char *, int *, size_t *);
 };
 extern const struct prog_ops prog_ops;
 
 #define prog_init prog_ops.op_init
 #define prog_sysctl prog_ops.op_sysctl
+#define prog_sysctlgetmibinfo prog_ops.op_sysctlgetmibinfo
+#define prog_sysctlnametomib prog_ops.op_sysctlnametomib
 #else
 #define prog_init ((int (*)(void))NULL)
 #define prog_sysctl sysctl
+#define prog_sysctlgetmibinfo sysctlgetmibinfo
+#define prog_sysctlnametomib sysctlnametomib
 #endif
 
 #endif /* _PROG_OPS_H_ */
diff -r f85df2b458d6 -r 20d7837b4ba9 usr.bin/sockstat/sockstat.c
--- a/usr.bin/sockstat/sockstat.c       Mon Aug 19 16:00:03 2019 +0000
+++ b/usr.bin/sockstat/sockstat.c       Mon Aug 19 16:01:52 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sockstat.c,v 1.20 2019/02/03 03:19:30 mrg Exp $ */
+/*     $NetBSD: sockstat.c,v 1.20.2.1 2019/08/19 16:01:52 martin Exp $ */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: sockstat.c,v 1.20 2019/02/03 03:19:30 mrg Exp $");
+__RCSID("$NetBSD: sockstat.c,v 1.20.2.1 2019/08/19 16:01:52 martin Exp $");
 #endif
 
 #define _KMEMUSER
@@ -297,7 +297,7 @@
        u_int namelen;
 
        sz = CTL_MAXNAME;
-       rc = sysctlnametomib(mib, &name[0], &sz);
+       rc = prog_sysctlnametomib(mib, &name[0], &sz);
        if (rc == -1) {
                if (errno == ENOENT)
                        return;
@@ -324,7 +324,7 @@
        u_int namelen;
 
        sz = CTL_MAXNAME;
-       rc = sysctlnametomib("kern.file2", &name[0], &sz);
+       rc = prog_sysctlnametomib("kern.file2", &name[0], &sz);
        if (rc == -1)
                err(1, "sysctlnametomib");
        namelen = sz;
diff -r f85df2b458d6 -r 20d7837b4ba9 usr.bin/sockstat/sockstat_hostops.c
--- a/usr.bin/sockstat/sockstat_hostops.c       Mon Aug 19 16:00:03 2019 +0000
+++ b/usr.bin/sockstat/sockstat_hostops.c       Mon Aug 19 16:01:52 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sockstat_hostops.c,v 1.1 2011/01/28 18:52:49 pooka Exp $       */
+/*     $NetBSD: sockstat_hostops.c,v 1.1.48.1 2019/08/19 16:01:52 martin Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: sockstat_hostops.c,v 1.1 2011/01/28 18:52:49 pooka Exp $");
+__RCSID("$NetBSD: sockstat_hostops.c,v 1.1.48.1 2019/08/19 16:01:52 martin Exp $");
 #endif /* !lint */
 
 #include <sys/types.h>
@@ -38,4 +38,8 @@
 
 const struct prog_ops prog_ops = {
        .op_sysctl = sysctl,
+
+        .op_sysctlgetmibinfo = sysctlgetmibinfo,
+
+        .op_sysctlnametomib = sysctlnametomib,
 };
diff -r f85df2b458d6 -r 20d7837b4ba9 usr.bin/sockstat/sockstat_rumpops.c
--- a/usr.bin/sockstat/sockstat_rumpops.c       Mon Aug 19 16:00:03 2019 +0000
+++ b/usr.bin/sockstat/sockstat_rumpops.c       Mon Aug 19 16:01:52 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sockstat_rumpops.c,v 1.1 2011/01/28 18:52:49 pooka Exp $       */
+/*     $NetBSD: sockstat_rumpops.c,v 1.1.48.1 2019/08/19 16:01:52 martin Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -28,10 +28,11 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: sockstat_rumpops.c,v 1.1 2011/01/28 18:52:49 pooka Exp $");
+__RCSID("$NetBSD: sockstat_rumpops.c,v 1.1.48.1 2019/08/19 16:01:52 martin Exp $");
 #endif /* !lint */
 
 #include <sys/types.h>
+#include <sys/sysctl.h>
 
 #include <rump/rumpclient.h>
 #include <rump/rump_syscalls.h>
@@ -42,4 +43,8 @@
        .op_init =      rumpclient_init,
 
        .op_sysctl =    rump_sys___sysctl,
+
+       .op_sysctlgetmibinfo = sysctlgetmibinfo,
+
+       .op_sysctlnametomib = sysctlnametomib,
 };



Home | Main Index | Thread Index | Old Index