Commit Graph

89 Commits

Author SHA1 Message Date
christos 238f1027f9 detect integer overflow differently. previous change broke negative sysctl
values.
2006-02-08 18:13:56 +00:00
christos 404831da9c PR/17441: John F. Woods: integer sysctl does not accept numbers > 0x7fffffff
Use unsigned int in the range comparison, and use strerror() instead of
home brewed error strings.
2006-02-05 22:42:55 +00:00
elad 81ed970f39 - make use of the recently added mode_bits for security.setid_core.mode;
- document setid_core variables.
2006-02-02 18:00:07 +00:00
elad 202872db03 add support for parsing file mode bits.
when printed, you'll see something like "0600 (rw-------)", like the
ls output. when reading input you can either specify octal mode (0600)
or chmod-like (u=rw).

ideas from atatat@ and kjk@; okay and lots of help from atatat@.
2006-02-02 16:23:25 +00:00
rpaulo dcc35c7ff8 Handle net.inet.tcp.debug, net.inet.tcp.debx, net.ns.spp.debug and
net.ns.spp.debx. Bump man page date.
2005-09-06 03:22:58 +00:00
rpaulo a49638942e net.inet?.*.stats are viewable with netstat(1). 2005-08-28 16:18:04 +00:00
rpaulo 78d05017af Inform the user that net.bpf.stats and net.bpf.peers are viewable with
netstat(1).
2005-08-04 19:44:18 +00:00
christos 2c6eadc9ce Move WARNS=3 to the Makefile.inc, and add a little const to the remaining
programs that did not compile before.
2005-06-27 01:00:04 +00:00
christos 29a6465002 Add code to handle cp_id. From atatat. 2005-06-16 14:56:36 +00:00
christos ad6c31cee3 PPR/29909: Manuel Bouyer: sysctl dumps core if kern.consdev returns unknown
device.  If we cannot determine the device name of the console, print the
console dev_t in hex.
2005-04-06 21:13:03 +00:00
christos 7a221682eb make sysctl -n print the real console tty name and -nn print the numeric
value.
XXX: -n means don't print name, not numeric. We should stop overloading
it and use a different flag.
2005-03-28 04:03:13 +00:00
atatat 0f48b53686 If a "create" or "destroy" operation succeeds, mark the cached tree as
"stale" so that the next time we try to read or write to it, we can
purge (and refresh) it.

Addresses PR 29222.
2005-03-23 03:45:25 +00:00
atatat 160438234d Fix possible segmentation fault when retrieving descriptions. Thought
I committed this a while ago.  I guess the fact that no one filed a pr
meant no one else found it.  :)
2005-03-19 23:19:17 +00:00
atatat 64dd54edba Use regexes instead of static lists of annoying numbers to recognize
sysctl nodes that have "helpers".  This is more concise, imho more
easy to understand, and has the added bonus of making it *possible* to
assign helpers to dynamically numbered nodes.
2005-03-18 04:52:24 +00:00
atatat 6472d0c335 Make requestors of kern.file2 be referred to pstat (the same as
kern.file) and add EINVAL to the list of errno values which are
silently ignored when walking the tree.
2005-03-15 13:59:35 +00:00
atatat 2971543eb5 Pass dynamic buffer pointer to display_string(), not static buffer
pointer.  Causes...misfunction if the kernel says the buffer needs to
be too much larger.
2004-12-17 05:03:03 +00:00
jdolecek 0154132fed constify handlers[] 2004-10-17 11:04:39 +00:00
atatat 605d2000dd When converting a string to a number, also make sure that you didn't
convert an empty string to a zero.

Follow on to PR bin/25115 in private email.
2004-04-25 05:36:49 +00:00
atatat a929f1c4f7 Allocate adjusted size, not fixed size. 2004-04-23 12:03:39 +00:00
atatat d528f2f477 Some lint cleaning, strip leading (and sometimes trailing) whitespace
from values to be assigned when processing a file.  Clean up error
reporting (print the name of the file and the line number), and tidy
some numeric conversions.  Continue after most "errors" when
processing a -f argument.

Addresses PR bin/25115.
2004-04-22 03:56:31 +00:00
atatat de37b59396 If the node was specifically requested but has no description, print
the "no description" message instead of skipping (as happens when
recursing into a subtree).  This does not apply to non-node-type
nodes.
2004-04-14 05:13:50 +00:00
atatat 67f14f8fff Don't copy the size that sysctl gave back directly, copy the size of
the description.  *thwap*
2004-04-08 06:49:03 +00:00
atatat 610ed0d02a Don't copy the size that sysctl gave back directly, copy the size of
the description.
2004-04-08 06:12:43 +00:00
atatat 4f406ff76d Do nothing else for nodes with no children if -d is used (dflag is
set).  Otherwise, some nodes (those with "printers") will also print
the "use foo ..." message.
2004-04-08 04:00:33 +00:00
atatat fcc6bb1735 Add -d flag to usage message(s). 2004-04-06 19:39:44 +00:00
he 4af725d078 Make this too gcc2-compileable. 2004-03-26 23:55:45 +00:00
atatat 29e15c7932 Move sysctlbyname(), sysctlnametomib(), and sysctlgetmibinfo() from
sysctl(8) into libc, making the minor number jump.  Add prototypes to
sys/sysctl.h, fix sets, modify man pages, etc.  That oughta cover it.
2004-03-25 19:36:26 +00:00
atatat 38c4183b04 Implement sysctl descriptions. Now all that remains is actually to
write them.
2004-03-24 18:11:09 +00:00
atatat 19af35fd0d Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
2004-03-24 15:34:46 +00:00
atatat 299501e0d7 A little syntactic sugar 2004-03-20 05:22:41 +00:00
atatat f99654532c Make this:
% sysctl -A kern.cp_time

(and also "sysctl -A" without the kern.cp_time argument) print this:

	kern.cp_time: user = 851648, nice = 683496, sys = 69383, ...
	kern.cp_time.0: user = 85648, nice = 68496, sys = 6983, ...
	...

instead of just:

	kern.cp_time.0: user = 85648, nice = 68496, sys = 6983, ...
	...
2004-02-20 05:27:39 +00:00
atatat 589a080332 More better display of kern.cp_time for MP machines. Now we use one
sysctl() call to query for each of three different display modes:

(1) sum across all cpus

	% sysctl kern.cp_time
	kern.cp_time: user = 93240, nice = 1507, sys = 17252, ...

(2) data for just cpu 0

	% sysctl kern.cp_time.0
	kern.cp_time.0: user = 93282, nice = 1507, sys = 17264, ...

(3) each cpu individually up to hw.ncpu

	% sysctl -A kern.cp_time
	kern.cp_time.0: user = 93349, nice = 1507, sys = 17280, ...
	kern.cp_time.1: user = 93403, nice = 1507, sys = 17291, ...
	...
2004-02-19 06:51:11 +00:00
atatat 5e111b3c0a Miscellaneous display bugfixes. 2004-02-19 06:44:18 +00:00
atatat a44f68529b Rename sysctlnametomib() to sysctlgetmibinfo() and add FreeBSD
compatible sysctlnametomib() and sysctlbyname() functions.

These are intended to move to libc real soon now.
2004-02-19 06:40:14 +00:00
jmmv b635f565e7 Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.
2004-01-05 23:23:32 +00:00
atatat ea73edd395 sysctlnametomib() is a private function for the moment. 2003-12-04 20:07:59 +00:00
atatat c915b3168c New sysctl(8) binary. Performs auto-discovery and can add/remove
nodes from the tree.  Never needs to be recompiled again.
2003-12-04 19:49:39 +00:00
jonathan 88ba77e705 Make per-protocol network input queue stats visible to userland via
sysctl. Add a protocol-independent sysctl handler to show the per-protocol
"struct ifq' statistics. Add IP(v4) specific call to the handler.
Other protocols can show their per-protocol input statistics by
allocating a sysclt node and calling sysctl_ifq() with their own struct ifq *.

As posted to tech-kern plus improvements/cleanup suggested by Andrew Brown.
2003-11-10 20:03:29 +00:00
wiz 0ba80f40e8 Combine multiple single-letter options. 2003-09-21 15:23:55 +00:00
grant 76036fea3c add -e flag to set the separator to '=' where the default is ' = '.
this allows sysctl output to fed back into itself. inspired by
FreeBSD's sysctl(8).

ok'd by atatat.
2003-09-20 17:02:17 +00:00
agc 276d62f603 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22308, verified by myself.
2003-08-07 10:04:22 +00:00
simonb 7eb2ec40b2 Remove the KERN_DRIVERS case handler (prototype code?). 2003-06-17 03:34:23 +00:00
dsl f8f6959024 Print hw.cnmagic as escaped hex bytes (unless -n given).
Change 'special' to be a numeral not a bit, it isn't ever used as a bit
and I can't see why it should ever be used that way.
2003-06-16 21:52:58 +00:00
thorpej 56962fed64 Avoid a strict-alias warning in gcc 3.3. 2003-05-31 23:42:23 +00:00
itojun 8138cbd1bf simplify more 2003-05-18 02:07:20 +00:00
itojun ebf587df1a simplify by strlcpy/cat 2003-05-18 02:06:28 +00:00
lukem ea56af7b9d Tweak behaviour introduced in rev 1.50;
*	by default, warning messages go to stderr
    *	if -A or -a is used, send warning messages to stdout instead.

The behaviour in 1.50 meant that
	somevar=`sysctl -n machdep.booted_kernel 2>/dev/null`
could end up with $somevar="machdep.booted_kernel: the value is not available"
rather than the more useful $somevar="".

(This way, "sysctl -A | grep ..." is still useful.)
2003-04-06 05:19:03 +00:00
fvdl 74cc14e0d0 Quell formwat warning for LP64 for the diskinfo printf. 2003-03-07 00:42:04 +00:00
dsl 2ac00e9169 display machdep.diskinfo for i386 and x86_84
(agreed by christos)
2003-01-22 17:12:41 +00:00
manu 41bfbd28fe On Darwin, mach_init is the system bootstrap process. It is responsible
for forking the traditional UNIX init(8) and it does the Mach port naming
service. We need mach_init for the naming service, but unfortunately, it
will only act as such if its PID is 1. We introduce a sysctl
(emul.darwin.init_pid) to fool a given process into thinking its PID is 1.
That way we can get mach_init into behaving as the name server.

Typical use:
/sbin/sysctl -w emul.darwin.init_pid=$$ ; exec /emul/darwin/sbin/mach_init
2002-12-24 12:15:45 +00:00