Commit Graph

266 Commits

Author SHA1 Message Date
ryo 65f9de9e0d commonize case block 2023-04-02 18:15:24 +00:00
ryo 60536c5379 don't pass add=1 to print_tree() when displaying by specifying nodes.
For example, "sysctl -w kern.mbuf=" had been displayed extra node names in the MIB.
 # sysctl -w kern.mbuf=
 kern.mbuf.mbuf.msize = 512
 kern.mbuf.mbuf.mclbytes = 2048
 :
2023-04-02 18:11:26 +00:00
christos 962d2193b3 kern.hashstat takes too long and it is meaningless here. 2021-12-28 16:06:57 +00:00
kamil 997c4cdc97 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.
2019-08-18 04:10:22 +00:00
kre c576beb79a kern.boottime was changed from a struct timeval to a struct timespec
in January 2009 (the Christos' time merge, when time_t went to 64 bits).

sysctl needs to catch up.   (So do other progs, which will happen, eventually,
but most of them are unaffected in any practical way.)

If you are running a system (NetBSD 6 or later) without this change, try
	sysctl -nn kern.boottime
and marvel at the result (in theory, seconds.microseconds) most
probably being something like:
	jinx$ sysctl -nn kern.boottime
	1540801874.999995564
(There is a 1 in 1000 chance your system will have booted
in the interval [0 , 999999] nanoseconds after some second,
in which case this will not be observed.   You should get
(almost) the same value after this change - just now it is as
it should be (there should now always be 9 digits after the '.').

On the other hand, if you're on a big-endian 64 bit host (running
64 bit sysctl) you would have always seen 0 for the microseconds field.
That should be fixed by this.

In sysctl(7) also document what we mean by "the time the system booted".

XXX Pullup -8
XXX Pullup -7
XXX Pullup -6 (oops, missed that one...)
2018-10-30 19:41:21 +00:00
mrg 845c916a36 updates for GCC 6.4:
identd has aliasing violations, use -fno-strict-aliasing.

newfs_msdos's getbpbinfo() has missing {} issues.

sysctl's kern_cp_id() has missing {} issues.
2018-02-04 09:03:23 +00:00
christos a22e7bc981 say ipsec stats are viewable with netstat. 2017-04-13 14:46:32 +00:00
dholland 05ce5c4223 Apply patch from PR 43587, mostly from martin and kre. When writing a
sysctl variable using ?= fails with EPERM, don't print an error
message.

Ideally setting a sysctl to the same value it already has should also
not fail regardless of permissions, but this would need to be done in
the kernel.
2016-07-31 23:30:28 +00:00
christos 94ae268a8f mention ip6addrctl 2015-12-13 14:24:47 +00:00
knakahara 84f76c9c0f Add intrctl(8). 2015-08-17 06:42:45 +00:00
christos 802a4e04fc remove debugging 2014-11-09 22:50:38 +00:00
christos 66d4eaa769 add handler for /kern/evcnt and print the actual error when failing. 2014-11-09 18:36:02 +00:00
martin 804dc5f91b Get rid of all sysc_init_field uses - initialize fields directly in C99
notation.
2014-05-16 12:22:32 +00:00
martin 722b7feb56 Do not loop over children if a node is not marked as CTLTYPE_NODE. 2014-05-16 08:59:24 +00:00
christos 81c8b4d072 use __func__, EXIT_{SUCCESS,FAILURE} 2014-01-10 18:37:18 +00:00
pooka bbfd34f128 give err() some reason to avoid:
sysctl.c:2713:5: error: zero-length gnu_printf format string [-Werror=format-zero-length]
2014-01-10 09:38:56 +00:00
msaitoh a4771072f5 Add missing free() in error path. 2012-12-13 05:27:01 +00:00
christos 9878d5e5c4 use __BITMAP_TYPE 2012-12-07 02:27:29 +00:00
christos 87e18d03a8 fix bug found by clang. 2012-12-05 13:53:39 +00:00
christos f9868bf95f switch from fd_set to bitmap macros, by popular demand. 2012-12-01 15:30:16 +00:00
christos b8e38193b8 put back line I accidentally deleted. 2012-11-29 02:24:14 +00:00
christos 97613513e6 add a handler for the reserved port sysctl variable. 2012-11-29 02:06:17 +00:00
christos de1cb60c9b use the proper variable 2012-11-29 02:05:38 +00:00
dsl 0836a9f544 Add support for unsigned decimal values. 2012-06-02 21:38:09 +00:00
joerg 66dd2755f5 Add __printflike attribution to use vprintf and friends with an argument
as format string.
2012-03-15 02:02:20 +00:00
christos 3ddbe03f5e PR/44961: Jukka Ruohonen: for sysctl's with built-in handlers, return OPNOTSUPP
if we don't have handlers instead of using the handler we have and silently
failing on attempts to write a node that cannot be written.
2012-03-11 23:33:00 +00:00
christos b678a11dc2 Only print errors when -A or required. Fix the error message to match others. 2012-02-12 20:54:07 +00:00
drochner 8fd6dadaf8 include <netipsec/ipsec.h> rather than <netinet6/ipsec.h> from userland
where possible, for consistency and compatibility to FreeBSD
(exception: KAME specific statistics gathering in netstat(1) and systat(1))
2012-01-04 16:09:40 +00:00
joerg baa8e84b6f Use __dead 2011-08-29 14:34:58 +00:00
christos a14203e91d Instead of using strncat and re-scanning the strings all the time, use and
append printf function.
2011-08-24 12:15:44 +00:00
christos 94a8b1353c no -A or -a with -q 2011-08-03 01:58:30 +00:00
christos daf90d3763 allow -q flag to work for reads. 2011-08-03 01:47:40 +00:00
christos 00740dd48f PR/44864: Paul Ripke: Compile regular expressions on demand and only once. 2011-04-16 01:15:54 +00:00
pooka 67a4f392d8 use crunchops for crunchables 2010-12-13 21:48:01 +00:00
pooka f9740ada7f RUMP_ACTION -> RUMPPRG 2010-12-13 17:42:17 +00:00
pooka 08fc937c06 make sysctl(8) work as a rump client 2010-11-05 15:55:23 +00:00
mrg e00e7bd5c0 implement CTLTYPE_BOOL support. it was entirely missing. HI MATT! 2010-04-11 01:52:10 +00:00
elad 55a6f2a937 Remove stale references to the "read only at securelevel [12]" flags in
the documentation and code comments.
2009-09-30 04:30:50 +00:00
christos e048bed6b3 Don't print an error with sysctl -w name?=value if name does not exist.
Should be pulled up to 5.0
2009-04-01 15:55:27 +00:00
lukem deb4c0bbb3 fix sign-compare issues 2009-03-20 13:18:50 +00:00
pgoyette dab2b670bf Format the address/offset of hexdump in hex, not decimal.
Addresses my PR bin/41035
2009-03-18 01:28:25 +00:00
njoly e4bf6d925f Add missing free() in machdep_diskinfo(). 2009-03-05 15:35:59 +00:00
uebayasi a6533b8fed Comment out CFLAGS+=-g. 2009-02-13 16:02:05 +00:00
christos 118c87a6fe fix dev_t format. 2008-12-28 20:17:11 +00:00
reed a4bfac4a14 Reference secmodel_securelevel(9) manual page. 2008-11-11 00:09:36 +00:00
lukem 6543a91fea Remove the \n and tabs from the __COPYRIGHT() strings.
(Tweak some to use a consistent format.)
2008-07-20 01:20:21 +00:00
martin cd22f25e6f Move TNF licenses to 2 clause form 2008-05-02 18:11:04 +00:00
martin 3028e483e4 Convert to new 2 clause license 2008-04-29 06:53:00 +00:00
elad aede3e59fc PR/35304: C J Coleman: Off-by-one nul byte overwrite in mode_bits routine
of sbin/sysctl
2006-12-21 22:25:39 +00:00
christos b311ec9d52 Exit with non-zero on errors. 2006-12-18 12:50:08 +00:00