aboutsummaryrefslogtreecommitdiff
path: root/lib/libproc/proc_create.c
Commit message (Collapse)AuthorAgeFilesLines
* lib: Automated cleanup of cdefs and other formattingWarner Losh2023-11-271-1/+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
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | 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
* Use a global extern declaration to appease gcc.Mark Johnston2017-12-061-1/+2
| | | | | | | | Reported by: gjb X-MFC with: r326498 Notes: svn path=/head/; revision=326626
* Add an envp argument to proc_create().Mark Johnston2017-12-031-13/+13
| | | | | | | | | This is needed to support dtrace's -x setenv option. MFC after: 2 weeks Notes: svn path=/head/; revision=326498
* lib: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-261-0/+2
| | | | | | | | | | | | | | | 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
* Add initializations missed in r315728.Mark Johnston2017-03-221-0/+3
| | | | | | | X-MFC With: r315728 Notes: svn path=/head/; revision=315729
* Avoid accessing an uninitialized variable when vfork() fails.Mark Johnston2017-03-221-9/+9
| | | | | | | | | Reported by: Miles Ohlrich <miles.ohlrich@isilon.com> MFC after: 1 week Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=315728
* libproc: Add support for some proc_attach() flags.Mark Johnston2016-12-061-18/+23
| | | | | | | | | | This change adds some handling for the equivalent of Solaris' PGRAB_* flags. In particular, support for PGRAB_RDONLY is needed to avoid a nasty deadlock: dtrace(1) may otherwise stop the master process for its pseudo-terminal and end up blocking while writing to standard output. Notes: svn path=/head/; revision=309597
* libproc: Cache symbol tables for mapped objects upon access.Mark Johnston2016-12-061-0/+4
| | | | | | | | | | | Extend the file handle cache entries to include symbol tables as well. An index is used to implement binary search by symbol value. Lookups by name are comparatively rare and are thus still implemented with a linear search, but support for a binary search by name would be straightforward to add if needed. Notes: svn path=/head/; revision=309596
* libproc: Cache ELF handles for loaded objects.Mark Johnston2016-12-061-1/+17
| | | | | | | | | | libproc previously created a new handle for each symbol lookup, which gives rather egregious performance for DTrace's ustack() action. With this change libproc will cache the libelf descriptor upon access, making lookups much faster in the common case. Notes: svn path=/head/; revision=309594
* libproc: Make proc_getpid() an accessor for struct proc_handle.Mark Johnston2016-12-061-2/+2
| | | | | | | | | This allows librtld_db to fetch the PID from a handle without calling into libproc. Together with r303531, this means that librtld_db no longer references symbols from libproc. Notes: svn path=/head/; revision=309592
* Fix style bugs and remove trailing whitespace in libproc and librtld_db.Mark Johnston2016-12-061-2/+3
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=309591
* proc_init: Fix a few memory leaks of 'phdl'Conrad Meyer2016-08-021-5/+5
| | | | | | | | | | | | | | | | In the normal case and correct failure cases, the 'phdl' pointer is passed to callers to use or clean up as needed. However, some failure cases returned early, failing to export the phdl pointer. This was introduced in the restructuring of r303533. Reported by: Coverity CID: 1361070 Reviewed by: markj Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=303669
* libproc: Add proc_getmodel().Mark Johnston2016-07-301-40/+87
| | | | | | | | | | | This is used by libdtrace to determine the data model of target processes. This allows for the creation of pid provider probes in 32-bit processes on amd64. MFC after: 1 month Notes: svn path=/head/; revision=303533
* Allow "a.out" as an alias for the executable if no other matching entriesMark Johnston2014-05-031-10/+42
| | | | | | | | | | are found. This improves compatibility with Solaris' libproc and fixes a number of failing DTrace tests that rely on this feature. MFC after: 3 weeks Notes: svn path=/head/; revision=265255
* Clean up the debug printing in libproc a bit. In particular:Mark Johnston2013-10-271-3/+3
| | | | | | | | | * Don't print any error messages to stderr unless DEBUG is defined. * Add a DPRINTFX macro for use when errno isn't set. * Print the error string from libelf when appropriate. Notes: svn path=/head/; revision=257222
* fix a serious bug in libproc's proc_attachAndriy Gapon2011-08-031-2/+1
| | | | | | | | | | | | | proc_attach always frees any struct proc_handle data that it allocates, but that is supposed to be done only in error conditions. PR: bin/158431 Approved by: re (kib) MFC after: 1 week Notes: svn path=/head/; revision=224632
* Fix a memory leak on the error conditionKevin Lo2010-12-141-1/+1
| | | | | | | Reviewed by: rpaulo Notes: svn path=/head/; revision=216432
* New version of libproc. Changes are:Rui Paulo2010-07-311-33/+28
| | | | | | | | | | | | | | * breakpoint setup support * register query * symbol to address mapping and vice-versa * more misc utility functions based on their Solaris counterpart Also, I've written some test cases. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=210688
* Merge latest DTrace changes from Perforce.Craig Rodrigues2008-11-051-2/+6
| | | | | | | | | Update libproc API to reflect new changes. Approved by: jb Notes: svn path=/head/; revision=184697
* Add a process library with some stubs that the DTrace client needs.John Birrell2008-05-221-0/+159
These will be fleshed out as part of the DTrace userland tracing development. For now, the kernel tracing part of DTrace requires minimal functionality for this library. The API for this library is deliberately different from the libproc in OpenSolaris due to licensing restrictions. Notes: svn path=/head/; revision=179185