Source-Changes-HG archive

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

[src/netbsd-9]: src/sbin/sysctl Pull up following revision(s) (requested by k...



details:   https://anonhg.NetBSD.org/src/rev/68742cc0ba27
branches:  netbsd-9
changeset: 962847:68742cc0ba27
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Aug 19 16:00:03 2019 +0000

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

        sbin/sysctl/prog_ops.h: revision 1.3
        sbin/sysctl/sysctl_rumpops.c: revision 1.2
        sbin/sysctl/sysctl_hostops.c: revision 1.2
        sbin/sysctl/Makefile: revision 1.22
        sbin/sysctl/sysctl.c: revision 1.162

sysctl: Add indirection of symbols to remove clash with sanitizers

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

diffstat:

 sbin/sysctl/Makefile         |   6 +++++-
 sbin/sysctl/prog_ops.h       |  16 +++++++++++++++-
 sbin/sysctl/sysctl.c         |  16 ++++++++--------
 sbin/sysctl/sysctl_hostops.c |   8 ++++++--
 sbin/sysctl/sysctl_rumpops.c |   8 ++++++--
 5 files changed, 40 insertions(+), 14 deletions(-)

diffs (187 lines):

diff -r 0deef79a2fcb -r 68742cc0ba27 sbin/sysctl/Makefile
--- a/sbin/sysctl/Makefile      Mon Aug 19 15:56:49 2019 +0000
+++ b/sbin/sysctl/Makefile      Mon Aug 19 16:00:03 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.21 2012/11/29 02:05:38 christos Exp $
+#      $NetBSD: Makefile,v 1.21.32.1 2019/08/19 16:00:03 martin Exp $
 #      @(#)Makefile    8.1 (Berkeley) 6/6/93
 
 .include <bsd.own.mk>
@@ -13,4 +13,8 @@
 CPPFLAGS+= -DRUMP_ACTION
 RUMPSRCS+= sysctlbyname.c sysctlgetmibinfo.c
 
+SANITIZER_RENAME_CLASSES+=     rump
+SANITIZER_RENAME_FILES.rump+=  ${PROG}_rumpops.c ${RUMPSRCS}
+SANITIZER_RENAME_SYMBOL.rump+= sysctlbyname sysctlgetmibinfo
+
 .include <bsd.prog.mk>
diff -r 0deef79a2fcb -r 68742cc0ba27 sbin/sysctl/prog_ops.h
--- a/sbin/sysctl/prog_ops.h    Mon Aug 19 15:56:49 2019 +0000
+++ b/sbin/sysctl/prog_ops.h    Mon Aug 19 16:00:03 2019 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: prog_ops.h,v 1.2 2010/12/13 21:48:01 pooka Exp $      */
+/*      $NetBSD: prog_ops.h,v 1.2.48.1 2019/08/19 16:00:03 martin Exp $        */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -32,19 +32,33 @@
 #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_sysctlbyname)(const char *, void *, size_t *,
+                        const void *, size_t);
+
+       int (*op_sysctlgetmibinfo)(const char *, int *, u_int *, char *,
+                        size_t *, struct sysctlnode **, int);
 };
 extern const struct prog_ops prog_ops;
 
 #define prog_init prog_ops.op_init
 #define prog_sysctl prog_ops.op_sysctl
+#define prog_sysctlbyname prog_ops.op_sysctlbyname
+#define prog_sysctlgetmibinfo prog_ops.op_sysctlgetmibinfo
 #else
 #define prog_init ((int (*)(void))NULL)
 #define prog_sysctl sysctl
+#define prog_sysctlbyname sysctlbyname
+#define prog_sysctlgetmibinfo sysctlgetmibinfo
 #endif
 
 #endif /* _PROG_OPS_H_ */
diff -r 0deef79a2fcb -r 68742cc0ba27 sbin/sysctl/sysctl.c
--- a/sbin/sysctl/sysctl.c      Mon Aug 19 15:56:49 2019 +0000
+++ b/sbin/sysctl/sysctl.c      Mon Aug 19 16:00:03 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysctl.c,v 1.161 2018/10/30 19:41:21 kre Exp $ */
+/*     $NetBSD: sysctl.c,v 1.161.2.1 2019/08/19 16:00:03 martin Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
 #if 0
 static char sccsid[] = "@(#)sysctl.c   8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: sysctl.c,v 1.161 2018/10/30 19:41:21 kre Exp $");
+__RCSID("$NetBSD: sysctl.c,v 1.161.2.1 2019/08/19 16:00:03 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -896,7 +896,7 @@
        namelen = CTL_MAXNAME;
        sz = sizeof(gsname);
 
-       if (sysctlgetmibinfo(key, &name[0], &namelen, gsname, &sz, &node,
+       if (prog_sysctlgetmibinfo(key, &name[0], &namelen, gsname, &sz, &node,
                             SYSCTL_VERSION) == -1) {
                if (optional)
                        return;
@@ -1441,7 +1441,7 @@
                namelen = sizeof(name) / sizeof(name[0]);
                sz = sizeof(gsname);
                *t = '\0';
-               rc = sysctlgetmibinfo(nname, &name[0], &namelen,
+               rc = prog_sysctlgetmibinfo(nname, &name[0], &namelen,
                                      gsname, &sz, NULL, SYSCTL_VERSION);
                *t = sep[0];
                if (rc == -1) {
@@ -1489,7 +1489,7 @@
        memset(name, 0, sizeof(name));
        namelen = sizeof(name) / sizeof(name[0]);
        sz = sizeof(gsname);
-       rc = sysctlgetmibinfo(l, &name[0], &namelen, gsname, &sz, NULL,
+       rc = prog_sysctlgetmibinfo(l, &name[0], &namelen, gsname, &sz, NULL,
                              SYSCTL_VERSION);
        if (rc == -1) {
                sysctlparseerror(namelen, l);
@@ -1538,7 +1538,7 @@
        memset(name, 0, sizeof(name));
        namelen = sizeof(name) / sizeof(name[0]);
        sz = sizeof(gsname);
-       rc = sysctlgetmibinfo(l, &name[0], &namelen, gsname, &sz, NULL,
+       rc = prog_sysctlgetmibinfo(l, &name[0], &namelen, gsname, &sz, NULL,
                              SYSCTL_VERSION);
        if (rc == -1) {
                sysctlparseerror(namelen, l);
@@ -2266,7 +2266,7 @@
 
        if (namelen == 2 && Aflag) {
                sz = sizeof(n);
-               rc = sysctlbyname("hw.ncpu", &n, &sz, NULL, 0);
+               rc = prog_sysctlbyname("hw.ncpu", &n, &sz, NULL, 0);
                if (rc != 0)
                        return; /* XXX print an error, eh? */
                n++; /* Add on space for the sum. */
@@ -2414,7 +2414,7 @@
 
        if (namelen == 2) {
                sz = sizeof(n);
-               rc = sysctlbyname("hw.ncpu", &n, &sz, NULL, 0);
+               rc = prog_sysctlbyname("hw.ncpu", &n, &sz, NULL, 0);
                if (rc != 0)
                        return; /* XXX print an error, eh? */
                sz = n * sizeof(u_int64_t);
diff -r 0deef79a2fcb -r 68742cc0ba27 sbin/sysctl/sysctl_hostops.c
--- a/sbin/sysctl/sysctl_hostops.c      Mon Aug 19 15:56:49 2019 +0000
+++ b/sbin/sysctl/sysctl_hostops.c      Mon Aug 19 16:00:03 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysctl_hostops.c,v 1.1 2010/12/13 17:47:40 pooka Exp $ */
+/*     $NetBSD: sysctl_hostops.c,v 1.1.48.1 2019/08/19 16:00:03 martin Exp $   */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: sysctl_hostops.c,v 1.1 2010/12/13 17:47:40 pooka Exp $");
+__RCSID("$NetBSD: sysctl_hostops.c,v 1.1.48.1 2019/08/19 16:00:03 martin Exp $");
 #endif /* !lint */
 
 #include <sys/types.h>
@@ -38,4 +38,8 @@
 
 const struct prog_ops prog_ops = {
        .op_sysctl = sysctl,
+
+       .op_sysctlbyname = sysctlbyname,
+
+       .op_sysctlgetmibinfo = sysctlgetmibinfo,
 };
diff -r 0deef79a2fcb -r 68742cc0ba27 sbin/sysctl/sysctl_rumpops.c
--- a/sbin/sysctl/sysctl_rumpops.c      Mon Aug 19 15:56:49 2019 +0000
+++ b/sbin/sysctl/sysctl_rumpops.c      Mon Aug 19 16:00:03 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysctl_rumpops.c,v 1.1 2010/12/13 17:47:40 pooka Exp $ */
+/*     $NetBSD: sysctl_rumpops.c,v 1.1.48.1 2019/08/19 16:00:03 martin Exp $   */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: sysctl_rumpops.c,v 1.1 2010/12/13 17:47:40 pooka Exp $");
+__RCSID("$NetBSD: sysctl_rumpops.c,v 1.1.48.1 2019/08/19 16:00:03 martin Exp $");
 #endif /* !lint */
 
 #include <sys/types.h>
@@ -44,4 +44,8 @@
        .op_init =      rumpclient_init,
 
        .op_sysctl =    rump_sys___sysctl,
+
+       .op_sysctlbyname = sysctlbyname,
+
+       .op_sysctlgetmibinfo = sysctlgetmibinfo,
 };



Home | Main Index | Thread Index | Old Index