aboutsummaryrefslogtreecommitdiff
path: root/lib/libcasper/services/cap_sysctl
Commit message (Collapse)AuthorAgeFilesLines
* cap_sysctl: fix typoMariusz Zaborski2026-05-131-2/+2
|
* libcasper: Move everything to the libcasper packageLexi Winter2025-11-051-2/+0
| | | | | | | | | | | | The libcasper package exists to contain libcasper, but for some reason only the libcap_net service was in the package, with libcasper itself and the rest of the services being in runtime. Move everything to the libcasper package, except tests which stay in the tests package. MFC after: 1 day Reviewed by: emaste Sponsored by: https://www.patreon.com/bsdivy Differential Revision: https://reviews.freebsd.org/D53576
* Remove "All Rights Reserved" from FreeBSD Foundation copyrightsEd Maste2024-07-303-3/+0
| | | | | | | These ones were unambiguous cases where the Foundation was the only listed copyright holder. Sponsored by: The FreeBSD Foundation
* Remove residual blank line at start of MakefileWarner Losh2024-07-152-2/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* libcasper: document that most libcasper functions are not thread-safeAlan Somers2023-12-081-1/+10
| | | | | | | | | | | | | And neither are most libcasper services' functions, because internally they all use cap_xfer_nvlist. cap_xfer_nvlist sends and then receives data over a unix domain socket and associated with the cap_channel_t argument. So absent synchronization, two threads may not use the same cap_channel_t argument or they risk receiving the other's reply. MFC after: 2 weeks Sponsored by: Axcient Reviewed by: oshogbo Differential Revision: https://reviews.freebsd.org/D42928
* lib: Automated cleanup of cdefs and other formattingWarner Losh2023-11-272-2/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* dirdeps: Update Makefile.depend* files with empty contentsStephen J. Kiernan2023-10-291-0/+9
| | | | | Some Makefile.depend* files were committed with no contents or empty DIRDEPS list, but they should have DIRDEPS with some contents.
* Remove $FreeBSD$: two-line nroff patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-164-4/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-162-4/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-122-2/+2
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* Update/fix Makefile.depend for userlandSimon J. Gerraty2023-04-191-9/+0
|
* cap_sysctl tests: SerializeMark Johnston2023-03-301-1/+4
| | | | | | | | These tests fail spuriously when run in parallel, since some of them write a value to a global sysctl, read it back, and expect to see the written value. These tests complete quite quickly in any case. MFC after: 1 week
* libcasper: Move helper libraries from /lib/casper to /lib.John Baldwin2023-03-291-1/+1
| | | | | | | | | These libraries are linked to directly by applications rather than opened at runtime via dlopen(). Discussed with: oshogbo Reviewed by: markj, emaste Differential Revision: https://reviews.freebsd.org/D39245
* [skip ci] improvements to cap_sysctl.3Alan Somers2022-12-081-7/+35
| | | | | | | | | | | * Correct some function prototypes which were documented with the wrong pointer type. * Clarify return values and requirements for freeing the limit handle. MFC after: 1 week Sponsored by: Axcient Reviewed by: oshogbo Differential Revision: https://reviews.freebsd.org/D37586
* cap_sysctl.3: Fix bugs in the exampleMark Johnston2021-04-281-1/+2
| | | | | | | | - Correct the type of the sysctl value. - Initialize the oldsize parameter to cap_sysctlbyname() MFC after: 1 week Sponsored by: The FreeBSD Foundation
* cap_sysctl: expose structures and variablesMariusz Zaborski2021-01-041-4/+5
| | | | | Expose structures and variables that may be used on systems build without Casper support.
* casper: convert macros to inline functionsMariusz Zaborski2021-01-041-10/+53
| | | | | | | | In libcasper, the first argument to the function is a structure that represents a connection to Casper. On systems without Casper, macros are used to interpose the Casper functions to standard libc ones. This may cause errors/warnings that the variable is not used. With the inline function, there is no such problem.
* build: provide a default WARNS for all in-tree buildsKyle Evans2020-09-181-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | The current default is provided in various Makefile.inc in some top-level directories and covers a good portion of the tree, but doesn't cover parts of the build a little deeper (e.g. libcasper). Provide a default in src.sys.mk and set WARNS to it in bsd.sys.mk if that variable is defined. This lets us relatively cleanly provide a default WARNS no matter where you're building in the src tree without breaking things outside of the tree. Crunchgen has been updated as a bootstrap tool to work on this change because it needs r365605 at a minimum to succeed. The cleanup necessary to successfully walk over this change on WITHOUT_CLEAN builds has been added. There is a supplemental project to this to list all of the warnings that are encountered when the environment has WARNS=6 NO_WERROR=yes: https://warns.kevans.dev -- this project will hopefully eventually go away in favor of CI doing a much better job than it. Reviewed by: emaste, brooks, ngie (all earlier version) Reviewed by: emaste, arichardson (depend-cleanup.sh change) Differential Revision: https://reviews.freebsd.org/D26455 Notes: svn path=/head/; revision=365887
* libcasper(3): Document HISTORY within the manpagesGordon Bergling2020-06-161-1/+6
| | | | | | | | | | Reviewed by: bcr (mentor) Approved by: bcr (mentor) MFC after: 7 days Differential Revision: https://reviews.freebsd.org/D24695 Notes: svn path=/head/; revision=362230
* libcasper(3): Export functions to C++Conrad Meyer2020-04-071-0/+7
| | | | | | | | | | | | We must wrap C declarations in __BEGIN / __END_DECLS to avoid C++ name-mangling of the declaration when including the C header; name-mangling causes the linker to attempt to locate the wrong (C++ ABI) symbol name. Reviewed by: markj, oshogbo (earlier version both) Differential Revision: https://reviews.freebsd.org/D24323 Notes: svn path=/head/; revision=359696
* libcasper: Constify cap_sysctl_limit_mib() mib parameterConrad Meyer2020-04-063-5/+5
| | | | | | | | | | | No functional change. Minor API change that is nicer for consumers. ABI is identical; the routine never needed to modify the pointed to value. Reviewed by: emaste, markj Differential Revision: https://reviews.freebsd.org/D24319 Notes: svn path=/head/; revision=359674
* Update Makefile.depend filesSimon J. Gerraty2019-12-111-1/+0
| | | | | | | | | | | | | Update a bunch of Makefile.depend files as a result of adding Makefile.depend.options files Reviewed by: bdrewery MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D22494 Notes: svn path=/head/; revision=355617
* cap_sysctl: correct typo from r347534-ishKyle Evans2019-10-231-1/+1
| | | | | | | | | | operation & ~limit where limit is a bool is clearly not what was intended, given the line prior. Correct it to use the calculated mask for validation. The cap_sysctl tests should now be functional again. Notes: svn path=/head/; revision=353914
* pkgbase: Move libcap_ to FreeBSD-runtimeEmmanuel Vadot2019-09-051-1/+1
| | | | | | | | | | | A lot of binaries present in FreeBSD-runtime depend on it so move the libs there. Reviewed by: bapt, gjb Differential Revision: https://reviews.freebsd.org/D21501 Notes: svn path=/head/; revision=351853
* Extend the libcap_sysctl tests.Mark Johnston2019-05-131-2/+122
| | | | | | | | | | | | | - Add some coverage for cap_sysctl(3). - Add a test for the case where the caller wishes to find the sysctl output length without specifying an output buffer. Reviewed by: oshogbo Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D17856 Notes: svn path=/head/; revision=347536
* Convert the libcap_sysctl test cases to ATF.Mark Johnston2019-05-132-349/+401
| | | | | | | | | Reviewed by: oshogbo Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D17855 Notes: svn path=/head/; revision=347535
* Add cap_sysctl(3) and cap_sysctlnametomib(3).Mark Johnston2019-05-135-738/+1054
| | | | | | | | | | | | | | | | These complement cap_sysctlbyname(3) to provide a drop-in replacement for the corresponding libc functions. Also revise the libcap_sysctl limit interface to provide access to sysctls by MIB, and to avoid direct manipulation of nvlists by the caller. Reviewed by: oshogbo Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D17854 Notes: svn path=/head/; revision=347534
* Fix reference to man page in Makefile.Mariusz Zaborski2018-03-181-1/+1
| | | | | | | I broke it in r331120. Notes: svn path=/head/; revision=331137
* Fix similar typos to r331124.Mariusz Zaborski2018-03-181-1/+1
| | | | Notes: svn path=/head/; revision=331125
* Document the sysctl Casper service.Mariusz Zaborski2018-03-182-0/+148
| | | | | | | | | PR: 226102 Reviewed by: bcr@ Differential Revision: https://reviews.freebsd.org/D14606 Notes: svn path=/head/; revision=331120
* Introduce channel flags in libcasper.Mariusz Zaborski2018-02-172-2/+2
| | | | | | | | | | | | | Instead of passing flags (which describe a type of nvlist) every send/recv we remember them in channel. It's enough for use to extract them only during unwrap. This simplify use of Casper. Reviewed by: bruffer@, bcr@ (both man page) Differential Revision: https://reviews.freebsd.org/D14196 (man page) Notes: svn path=/head/; revision=329452
* Add SPDX tags for libcasper(3) and services.Mariusz Zaborski2018-01-272-0/+4
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=328473
* Build service tests with Casper support.Mariusz Zaborski2018-01-051-0/+1
| | | | Notes: svn path=/head/; revision=327583
* Casper work's only as shared library - disable building static ones.Mariusz Zaborski2017-11-041-1/+1
| | | | | | | | Reviewed by: bdrewery@ Differential Revision: https://reviews.freebsd.org/D12917 Notes: svn path=/head/; revision=325398
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* DIRDEPS_BUILD: Connect new directories.Bryan Drewery2017-10-311-0/+20
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325187
* Introduce caspermocks.Mariusz Zaborski2017-10-283-1/+17
| | | | | | | | | | | | | | | | | | | | The idea behinds mocks is that we don't need to ifdef a lot of code in tools itself but those defines are hidden in the casper library. Right now the mocks are implemented as define/inlines functions. There was a very long discussion how this should be implemented. This approach has some advantages like we don't need to link to any additional libraries. Unfortunately there are also some disadvantages for example it is easy to get library out of sync between two versions of functions or that we need extra define to compile program with casper support. This isn't an ideal solution but it's good enough for now and should simplify capsicumizing programs. This also doesn't close us any other ways to do those mocks and this should evolve in time. Discussed with: pjd, emaste, ed, rwatson, bapt, cem, bdrewery Differential Revision: https://reviews.freebsd.org/D8753 Notes: svn path=/head/; revision=325062
* Add supporting changes for `Add limited sandbox capability to "make check"`Enji Cooper2017-08-141-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Non-tests/... changes: - Add HAS_TESTS= to Makefiles with libraries and programs to enable iteration and propagate the appropriate environment down to *.test.mk. tests/... changes: - Add appropriate support Makefile.inc's to set HAS_TESTS in a minimal manner, since tests/... is a special subdirectory tree compared to the others. MFC after: 2 months MFC with: r322511 Reviewed by: arch (silence), testing (silence) Differential Revision: D12014 Notes: svn path=/head/; revision=322515
| * Add HAS_TESTS to all Makefiles that are currently using theEnji Cooper2017-08-021-0/+1
| | | | | | | | | | | | | | | | | | `SUBDIR.${MK_TESTS}+= tests` idiom. This is a follow up to r321912. Notes: svn path=/projects/make-check-sandbox/; revision=321914
* | Make root-privileges a requirement for the testEnji Cooper2017-08-131-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Some of the testcases try to manipulate sysctls that require root privileges, e.g., "kern.sync_on_panic". Make root-privileges a hard requirement so the tests don't raise false positives due to privilege issues when calling sysctlbyname(3) on writable sysctls. MFC after: 1 week Notes: svn path=/head/; revision=322448
* | Fix result printingEnji Cooper2017-08-131-4/+7
|/ | | | | | | | | | | - Flushing stdout prevents the buffer from being printed twice, fixing issues with stdout printing out the testplan, etc, twice. - Don't print out raw source/line numbers; hide them behind comments. MFC after: 1 week Notes: svn path=/head/; revision=322447
* Convert traditional ${MK_TESTS} conditional idiom for including testEnji Cooper2017-08-021-3/+1
| | | | | | | | | | | | | | directories to SUBDIR.${MK_TESTS} idiom This is being done to pave the way for future work (and homogenity) in ^/projects/make-check-sandbox . No functional change intended. MFC after: 1 weeks Notes: svn path=/head/; revision=321912
* Set SHLIBDIR before .including src.opts.mk in libcapser servicesEd Maste2016-10-241-1/+2
| | | | | | | | | | | bsd.own.mk (included from src.opts.mk) sets SHLIBDIR?=${LIBDIR}, so SHLIBDIR must be set before including either one of them. MFC with: 305626 Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=307863
* Move libcasper tests from regression/capsicum/libcasper/ toMariusz Zaborski2016-09-083-0/+1527
| | | | | | | | | | lib/libcasper/service/${service_name}/tests. Reviewed by: emaste, ngie Differential Revision: https://reviews.freebsd.org/D7759 Notes: svn path=/head/; revision=305626
* Add flags to the Casper services.Mariusz Zaborski2016-06-081-1/+1
| | | | | | | | | | CASPER_SERVICE_STDIO - Casper will not close the first three descriptors (stdin, stdout and stderr) this can be helpful for debugging. CASPER_SERVICE_FD - Capser will not close all other descriptors, this can be useful for a filesystem service. Notes: svn path=/head/; revision=301572
* MFHGlen Barber2016-03-021-0/+1
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=296318
* Update dependencies.Bryan Drewery2016-02-261-0/+20
| | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=296127
* Remove unneeded lines.Bryan Drewery2016-02-261-3/+0
| | | | | | | | | | | - WARNS can be inherited from lib/Makefile.inc - CFLAGS referred to a non-existent directory and this shouldn't be needed anyhow due to the build picking up includes from WORLDTMP. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=296126