summaryrefslogtreecommitdiff
path: root/lib/libproc
AgeCommit message (Collapse)Author
2025-11-24Use ZFSTOP more broadlyJohn Baldwin
Reviewed by: brooks Obtained from: CheriBSD Differential Revision: https://reviews.freebsd.org/D53791
2025-11-17zfs: unbreak gcc builds after openzfs/zfs@e63d026b9Martin Matuska
2025-11-17zfs: fix build after openzfs/zfs@e63d026b9Martin Matuska
Fix Makefiles Update zfs_config.h and zfs_gitrev.h
2025-06-11Fix proc_signame() to use sig2str()Ricardo Branco
Reviewed by: imp, kib, des, jilles Pull Request: https://github.com/freebsd/freebsd-src/pull/1696
2025-06-11Remove definition of SIG2STR_MAX from libproc.hRicardo Branco
Reviewed by: imp, kib, des, jilles Pull Request: https://github.com/freebsd/freebsd-src/pull/1696
2024-07-30Remove "All Rights Reserved" from FreeBSD Foundation copyrightsEd Maste
These ones were unambiguous cases where the Foundation was the only listed copyright holder. Sponsored by: The FreeBSD Foundation
2024-07-15Remove residual blank line at start of MakefileWarner Losh
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
2024-07-13Prepare some build fixes in advance of more _FORTIFY_SOURCEKyle Evans
ZFS' libspl needs to be made aware that we have strlcat(3) and strlcpy(3) to avoid some more complicated declaration duplication, so go ahead and define these HAVE_ macros now. libprocstat has to define `_KERNEL` and include kernel headers in order to get what it wants, but this results in sys/cdefs.h being included too late and we pick up the build breaking version of the __RENAME definition. Just explicitly include sys/cdefs.h earlier rather than disabling _FORTIFY_SOURCE. The zfs/ subdir only builds an object that holds some structures and sizes, so just disable _FORTIFY_SOURCE there entirely rather than trying to move #define _KERNEL into the file.. While we're here, make sure that we disable _FORTIFY_SOURCE in the bootloader because we don't have the symbol renaming support today to do it as cleanly as we'd like. ssp/ssp.h needs to be pulled into the libsa environment so that other bits can understand that ssp is disabled in the consistent __SSP_FORTIFY_LEVEL way that we try to do. Reviewed by: allanjude (previous version), markj Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D45676
2023-11-26lib: Automated cleanup of cdefs and other formattingWarner Losh
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
2023-08-16Remove $FreeBSD$: one-line sh patternWarner Losh
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16Remove $FreeBSD$: one-line .c patternWarner Losh
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16Remove $FreeBSD$: two-line .h patternWarner Losh
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-08-01dtrace: remove dead code for PR_REQUESTEDEric van Gyzen
libproc's PR_REQUESTED is not implemented on FreeBSD. Remove dead code in dtrace that would handle it. Reviewed by: markj MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D41225
2023-08-01proc_detach: use ptrace(PT_KILL) to kill the traceeEric van Gyzen
When MFC'ing commit dad11f990e2 to stable/12, the child would dump core when dtrace exited. It was getting SIGTRAP, even though proc_detach sent a SIGKILL. I could not find the reason for this difference in behavior from main (and stable/13). The present change, however, works as expected, probably due the proc_wkilled special case in kern_ptrace. It also seems like a more obvious approach. While I'm here, fix two other issues in the previous code: It would SIGKILL a tracee even in read-only mode. It would SIGSTOP/SIGCONT the tracee if ptrace succeeded but errno happened to be EBUSY for some other reason. Reviewed by: markj MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D41122
2023-05-12spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh
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
2023-04-18Update/fix Makefile.depend for userlandSimon J. Gerraty
2023-03-29libproc: Trim a MIPS leftover.John Baldwin
Fixes: 101ba46bb6bd libproc: retire now-unused MIPS support
2023-01-26Retire WITHOUT_CXX optionEd Maste
Several important base system components are written in C++, and the WITHOUT_CXX option produced a system that was not fully functional. Just accept this, and remove the option to build without C++ support. This reverts commit adc3c128c6603054586a993d117e5dd808deac17. Reviewed by: brooks, kevans, jhb (earlier) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33108
2022-10-17libproc: retire now-unused MIPS supportEd Maste
Discussed with: imp
2022-09-30Alter the prototype of qsort_r(3) to match POSIX, which adopted theEd Schouten
glibc-based interface. Unfortunately, the glibc maintainers, despite knowing the existence of the FreeBSD qsort_r(3) interface in 2004 and refused to add the same interface to glibc based on grounds of the lack of standardization and portability concerns, has decided it was a good idea to introduce their own qsort_r(3) interface in 2007 as a GNU extension with a slightly different and incompatible interface. With the adoption of their interface as POSIX standard, let's switch to the same prototype, there is no need to remain incompatible. C++ and C applications written for the historical FreeBSD interface get source level compatibility when building in C++ mode, or when building with a C compiler with C11 generics support, provided that the caller passes a fifth parameter of qsort_r() that exactly matches the historical FreeBSD comparator function pointer type and does not redefine the historical qsort_r(3) prototype in their source code. Symbol versioning is used to keep old binaries working. MFC: never Relnotes: yes Reviewed by: cem, imp, hps, pauamma Differential revision: https://reviews.freebsd.org/D17083
2022-07-10libproc: replace home grown crc32 with zlib implementation.Xin LI
MFC after: 2 weeks Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D35766
2021-02-01Remove the MK_LIBCPLUSPLUS optionAlex Richardson
This option has been equivalent to any form of C++ support since libstdc++ was removed. Therefore, replace all MK_LIBCPLUSPLUS uses with MK_CXX. Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D27974
2020-10-01Do a sweep and remove most WARNS=6 settingsKyle Evans
Repeating the default WARNS here makes it slightly more difficult to experiment with default WARNS changes, e.g. if we did something absolutely bananas and introduced a WARNS=7 and wanted to try lifting the default to that. Drop most of them; there is one in the blake2 kernel module, but I suspect it should be dropped -- the default WARNS in the rest of the build doesn't currently apply to kernel modules, and I haven't put too much thought into whether it makes sense to make it so. Notes: svn path=/head/; revision=366304
2020-09-10Remove -I flag for include path that doesn't existAlex Richardson
Found this while trying to get macOS bootstrap to work again after OpenZFS merge. Reviewed By: #zfs, freqlabs Differential Revision: https://reviews.freebsd.org/D26192 Notes: svn path=/head/; revision=365580
2020-08-25Merge OpenZFS support in to HEAD.Matt Macy
The primary benefit is maintaining a completely shared code base with the community allowing FreeBSD to receive new features sooner and with less effort. I would advise against doing 'zpool upgrade' or creating indispensable pools using new features until this change has had a month+ to soak. Work on merging FreeBSD support in to what was at the time "ZFS on Linux" began in August 2018. I first publicly proposed transitioning FreeBSD to (new) OpenZFS on December 18th, 2018. FreeBSD support in OpenZFS was finally completed in December 2019. A CFT for downstreaming OpenZFS support in to FreeBSD was first issued on July 8th. All issues that were reported have been addressed or, for a couple of less critical matters there are pull requests in progress with OpenZFS. iXsystems has tested and dogfooded extensively internally. The TrueNAS 12 release is based on OpenZFS with some additional features that have not yet made it upstream. Improvements include: project quotas, encrypted datasets, allocation classes, vectorized raidz, vectorized checksums, various command line improvements, zstd compression. Thanks to those who have helped along the way: Ryan Moeller, Allan Jude, Zack Welch, and many others. Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D25872 Notes: svn path=/head/; revision=364746
2020-05-12Re-enable proc_test:symbol_lookup after r360979.Mark Johnston
PR: 244732 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=360980
2020-03-11Temporarily skip 2 failing tests after llvm10 importLi-Wen Hsu
PR: 244732 Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=358887
2019-12-11Update Makefile.depend filesSimon J. Gerraty
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
2019-12-11Add Makefile.depend.optionsSimon J. Gerraty
Leaf directories that have dependencies impacted by options need a Makefile.depend.options file to avoid churn in Makefile.depend DIRDEPS for cases such as OPENSSL, TCP_WRAPPERS etc can be set in local.dirdeps-options.mk which can add to those set in Makefile.depend.options See share/mk/dirdeps-options.mk Reviewed by: bdrewery MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D22469 Notes: svn path=/head/; revision=355616
2019-09-05pkgbase: Create a FreeBSD-utilities package and make it the default oneEmmanuel Vadot
The default package use to be FreeBSD-runtime but it should only contain binaries and libs enough to boot to single user and repair the system, it is also very handy to have a package that can be tranform to a small mfsroot. So create a new package named FreeBSD-utilities and make it the default one. Also move a few binaries and lib into this package when it make sense. Reviewed by: bapt, gjb Differential Revision: https://reviews.freebsd.org/D21506 Notes: svn path=/head/; revision=351858
2019-08-22mips: hide regnum definitions behind _KERNEL/_WANT_MIPS_REGNUMKyle Evans
machine/regnum.h ends up being included by sys/procfs.h and sys/ptrace.h via machine/reg.h. Many of the regnum definitions are too short and too generic to be exposing to any userland application including one of these two headers. Moreover, these actively cause build failures in googletest (template <typename T1 ...> expanding to template <typename 9 ...>). Hide the definitions behind _KERNEL or _WANT_MIPS_REGNUM, and patch all of the userland consumers to define as needed. Discussed with: imp, jhb Reviewed by: imp, jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21330 Notes: svn path=/head/; revision=351409
2019-08-08mips: Fix register target for SP setting in libprocJustin Hibbits
Copy-paste-o from r233042 Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D21188 Notes: svn path=/head/; revision=350756
2019-07-22Be consistent about temporary variable use in adjacent loops.Brooks Davis
Obtained from: CheriBSD MFC after: 1 week Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=350218
2019-07-19Remove an unneeded temporary variable in two functions.Brooks Davis
There is no need to convert an intptr_t to a long just to cast it to a (void *). Obtained from: CheriBSD MFC after: 1 week Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=350158
2018-07-27Detach from the child process before completing the test.Mark Johnston
Otherwise the child will receive SIGTRAP if the parent exits first. Notes: svn path=/head/; revision=336782
2018-07-21Take the mapping's segment offset into account when resolving symbols.Mark Johnston
Reported by: Jenkins, via asomers MFC after: 2 weeks Notes: svn path=/head/; revision=336592
2018-07-21Disable optimization of the libproc test program.Mark Johnston
Dead code elimination may remove symbols that are required by the tests. Reported by: Jenkins, via asomers MFC after: 1 week Notes: svn path=/head/; revision=336591
2017-12-06Use a global extern declaration to appease gcc.Mark Johnston
Reported by: gjb X-MFC with: r326498 Notes: svn path=/head/; revision=326626
2017-12-03Add an envp argument to proc_create().Mark Johnston
This is needed to support dtrace's -x setenv option. MFC after: 2 weeks Notes: svn path=/head/; revision=326498
2017-12-01Eliminate the last user of basename_r() in the base system.Ed Schouten
In this case it's fairly easy to make use of basename(). Notes: svn path=/head/; revision=326423
2017-11-26lib: further adoption of SPDX licensing ID tags.Pedro F. Giffuni
Mainly focus on files that use BSD 2-Clause license, however the tool I was using mis-identified many licenses so this was mostly a manual - error prone - task. 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. Notes: svn path=/head/; revision=326219
2017-11-21Refine symtab sorting in libproc.Mark Johnston
Add some rules to more closely match what illumos does when an address resolves to multiple symbols: - prefer non-local symbols - prefer symbols with fewer leading underscores and no leading '$' Add some regression tests to verify these rules. Notes: svn path=/head/; revision=326064
2017-10-31DIRDEPS_BUILD: Update dependencies.Bryan Drewery
Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
2017-09-06Avoid keeping a dangling pointer when the mappings array is resized.Mark Johnston
Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=323227
2017-08-14Add supporting changes for `Add limited sandbox capability to "make check"`Enji Cooper
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
2017-08-07o Replace __riscv__ with __riscvRuslan Bukin
o Replace __riscv64 with (__riscv && __riscv_xlen == 64) This is required to support new GCC 7.1 compiler. This is compatible with current GCC 6.1 compiler. RISC-V is extensible ISA and the idea here is to have built-in define per each extension, so together with __riscv we will have some subset of these as well (depending on -march string passed to compiler): __riscv_compressed __riscv_atomic __riscv_mul __riscv_div __riscv_muldiv __riscv_fdiv __riscv_fsqrt __riscv_float_abi_soft __riscv_float_abi_single __riscv_float_abi_double __riscv_cmodel_medlow __riscv_cmodel_medany __riscv_cmodel_pic __riscv_xlen Reviewed by: ngie Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D11901 Notes: svn path=/head/; revision=322168
2017-08-02Add HAS_TESTS to all Makefiles that are currently using theEnji Cooper
`SUBDIR.${MK_TESTS}+= tests` idiom. This is a follow up to r321912. Notes: svn path=/projects/make-check-sandbox/; revision=321914
2017-08-02Convert traditional ${MK_TESTS} conditional idiom for including testEnji Cooper
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
2017-05-22Ensure that the mappings table is populated in proc_objname().Mark Johnston
MFC after: 1 week Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=318687
2017-03-22Add initializations missed in r315728.Mark Johnston
X-MFC With: r315728 Notes: svn path=/head/; revision=315729