Commit Graph

196 Commits

Author SHA1 Message Date
Konstantin Belousov
944e0bab86 Consolidate four efi_next_descriptor() definitions.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-09-18 17:38:02 +00:00
Alan Somers
4dad99bf48 Fix "sysctl vm.vmtotal" output on machines with > 2TB virtual memory
sbin/sysctl/sysctl.c
	Fix integer overflows in printf format strings

PR:		199673
Submitted by:	Vitaly Magerya
Reviewed by:	cem
Approved by:	re (marius)
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D6941
2016-06-24 14:58:37 +00:00
Glen Barber
406d87b1c3 Explicitly add more files to the 'runtime' package.
Sponsored by:	The FreeBSD Foundation
2016-02-09 20:19:31 +00:00
Marcelo Araujo
8020192d7b Add -t option to display field types.
PR:		bin/203918
Submitted by:	ota <ota@j.email.ne.jp>
Reviewed by:	cem
Approved by:	bapt (mentor)
Differential Revision:	https://reviews.freebsd.org/D4451
2015-12-10 02:11:42 +00:00
Conrad Meyer
2a71f1ed95 Follow-up to r290475: Add sysctl(8) support for added types
Sponsored by:	EMC / Isilon Storage Division
2015-11-07 01:56:32 +00:00
Conrad Meyer
ec9f6de7d2 sysctl(8): Fix style nits
Suggested by:	bde
Sponsored by:	EMC / Isilon Storage Division
2015-10-23 15:40:44 +00:00
Conrad Meyer
c3220d0b6d Sysctl: Add common support for U8, U16 types
Sponsored by:	EMC / Isilon Storage Division
2015-10-22 23:03:06 +00:00
Baptiste Daroussin
e1619d123e Only print the errno string in case sysctl(3) does not file with ENOENT
This reduces the noise in error reporing from sysctl(8):

Before:
$ sysctl bla=something
sysctl: unknown oid 'bla': No such file or directory

After:
$ sysctl bla=something
sysctl: unknown oid 'bla'

MFC after:	1 week
Sponsored by:	Gandi.net
2015-10-07 09:28:54 +00:00
Baptiste Daroussin
ca587fdaac Trim spaces at the end of the buffer before trying to convert it to an oid
This allows to write entries in sysctl.conf with spaces before the '=' like
kern.ipc.shmmax = 9663676416

MFC after:	1 week
Sponsored by:	Gandi.net
2015-10-07 08:56:01 +00:00
Warner Losh
aa255ef6dd Teach sysctl about the new optional suffix after IK to specify
precision. Update input as well. Add IK to the manual (it was missing
completely).

Differential Revision: https://reviews.freebsd.org/D3181
2015-07-29 02:34:25 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
John-Mark Gurney
7582000531 add support for specifying an initial buffer size when fetching a
sysctl... This is useful for kern.arandom which (without -B) will
happily return 0 bytes, which isn't too useful or random...

fix spelling (thanks igor!) of settable while I'm here...
2015-02-13 01:20:37 +00:00
Xin LI
689c8e8b46 Fix inverted logic introduced in r272154.
Noticed by:	trasz
MFC after:	2 weeks
2014-12-01 20:51:01 +00:00
Simon J. Gerraty
9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Xin LI
e267e00eef Refactor the code a little bit to reduce duplicated code.
Reviewed by:	mjg
MFC after:	2 weeks
2014-09-26 05:05:34 +00:00
Xin LI
4b8740cd0a Explicitly set errno to 0 before calling strto*.
Suggested by:	mjg
MFC after:	2 weeks
2014-09-25 22:47:19 +00:00
Xin LI
9e4ed37219 The strtol(3) family of functions would set errno when it hits one.
Check errno and handle it as invalid input.

Obtained from:	HardenedBSD
Submitted by:	David CARLIER <devnexen@gmail.com>
MFC after:	2 weeks
2014-09-25 22:37:27 +00:00
Xin LI
c58f8df6e7 Constify a parameter of name2oid. No functional change.
MFC after:	2 months
2014-09-23 22:15:00 +00:00
John Baldwin
7d8312cc92 Add a sysctl to export the EFI memory map along with a handler in the
sysctl(8) binary to format it.

Reviewed by:	emaste
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D771
2014-09-13 03:10:02 +00:00
John Baldwin
59101c5d95 Pass the length of an structure to the pretty-printer backends as a
size_t instead of an int.
2014-09-12 21:01:39 +00:00
John Baldwin
89871cdeb6 - Add a new structure type for the ACPI 3.0 SMAP entry that includes the
optional attributes field.
- Add a 'machdep.smap' sysctl that exports the SMAP table of the running
  system as an array of the ACPI 3.0 structure.  (On older systems, the
  attributes are given a value of zero.)  Note that the sysctl only
  exports the SMAP table if it is available via the metadata passed from
  the loader to the kernel.  If an SMAP is not available, an empty array
  is returned.
- Add a format handler for the ACPI 3.0 SMAP structure to the sysctl(8)
  binary to format the SMAP structures in a readable format similar to
  the format found in boot messages.

MFC after:	2 weeks
2014-08-29 21:25:47 +00:00
Simon J. Gerraty
ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +00:00
Hans Petter Selasky
04006eabea Don't hide zero-length strings when doing sysctl listings.
MFC after:	1 week
2014-06-27 15:23:12 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty
76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty
3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
Edward Tomasz Napierala
c6919e7fdc Fix warnings to not append "No error: 0".
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2013-11-26 19:14:18 +00:00
Devin Teske
b85e9d27f6 Fix a typo: s/wriable/writable/ 2013-11-12 17:44:29 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
David E. O'Brien
d9a447559b Sync with HEAD. 2013-02-08 16:10:16 +00:00
Xin LI
6f36135181 Use the right format string for line buffer.
PR:		bin/174910
Submitted by:	Fabian Keil <fk fabiankeil.de>
2013-01-13 04:28:44 +00:00
Xin LI
da178c777f Teach sysctl(8) about parsing a file (while I'm there also give it
capability of parsing both = and : formats).

Submitted by:	hrs (initial version, bugs are mine)
MFC after:	3 months
2012-12-13 23:32:47 +00:00
Alfred Perlstein
403c7f59d5 Make Tflag and Wflag filters work for more sysctl options.
To do this move the Tflag and Wflag checks earlier in show_var() so
we bail earlier for variables not matching our query.
2012-12-12 02:55:40 +00:00
Alfred Perlstein
9ecd2e32cd Allow sysctl to filter boot and runtime tunables.
Add the following flags to sysctl:
 -W  - show only writable sysctls
 -T  - show only tuneable sysctls

This can be used to create a /var/run/sysctl.boot to
compare set tunables versus booted tunables.

Sponsored by: iXsystems
2012-12-11 01:28:06 +00:00
Xin LI
aae7510122 In parse():
- Only operate on copy, don't operate on source.
 - Eliminate home-rolled strsep().
 - Constify the parameter.

MFC after:	2 weeks
2012-12-11 01:12:29 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Eitan Adler
ad0e6cda92 s/Free Memory Pages/Free Memory/ to avoid confusion, since we're
reporting a number of bytes rather than a number of pages

PR:		misc/165208
Submitted by:	Arnaud Lacombe <lacombar@gmail.com>
Approved by:	cperciva
MFC after:	3 days
2012-04-11 14:18:18 +00:00
Joel Dahl
c2965cd185 mdoc: terminate quoted strings.
Reviewed by:	brueffer
2012-03-26 15:18:14 +00:00
John Baldwin
0b6230f135 If the -d flag is specified, ignore any new values specified and only
display the descriptions of specified nodes.

Reported by:	Jason Hellenthal  jhell of dataix net
MFC after:	2 weeks
2011-12-01 15:01:23 +00:00
Matthew D Fleming
cbc134ad03 Introduce signed and unsigned version of CTLTYPE_QUAD, renaming
existing uses.  Rename sysctl_handle_quad() to sysctl_handle_64().
2011-01-19 23:00:25 +00:00
Matthew D Fleming
f8e4b4ef49 sysctl(8) should use the CTLTYPE to determine the type of data when
reading.  (This was already done for writing to a sysctl).  This
requires all SYSCTL setups to specify a type.  Most of them are now
checked at compile-time.

Remove SYSCTL_*X* sysctl additions as the print being in hex should be
controlled by the -x flag to sysctl(8).

Succested by:	bde
2011-01-19 17:04:07 +00:00
Matthew D Fleming
7e265faeb9 Fix typo and bump date. 2011-01-17 23:43:03 +00:00
Matthew D Fleming
5bf6a94016 The kernel is not exporting any "T,dev_t" sysctl nodes anymore, so
remove the capability and mention from sysctl(8).
2011-01-17 23:36:53 +00:00
Marko Zec
13e86ef7ee Make the format of "Real Memory" and "Virtual Memory" lines more
consistent with the rest of sysctl vm.vmtotal output.

MFC after:	3 days
2010-09-16 10:53:01 +00:00
Rebecca Cran
f2359a2473 Free the memory allocated via strdup.
PR:		bin/113881
Submitted by:	Alexander Drozdov  dzal_mail mtu-net.ru
Approved by:	rrs (mentor)
MFC after:	1 week
2010-03-13 11:08:57 +00:00
Ulrich Spörlein
6d7a8f6cba sysctl(8): make WARNS=3 clean
Fixes inspired by work done in DragonflyBSD.

PR:		bin/140016
Approved by:	ed (Co-mentor)
2010-02-15 14:08:06 +00:00
Gavin Atkinson
aea5fda5dc Add -i to usage()
Noticed by:	ru
MFC after:	5 days
2010-02-09 19:13:45 +00:00