aboutsummaryrefslogtreecommitdiff
path: root/sbin/sysctl
Commit message (Collapse)AuthorAgeFilesLines
* Use a dynamic buffer for the copy of a node's new value.John Baldwin2020-10-301-14/+21
| | | | | | | | | | | | | This permits setting a node's value to a string longer than BUFSIZ. Reported by: Sony Arpita Das @ Chelsio Reviewed by: freqlabs MFC after: 1 week Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D27027 Notes: svn path=/head/; revision=367188
* Update man-pages to describe the user.localbase variable added in r367179.Stefan Eßer2020-10-301-1/+2
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=367184
* sysctl+kern_sysctl: Honor SKIP for descendant nodesRyan Moeller2020-10-241-2/+15
| | | | | | | | | | | | | | Ensure we also skip descendants of SKIP nodes when iterating through children of an explicitly specified node. Reported by: np Reviewed by: np MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D26833 Notes: svn path=/head/; revision=367009
* sysctl: Misc code cleanupRyan Moeller2020-10-241-113/+120
| | | | | | | | | | | | | | | | | | * Use defined SYS_SYSCTL names * Use memcmp instead of explicit loop * Use NULL instead of 0 for pointer value * Use __FBSDID * Reformat, improve comments in parse() No functional changes. Reviewed by: imp MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D26832 Notes: svn path=/head/; revision=367006
* Enable iterating all sysctls, even ones with CTLFLAG_SKIPRyan Moeller2020-10-051-14/+21
| | | | | | | | | | | | | | | | | | | | | | | | | Add an "nextnoskip" sysctl that allows for listing of sysctls intended to be normally skipped for cost reasons. This makes it so the names/descriptions of those sysctls can be discovered with sysctl -aN/sysctl -ad/sysctl -at. It also makes it so children are visited when a node flagged with CTLFLAG_SKIP is explicitly requested. The intended use case is to mark the root "kstat" node with CTLFLAG_SKIP so that the extensive and expensive stats are skipped by default but may still be easily obtained without having to know them all (which may not even be possible) and request each one-by-one. Reviewed by: jhb MFC after: 2 weeks Relnotes: yes Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D26560 Notes: svn path=/head/; revision=366465
* Add sysctl(8) formatting for hw.pagesizes.Mark Johnston2020-09-021-0/+25
| | | | | | | | | | | | | | | | | | - Change the type of hw.pagesizes to OPAQUE, since it returns an array. - Modify the handler to only truncate the returned length if the caller supplied an output buffer. This allows use of the trick of passing a NULL output buffer to fetch the output size, while preserving compatibility if MAXPAGESIZES is increased. - Add a "S,pagesize" formatter to sysctl(8). Reviewed by: alc, kib MFC after: 2 weeks Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D26239 Notes: svn path=/head/; revision=365268
* sysctl(8): clarify -n flagFernando Apesteguía2020-08-221-2/+2
| | | | | | | | | | | | | -n omits the name of the variable regardless of the type of information that is requested. Rephrase to clarify this point. PR: 242191 Submitted by: stilezy@gmail.com Approved by: emaste@ Differential Revision: https://reviews.freebsd.org/D26149 Notes: svn path=/head/; revision=364481
* evdev: export event device properties through sysctl interfaceVladimir Kondratyev2019-02-241-0/+19
| | | | | | | | | | | | | | | | | | | A big security advantage of Wayland is not allowing applications to read input devices all the time. Having /dev/input/* accessible to the user account subverts this advantage. libudev-devd was opening the evdev devices to detect their types (mouse, keyboard, touchpad, etc). This don't work if /dev/input/* is inaccessible. With the kernel exposing this information as sysctls (kern.evdev.input.*), we can work w/o /dev/input/* access, preserving the Wayland security model. Submitted by: Greg V <greg@unrelenting.technology> Reviewed by: wulf, imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D18694 Notes: svn path=/head/; revision=344494
* Remove -R option which was added to sysctl(8) man page per r244106, but it ↵Guangyuan Yang2019-02-091-3/+3
| | | | | | | | | | | | is not implemented. MFC after: 3 days Submitted by: Alfonso Siciliano <alfix86@gmail.com> Reviewed by: 0mp, imp Differential Revision: https://reviews.freebsd.org/D19012 Notes: svn path=/head/; revision=343930
* sysctl(8): Add a standard exit status section.Mateusz Piotrowski2018-09-241-1/+3
| | | | | | | | | Reviewed by: bcr Approved by: re (gjb), krion (mentor) Differential Revision: https://reviews.freebsd.org/D17147 Notes: svn path=/head/; revision=338920
* Improve handling of the EFI map types[] array.Konstantin Belousov2018-09-081-18/+19
| | | | | | | | | | | | | Use nitems(), do not assume EFI_MD_TYPE_ contiguous allocation, in particular, switch to use designated array initializers. Reviewed by: jhb (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week Approved by: re (gjb) Notes: svn path=/head/; revision=338533
* Teach sysctl(8) about the Persistent memory type.Konstantin Belousov2018-09-071-2/+3
| | | | | | | | | | | | Add PersistentMemory to the list of sysctl's known memory types when decoding an EFI memory map. Submitted by: D Scott Phillips <d.scott.phillips@intel.com> MFC after: 1 week Approved by: re (rgrimes) Notes: svn path=/head/; revision=338523
* Trim whitespace.Konstantin Belousov2018-09-071-2/+2
| | | | | | | Approved by: re (gjb) Notes: svn path=/head/; revision=338522
* Move sysctl.conf to sbin/sysctl/ and switch to CONFS.Brad Davis2018-08-112-0/+10
| | | | | | | | | | This helps with pkgbase to tag this config file as a config file. Approved by: allanjude (mentor), will (mentor) Differential Revision: https://reviews.freebsd.org/D16559 Notes: svn path=/head/; revision=337624
* Permit sysctl(8) to set an array of numeric values for a single node.John Baldwin2018-03-092-93/+135
| | | | | | | | | | | | | | | | | | | | Most sysctl nodes only return a single value, but some nodes return an array of values (e.g. kern.cp_time). sysctl(8) understand how to display the values of a node that returns multiple values (it prints out each numeric value separated by spaces). However, until now sysctl(8) has only been able to set sysctl nodes to a single value. This change allows sysctl to accept a new value for a numeric sysctl node that contains multiple values separated by either spaces or commas. sysctl(8) parses this list into an array of values and passes the array as the "new" value to sysctl(2). Reviewed by: rpokala MFC after: 1 week Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D14569 Notes: svn path=/head/; revision=330711
* Improve sysctl(8) pretty printing of some structures.Konstantin Belousov2017-11-261-20/+21
| | | | | | | | | | | | | | | | | | S_vmtotal: Use unsigned format to print unsigned memory counters from struct vmtotal. Remove unneeded cast, style locals declarations. S_efi_map: Make printing of the memory regions descriptions less MD by using uintmax_t formats. Noted by and discussed with: bde Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=326226
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-1/+3
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* kern.osreldate is an integer, not a stringAllan Jude2017-09-161-1/+1
| | | | | | | | | PR: 217501 Submitted by: Yavuz Tanriverdi <stemix@gmail.com> MFC after: 1 week Notes: svn path=/head/; revision=323645
* Don't request CTLTYPE_OPAQUE if we can't print them.Andrew Gallatin2017-07-311-18/+26
| | | | | | | | | | | | | | | | | | | The intent is to skip expensive opaque sysctls like tcp_pcblist unless they are explicitly requested. Sysctl nodes like this don't show up in sysctl -a, but they do generate output that winds up being dropped, unless the user specifically requested binary/hex output or opaques. This reduces the runtime of sysctl in many circumstances on a loaded system. It also reduces the likelihood that simply gathering diagnostics on a sick machine (stuck lock, etc) via sysctl -a might push it over the edge into a total lockup. Reviewed by: jtl Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D11461 Notes: svn path=/head/; revision=321790
* Renumber copyright clause 4Warner Losh2017-02-282-2/+2
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* sysctl(8): fix typename for uint32_t.Andriy Voskoboinyk2016-12-311-1/+1
| | | | | | | MFC after: 5 days. Notes: svn path=/head/; revision=310961
* Consolidate four efi_next_descriptor() definitions.Konstantin Belousov2016-09-181-3/+0
| | | | | | | | Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=305942
* Fix "sysctl vm.vmtotal" output on machines with > 2TB virtual memoryAlan Somers2016-06-241-9/+9
| | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=302174
* Explicitly add more files to the 'runtime' package.Glen Barber2016-02-091-0/+1
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=295450
* Add -t option to display field types.Marcelo Araujo2015-12-102-12/+30
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=292045
* Follow-up to r290475: Add sysctl(8) support for added typesConrad Meyer2015-11-071-28/+81
| | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=290476
* sysctl(8): Fix style nitsConrad Meyer2015-10-231-5/+6
| | | | | | | | Suggested by: bde Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289835
* Sysctl: Add common support for U8, U16 typesConrad Meyer2015-10-221-0/+28
| | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289773
* Only print the errno string in case sysctl(3) does not file with ENOENTBaptiste Daroussin2015-10-071-1/+5
| | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=288984
* Trim spaces at the end of the buffer before trying to convert it to an oidBaptiste Daroussin2015-10-071-0/+6
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=288981
* Teach sysctl about the new optional suffix after IK to specifyWarner Losh2015-07-291-8/+42
| | | | | | | | | | precision. Update input as well. Add IK to the manual (it was missing completely). Differential Revision: https://reviews.freebsd.org/D3181 Notes: svn path=/head/; revision=285994
* Add META_MODE support.Simon J. Gerraty2015-06-131-0/+18
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=284345
| * dirdeps.mk now sets DEP_RELDIRSimon J. Gerraty2015-06-081-2/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=284172
| * Merge sync of headSimon J. Gerraty2015-05-272-12/+33
| |\ | |/ |/| | | Notes: svn path=/projects/bmake/; revision=283595
| * Merge from head@274682Simon J. Gerraty2014-11-191-105/+224
| |\ | | | | | | | | | Notes: svn path=/projects/bmake/; revision=274683
| * \ Merge head from 7/28Simon J. Gerraty2014-08-191-2/+2
| |\ \ | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=270164
| * | | Updated dependenciesSimon J. Gerraty2014-05-161-1/+0
| | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=266219
| * | | Updated dependenciesSimon J. Gerraty2014-05-101-0/+2
| | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=265802
| * | | Merge headSimon J. Gerraty2014-04-282-3/+3
| |\ \ \ | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=265044
| * | | | Updated dependenciesSimon J. Gerraty2013-03-111-0/+1
| | | | | | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=248169
| * | | | Updated dependenciesSimon J. Gerraty2013-02-161-2/+0
| | | | | | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=246868
| * | | | Sync with HEAD.David E. O'Brien2013-02-082-71/+207
| |\ \ \ \ | | | | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=246555
| * | | | | Sync FreeBSD's bmake branch with Juniper's internal bmake branch.Marcel Moolenaar2012-08-221-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Requested by: Simon Gerraty <sjg@juniper.net> Notes: svn path=/projects/bmake/; revision=239572
* | | | | | add support for specifying an initial buffer size when fetching aJohn-Mark Gurney2015-02-132-10/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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... Notes: svn path=/head/; revision=278654
* | | | | | Fix inverted logic introduced in r272154.Xin LI2014-12-011-2/+5
| |_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Noticed by: trasz MFC after: 2 weeks Notes: svn path=/head/; revision=275377
* | | | | Refactor the code a little bit to reduce duplicated code.Xin LI2014-09-261-102/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reviewed by: mjg MFC after: 2 weeks Notes: svn path=/head/; revision=272154
* | | | | Explicitly set errno to 0 before calling strto*.Xin LI2014-09-251-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Suggested by: mjg MFC after: 2 weeks Notes: svn path=/head/; revision=272145
* | | | | The strtol(3) family of functions would set errno when it hits one.Xin LI2014-09-251-8/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check errno and handle it as invalid input. Obtained from: HardenedBSD Submitted by: David CARLIER <devnexen@gmail.com> MFC after: 2 weeks Notes: svn path=/head/; revision=272144
* | | | | Constify a parameter of name2oid. No functional change.Xin LI2014-09-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MFC after: 2 months Notes: svn path=/head/; revision=272044