Module Name: src
Committed By: martin
Date: Mon Aug 19 16:00:04 UTC 2019
Modified Files:
src/sbin/sysctl [netbsd-9]: Makefile prog_ops.h sysctl.c
sysctl_hostops.c sysctl_rumpops.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.21.32.1 src/sbin/sysctl/Makefile
cvs rdiff -u -r1.2 -r1.2.48.1 src/sbin/sysctl/prog_ops.h
cvs rdiff -u -r1.161 -r1.161.2.1 src/sbin/sysctl/sysctl.c
cvs rdiff -u -r1.1 -r1.1.48.1 src/sbin/sysctl/sysctl_hostops.c \
src/sbin/sysctl/sysctl_rumpops.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/sysctl/Makefile
diff -u src/sbin/sysctl/Makefile:1.21 src/sbin/sysctl/Makefile:1.21.32.1
--- src/sbin/sysctl/Makefile:1.21 Thu Nov 29 02:05:38 2012
+++ src/sbin/sysctl/Makefile Mon Aug 19 16:00:03 2019
@@ -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 @@ SRCS= sysctl.c
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>
Index: src/sbin/sysctl/prog_ops.h
diff -u src/sbin/sysctl/prog_ops.h:1.2 src/sbin/sysctl/prog_ops.h:1.2.48.1
--- src/sbin/sysctl/prog_ops.h:1.2 Mon Dec 13 21:48:01 2010
+++ src/sbin/sysctl/prog_ops.h Mon Aug 19 16:00:03 2019
@@ -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_ */
Index: src/sbin/sysctl/sysctl.c
diff -u src/sbin/sysctl/sysctl.c:1.161 src/sbin/sysctl/sysctl.c:1.161.2.1
--- src/sbin/sysctl/sysctl.c:1.161 Tue Oct 30 19:41:21 2018
+++ src/sbin/sysctl/sysctl.c Mon Aug 19 16:00:03 2019
@@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1993\
#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 @@ parse(char *l, regex_t *re, size_t *last
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 @@ parse_create(char *l)
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 @@ parse_destroy(char *l)
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 @@ parse_describe(char *l)
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 @@ kern_cp_time(HANDLER_ARGS)
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 @@ kern_cp_id(HANDLER_ARGS)
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);
Index: src/sbin/sysctl/sysctl_hostops.c
diff -u src/sbin/sysctl/sysctl_hostops.c:1.1 src/sbin/sysctl/sysctl_hostops.c:1.1.48.1
--- src/sbin/sysctl/sysctl_hostops.c:1.1 Mon Dec 13 17:47:40 2010
+++ src/sbin/sysctl/sysctl_hostops.c Mon Aug 19 16:00:03 2019
@@ -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 @@ __RCSID("$NetBSD: sysctl_hostops.c,v 1.1
const struct prog_ops prog_ops = {
.op_sysctl = sysctl,
+
+ .op_sysctlbyname = sysctlbyname,
+
+ .op_sysctlgetmibinfo = sysctlgetmibinfo,
};
Index: src/sbin/sysctl/sysctl_rumpops.c
diff -u src/sbin/sysctl/sysctl_rumpops.c:1.1 src/sbin/sysctl/sysctl_rumpops.c:1.1.48.1
--- src/sbin/sysctl/sysctl_rumpops.c:1.1 Mon Dec 13 17:47:40 2010
+++ src/sbin/sysctl/sysctl_rumpops.c Mon Aug 19 16:00:03 2019
@@ -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 @@ const struct prog_ops prog_ops = {
.op_init = rumpclient_init,
.op_sysctl = rump_sys___sysctl,
+
+ .op_sysctlbyname = sysctlbyname,
+
+ .op_sysctlgetmibinfo = sysctlgetmibinfo,
};