Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Tango on sysctl_createv() and flags. The flags have all bee...
details: https://anonhg.NetBSD.org/src/rev/ab05444e5944
branches: trunk
changeset: 559820:ab05444e5944
user: atatat <atatat%NetBSD.org@localhost>
date: Wed Mar 24 15:34:46 2004 +0000
description:
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
diffstat:
lib/libc/gen/sysctl.c | 34 ++-
sbin/sysctl/sysctl.c | 115 +++++-----
sbin/sysctl/sysctlutil.c | 36 ++-
sys/arch/alpha/alpha/machdep.c | 28 +-
sys/arch/amd64/amd64/machdep.c | 16 +-
sys/arch/amiga/amiga/machdep.c | 10 +-
sys/arch/arm/arm32/arm32_machdep.c | 24 +-
sys/arch/atari/atari/machdep.c | 10 +-
sys/arch/cesfic/cesfic/machdep.c | 10 +-
sys/arch/dreamcast/dreamcast/machdep.c | 10 +-
sys/arch/evbsh3/evbsh3/machdep.c | 13 +-
sys/arch/hp300/hp300/machdep.c | 10 +-
sys/arch/hp700/hp700/machdep.c | 10 +-
sys/arch/hpcsh/hpcsh/machdep.c | 10 +-
sys/arch/i386/i386/machdep.c | 49 ++-
sys/arch/luna68k/luna68k/machdep.c | 10 +-
sys/arch/mac68k/mac68k/machdep.c | 10 +-
sys/arch/mips/mips/mips_machdep.c | 25 +-
sys/arch/mmeye/mmeye/machdep.c | 13 +-
sys/arch/mvme68k/mvme68k/machdep.c | 10 +-
sys/arch/news68k/news68k/machdep.c | 10 +-
sys/arch/next68k/next68k/machdep.c | 10 +-
sys/arch/pc532/pc532/machdep.c | 16 +-
sys/arch/powerpc/powerpc/powerpc_machdep.c | 33 +-
sys/arch/sparc/sparc/machdep.c | 19 +-
sys/arch/sparc64/sparc64/machdep.c | 19 +-
sys/arch/sun2/sun2/machdep.c | 16 +-
sys/arch/sun3/sun3/machdep.c | 16 +-
sys/arch/sun3/sun3x/machdep.c | 16 +-
sys/arch/vax/vax/machdep.c | 16 +-
sys/arch/x68k/x68k/machdep.c | 10 +-
sys/arch/xen/i386/machdep.c | 49 ++-
sys/coda/coda_vfsops.c | 13 +-
sys/compat/darwin/darwin_sysctl.c | 213 ++++++++++---------
sys/compat/irix/irix_sysctl.c | 40 ++-
sys/compat/linux/common/linux_sysctl.c | 53 ++--
sys/compat/netbsd32/netbsd32_sysctl.c | 44 ++--
sys/ddb/db_command.c | 5 +-
sys/ddb/db_variables.c | 29 +-
sys/dev/ic/ath.c | 60 ++--
sys/fs/adosfs/advfsops.c | 10 +-
sys/fs/cd9660/cd9660_vfsops.c | 12 +-
sys/fs/filecorefs/filecore_vfsops.c | 10 +-
sys/fs/msdosfs/msdosfs_vfsops.c | 10 +-
sys/fs/ntfs/ntfs_vfsops.c | 10 +-
sys/fs/smbfs/smbfs_vfsops.c | 24 +-
sys/fs/union/union_vfsops.c | 10 +-
sys/kern/init_sysctl.c | 313 +++++++++++++++++++---------
sys/kern/kern_ntptime.c | 10 +-
sys/kern/kern_resource.c | 34 ++-
sys/kern/kern_sysctl.c | 254 ++++++++++++++--------
sys/kern/subr_prof.c | 25 +-
sys/kern/sys_pipe.c | 25 +-
sys/kern/tty.c | 22 +-
sys/kern/uipc_domain.c | 10 +-
sys/kern/uipc_mbuf.c | 35 ++-
sys/kern/uipc_socket.c | 13 +-
sys/kern/vfs_bio.c | 22 +-
sys/kern/vfs_subr.c | 19 +-
sys/miscfs/fdesc/fdesc_vfsops.c | 10 +-
sys/miscfs/genfs/layer_vfsops.c | 10 +-
sys/miscfs/kernfs/kernfs_vfsops.c | 12 +-
sys/miscfs/nullfs/null_vfsops.c | 10 +-
sys/miscfs/overlay/overlay_vfsops.c | 12 +-
sys/miscfs/portal/portal_vfsops.c | 10 +-
sys/miscfs/procfs/procfs_vfsops.c | 11 +-
sys/miscfs/umapfs/umap_vfsops.c | 10 +-
sys/net/bpf.c | 15 +-
sys/net/if.c | 41 ++-
sys/net/rtsock.c | 13 +-
sys/netinet/ip_icmp.c | 28 +-
sys/netinet/ip_input.c | 76 ++++--
sys/netinet/tcp_usrreq.c | 101 ++++++---
sys/netinet/udp_usrreq.c | 22 +-
sys/netinet6/icmp6.c | 67 ++++--
sys/netinet6/ip6_input.c | 99 ++++++---
sys/netinet6/ipsec.c | 102 ++++++---
sys/netinet6/udp6_usrreq.c | 19 +-
sys/netipsec/ipsec_netbsd.c | 55 +++-
sys/netipsec/key.c | 49 ++-
sys/netkey/key.c | 49 ++-
sys/nfs/nfs_vfsops.c | 16 +-
sys/sys/sysctl.h | 99 +++++---
sys/ufs/ext2fs/ext2fs_vfsops.c | 10 +-
sys/ufs/ffs/ffs_vfsops.c | 25 +-
sys/ufs/lfs/lfs_vfsops.c | 19 +-
sys/ufs/mfs/mfs_vfsops.c | 10 +-
sys/uvm/uvm_meter.c | 47 ++-
88 files changed, 1889 insertions(+), 1166 deletions(-)
diffs (truncated from 7722 to 300 lines):
diff -r 2767784393d0 -r ab05444e5944 lib/libc/gen/sysctl.c
--- a/lib/libc/gen/sysctl.c Wed Mar 24 15:25:43 2004 +0000
+++ b/lib/libc/gen/sysctl.c Wed Mar 24 15:34:46 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sysctl.c,v 1.15 2003/12/04 19:45:19 atatat Exp $ */
+/* $NetBSD: sysctl.c,v 1.16 2004/03/24 15:34:56 atatat Exp $ */
/*-
* Copyright (c) 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)sysctl.c 8.2 (Berkeley) 1/4/94";
#else
-__RCSID("$NetBSD: sysctl.c,v 1.15 2003/12/04 19:45:19 atatat Exp $");
+__RCSID("$NetBSD: sysctl.c,v 1.16 2004/03/24 15:34:56 atatat Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -71,6 +71,26 @@
size_t oldlen, savelen;
int error;
+ if (getenv("SYSCTL_TRACE") != NULL) {
+ char trb[128];
+ uint l, i;
+
+ l = snprintf(trb, sizeof(trb), "sysctl(%p {", name);
+ write(2, &trb[0], l);
+ for (i = 0; i < namelen; i++) {
+ l = snprintf(trb, sizeof(trb), "%s%d", i ? "." : "",
+ name[i]);
+ write(2, &trb[0], l);
+ }
+ l = snprintf(trb, sizeof(trb), "}, %d, %p, %p (%lu), %p, %lu)\n",
+ namelen,
+ oldp,
+ oldlenp, (ulong)(oldlenp ? *oldlenp : 0),
+ newp,
+ (ulong)newlen);
+ write(2, &trb[0], l);
+ }
+
if (name[0] != CTL_USER)
/* LINTED will fix when sysctl interface gets corrected */
/* XXX when will that be? */
@@ -106,8 +126,8 @@
size_t *oldlenp, newlen;
{
#define _INT(s, n, v) { \
- .sysctl_flags = SYSCTL_IMMEDIATE|SYSCTL_PERMANENT|SYSCTL_READONLY| \
- SYSCTL_TYPE(CTLTYPE_INT), \
+ .sysctl_flags = CTLFLAG_IMMEDIATE|CTLFLAG_PERMANENT| \
+ CTLTYPE_INT|SYSCTL_VERSION, \
.sysctl_size = sizeof(int), \
.sysctl_name = (s), \
.sysctl_num = (n), \
@@ -124,8 +144,8 @@
0
#else /* !lint */
{
- .sysctl_flags = SYSCTL_READONLY|SYSCTL_PERMANENT|
- SYSCTL_TYPE(CTLTYPE_STRING),
+ .sysctl_flags = SYSCTL_VERSION|CTLFLAG_PERMANENT|
+ CTLTYPE_STRING,
.sysctl_size = sizeof(_PATH_STDPATH),
.sysctl_name = "cs_path",
.sysctl_num = USER_CS_PATH,
@@ -221,7 +241,7 @@
return (EOPNOTSUPP);
node = &node[ni];
- if (node->sysctl_flags & SYSCTL_IMMEDIATE) {
+ if (node->sysctl_flags & CTLFLAG_IMMEDIATE) {
switch (SYSCTL_TYPE(node->sysctl_flags)) {
case CTLTYPE_INT:
newp = &node->sysctl_idata;
diff -r 2767784393d0 -r ab05444e5944 sbin/sysctl/sysctl.c
--- a/sbin/sysctl/sysctl.c Wed Mar 24 15:25:43 2004 +0000
+++ b/sbin/sysctl/sysctl.c Wed Mar 24 15:34:46 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sysctl.c,v 1.82 2004/03/20 05:22:41 atatat Exp $ */
+/* $NetBSD: sysctl.c,v 1.83 2004/03/24 15:34:56 atatat Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
#if 0
static char sccsid[] = "@(#)sysctl.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: sysctl.c,v 1.82 2004/03/20 05:22:41 atatat Exp $");
+__RCSID("$NetBSD: sysctl.c,v 1.83 2004/03/24 15:34:56 atatat Exp $");
#endif
#endif /* not lint */
@@ -148,7 +148,7 @@
int learn_tree(int *, u_int, struct sysctlnode *);
int sysctlbyname(const char *, void *, size_t *, void *, size_t);
int sysctlgetmibinfo(const char *, int *, u_int *,
- char *, size_t *, struct sysctlnode **);
+ char *, size_t *, struct sysctlnode **, int);
/*
* "handlers"
@@ -227,8 +227,7 @@
#if defined(lint)
0
#else /* defined(lint) */
- .sysctl_flags = SYSCTL_ROOT|
- SYSCTL_TYPE(CTLTYPE_NODE),
+ .sysctl_flags = SYSCTL_VERSION|CTLFLAG_ROOT|CTLTYPE_NODE,
.sysctl_size = sizeof(struct sysctlnode),
.sysctl_num = 0,
.sysctl_name = "(prog_root)",
@@ -418,28 +417,26 @@
c = "";
#define print_flag(_f, _s, _c, _q, _x) \
- if ((/*CONSTCOND*/_x) ? \
- (((_f) & (_x)) == (__CONCAT(SYSCTL_,_q))) : \
- ((_f) & (__CONCAT(SYSCTL_,_q)))) { \
+ if (((_f) & (__CONCAT(CTLFLAG_,_x))) == (__CONCAT(CTLFLAG_,_q))) { \
strlcat((_s), (_c), sizeof(_s)); \
strlcat((_s), __STRING(_q), sizeof(_s)); \
(_c) = ","; \
- (_f) &= ~(__CONCAT(SYSCTL_,_q)|(_x)); \
+ (_f) &= ~(__CONCAT(CTLFLAG_,_x)); \
}
- print_flag(f, s, c, READONLY, SYSCTL_READWRITE);
- print_flag(f, s, c, READONLY1, SYSCTL_READWRITE);
- print_flag(f, s, c, READONLY2, SYSCTL_READWRITE);
- print_flag(f, s, c, READWRITE, SYSCTL_READWRITE);
- print_flag(f, s, c, ANYWRITE, 0);
- print_flag(f, s, c, PRIVATE, 0);
- print_flag(f, s, c, PERMANENT, 0);
- print_flag(f, s, c, OWNDATA, 0);
- print_flag(f, s, c, IMMEDIATE, 0);
- print_flag(f, s, c, HEX, 0);
- print_flag(f, s, c, ROOT, 0);
- print_flag(f, s, c, ANYNUMBER, 0);
- print_flag(f, s, c, HIDDEN, 0);
- print_flag(f, s, c, ALIAS, 0);
+ print_flag(f, s, c, READONLY, READWRITE);
+ print_flag(f, s, c, READONLY1, READWRITE);
+ print_flag(f, s, c, READONLY2, READWRITE);
+ print_flag(f, s, c, READWRITE, READWRITE);
+ print_flag(f, s, c, ANYWRITE, ANYWRITE);
+ print_flag(f, s, c, PRIVATE, PRIVATE);
+ print_flag(f, s, c, PERMANENT, PERMANENT);
+ print_flag(f, s, c, OWNDATA, OWNDATA);
+ print_flag(f, s, c, IMMEDIATE, IMMEDIATE);
+ print_flag(f, s, c, HEX, HEX);
+ print_flag(f, s, c, ROOT, ROOT);
+ print_flag(f, s, c, ANYNUMBER, ANYNUMBER);
+ print_flag(f, s, c, HIDDEN, HIDDEN);
+ print_flag(f, s, c, ALIAS, ALIAS);
#undef print_flag
if (f) {
@@ -521,7 +518,7 @@
printf("%s (%s): ", gsname, gdname);
printf("CTLTYPE_%s", st(type));
if (type == CTLTYPE_NODE) {
- if (SYSCTL_FLAGS(pnode->sysctl_flags) & SYSCTL_ALIAS)
+ if (SYSCTL_FLAGS(pnode->sysctl_flags) & CTLFLAG_ALIAS)
printf(", alias %d",
pnode->sysctl_alias);
else
@@ -549,7 +546,7 @@
* only way to print an aliased node is with either -M or by
* name specifically.
*/
- if (SYSCTL_FLAGS(pnode->sysctl_flags) & SYSCTL_ALIAS && add) {
+ if (SYSCTL_FLAGS(pnode->sysctl_flags) & CTLFLAG_ALIAS && add) {
*sp = *dp = '\0';
return;
}
@@ -594,7 +591,7 @@
req = 0;
for (ni = 0; ni < pnode->sysctl_clen; ni++) {
name[namelen] = node[ni].sysctl_num;
- if ((node[ni].sysctl_flags & SYSCTL_HIDDEN) &&
+ if ((node[ni].sysctl_flags & CTLFLAG_HIDDEN) &&
!(Aflag || req))
continue;
print_tree(name, namelen + 1, &node[ni],
@@ -722,8 +719,8 @@
namelen = CTL_MAXNAME;
sz = sizeof(gsname);
- if (sysctlgetmibinfo(key, &name[0], &namelen, gsname, &sz, &node) == -1)
- {
+ if (sysctlgetmibinfo(key, &name[0], &namelen, gsname, &sz, &node,
+ SYSCTL_VERSION) == -1) {
fprintf(warnfp, "%s: %s level name '%s' in '%s' is invalid\n",
getprogname(), lname[namelen], gsname, l);
exit(1);
@@ -791,8 +788,8 @@
with [r12w] being read-only, writeable below securelevel 1,
writeable below securelevel 2, and unconditionally writeable
respectively. if you specify addr, it is assumed to be the name of
- a kernel symbol, if value, SYSCTL_OWNDATA will be asserted for
- strings, SYSCTL_IMMEDIATE for ints and u_quad_ts. you cannot
+ a kernel symbol, if value, CTLFLAG_OWNDATA will be asserted for
+ strings, CTLFLAG_IMMEDIATE for ints and u_quad_ts. you cannot
specify both value and addr.
*/
@@ -968,35 +965,35 @@
while (*t != '\0') {
switch (*t) {
case 'a':
- flags |= SYSCTL_ANYWRITE;
+ flags |= CTLFLAG_ANYWRITE;
break;
case 'h':
- flags |= SYSCTL_HIDDEN;
+ flags |= CTLFLAG_HIDDEN;
break;
case 'i':
- flags |= SYSCTL_IMMEDIATE;
+ flags |= CTLFLAG_IMMEDIATE;
break;
case 'o':
- flags |= SYSCTL_OWNDATA;
+ flags |= CTLFLAG_OWNDATA;
break;
case 'p':
- flags |= SYSCTL_PRIVATE;
+ flags |= CTLFLAG_PRIVATE;
break;
case 'x':
- flags |= SYSCTL_HEX;
+ flags |= CTLFLAG_HEX;
break;
case 'r':
- rw = SYSCTL_READONLY;
+ rw = CTLFLAG_READONLY;
break;
case '1':
- rw = SYSCTL_READONLY1;
+ rw = CTLFLAG_READONLY1;
break;
case '2':
- rw = SYSCTL_READONLY2;
+ rw = CTLFLAG_READONLY2;
break;
case 'w':
- rw = SYSCTL_READWRITE;
+ rw = CTLFLAG_READWRITE;
break;
default:
fprintf(warnfp,
@@ -1045,8 +1042,8 @@
getprogname(), nname, value);
exit(1);
}
- if (!(flags & SYSCTL_OWNDATA)) {
- flags |= SYSCTL_IMMEDIATE;
+ if (!(flags & CTLFLAG_OWNDATA)) {
+ flags |= CTLFLAG_IMMEDIATE;
node.sysctl_idata = i;
}
else
@@ -1055,7 +1052,7 @@
sz = sizeof(int);
break;
case CTLTYPE_STRING:
- flags |= SYSCTL_OWNDATA;
+ flags |= CTLFLAG_OWNDATA;
node.sysctl_data = data;
if (sz == 0)
sz = strlen(data) + 1;
@@ -1075,8 +1072,8 @@
getprogname(), nname, value);
exit(1);
}
- if (!(flags & SYSCTL_OWNDATA)) {
- flags |= SYSCTL_IMMEDIATE;
+ if (!(flags & CTLFLAG_OWNDATA)) {
+ flags |= CTLFLAG_IMMEDIATE;
node.sysctl_qdata = q;
}
else
@@ -1115,15 +1112,15 @@
getprogname(), nname);
exit(1);
}
- if (!(flags & SYSCTL_IMMEDIATE))
- flags |= SYSCTL_OWNDATA;
+ if (!(flags & CTLFLAG_IMMEDIATE))
+ flags |= CTLFLAG_OWNDATA;
}
/*
* now we do a few sanity checks on the description we've
* assembled
*/
- if ((flags & SYSCTL_IMMEDIATE) &&
+ if ((flags & CTLFLAG_IMMEDIATE) &&
Home |
Main Index |
Thread Index |
Old Index