aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/truss
Commit message (Collapse)AuthorAgeFilesLines
* Rename i386's Linux ELF to Linux ELF32Jessica Clarke2021-01-211-1/+1
| | | | | | | | | This is what amd64 calls the i386 Linux ABI in order to distinguish it from the amd64 Linux ABI, and matches the nomenclature used for the FreeBSD ABIs where they always have the size suffix in the name. Reviewed by: trasz Differential Revision: https://reviews.freebsd.org/D27647
* Rename NO_WERROR -> MK_WERROR=noAlex Richardson2021-01-071-1/+0
| | | | | | | | As suggested in D27598. This also supports MK_WERROR.clang=no and MK_WERROR.gcc=no to support the existing NO_WERROR.<compiler> uses. Reviewed By: brooks Differential Revision: https://reviews.freebsd.org/D27601
* truss: Add AIO syscalls.Thomas Munro2020-12-102-0/+172
| | | | | | | | | | | | Display the arguments of aio_read(2), aio_write(2), aio_suspend(2), aio_error(2), aio_return(2), aio_cancel(2), aio_fsync(2), aio_mlock(2), aio_waitcomplete(2) and lio_listio(2) in human-readable form. Reviewed by: asomers Differential Revision: https://reviews.freebsd.org/D27518 Notes: svn path=/head/; revision=368500
* kdump/truss: decode new _umtx_op flagsKyle Evans2020-12-091-3/+17
| | | | | | | | | | | | | | | | | | | | In both cases, print the flag bits first followed by the command. Output now looks something like this: (ktrace) _umtx_op(0x8605f7008,0xf<UMTX_OP_WAIT_UINT_PRIVATE>,0,0,0) _umtx_op(0x9fffdce8,0x80000003<UMTX_OP__32BIT|UMTX_OP_WAKE>,0x1,0,0) (truss) _umtx_op(0x7fffffffda50,UMTX_OP_WAKE,0x1,0x0,0x0) = 0 (0x0) _umtx_op(0x9fffdd08,UMTX_OP__32BIT|UMTX_OP_WAKE,0x1,0x0,0x0) = 0 (0x0) Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D27325 Notes: svn path=/head/; revision=368481
* Enable iterating all sysctls, even ones with CTLFLAG_SKIPRyan Moeller2020-10-051-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* truss: print more information about traced sysctlsPawel Biernacki2020-07-051-24/+42
| | | | | | | | MFC after: 2 weeks Sponsored by: Mysterious Code Ltd. Notes: svn path=/head/; revision=362947
* Decode the file descriptor argument to closefrom(2) as an Integer.Christian S.J. Peron2020-05-211-0/+2
| | | | | | | | | | | | This is consistent with what we are doing for close(2) and it makes it a bit easier to follow when debugging file descriptor operations. i.e. many other syscalls are decoding fds as integers rather than base 16 numbers. MFC after: 1 week Notes: svn path=/head/; revision=361316
* vfs: add realpathat syscallMateusz Guzik2020-02-201-0/+3
| | | | | | | | | | | | | | | | | | realpath(3) is used a lot e.g., by clang and is a major source of getcwd and fstatat calls. This can be done more efficiently in the kernel. This works by performing a regular lookup while saving the name and found parent directory. If the terminal vnode is a directory we can resolve it using usual means. Otherwise we can use the name saved by lookup and resolve the parent. See the review for sample syscall counts. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D23574 Notes: svn path=/head/; revision=358172
* truss: fix shm_open2 oversight (BinString -> Name)Kyle Evans2020-02-191-1/+1
| | | | | | | | BinString assumes a length in the next argument; Name is more appropriate for the final argument. Notes: svn path=/head/; revision=358118
* truss: decode shm_open2Kyle Evans2020-02-192-0/+7
| | | | | | | | | | | | | | | shm_open2 is similar to shm_open, except it also takes shmflags and optional name to label the anonymous region for, e.g., debugging purposes. The appropriate support for decoding shmflags was added to libsysdecode in r358115. This is a part of D23733. Reviewed by: kaktus Notes: svn path=/head/; revision=358116
* Miscellaneous typo fixesEd Maste2020-02-071-1/+1
| | | | | | | | Submitted by: Gordon Bergling <gbergling_gmail.com> Differential Revision: https://reviews.freebsd.org/D23453 Notes: svn path=/head/; revision=357664
* truss: centralize pointer-constructing casts.Brooks Davis2019-10-311-107/+104
| | | | | | | | | | | | | | | In nearly all cases, the caller has a uintptr_t compatible argument so this eliminates a large number of casts. Add a print_pointer function to centralize printing pointers. Reviewed by: jhb Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22212 Notes: svn path=/head/; revision=354232
* Fix a typo in a comment.John Baldwin2019-10-031-1/+1
| | | | Notes: svn path=/head/; revision=353058
* Add an shm_rename syscallDavid Bright2019-09-261-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Add an atomic shm rename operation, similar in spirit to a file rename. Atomically unlink an shm from a source path and link it to a destination path. If an existing shm is linked at the destination path, unlink it as part of the same atomic operation. The caller needs the same permissions as shm_unlink to the shm being renamed, and the same permissions for the shm at the destination which is being unlinked, if it exists. If those fail, EACCES is returned, as with the other shm_* syscalls. truss support is included; audit support will come later. This commit includes only the implementation; the sysent-generated bits will come in a follow-on commit. Submitted by: Matthew Bryan <matthew.bryan@isilon.com> Reviewed by: jilles (earlier revision) Reviewed by: brueffer (manpages, earlier revision) Relnotes: yes Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D21423 Notes: svn path=/head/; revision=352747
* truss: decode sysctl names.Konstantin Belousov2019-09-182-0/+73
| | | | | | | | | Submitted by: Pawel Biernacki MFC after: 1 week Differential revision: https://reviews.freebsd.org/D21688 Notes: svn path=/head/; revision=352488
* Use PT_GET_SC_ARGS and PT_GET_SC_RET in truss.John Baldwin2019-07-1624-2337/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes all of the architecture-specific functions from truss. A per-ABI structure is still needed to map syscall numbers to names and FreeBSD errno values to ABI error values as well as hold syscall counters. However, the linker set of ABI structures is now replaced with a simple table mapping ABI names to structures. This approach permits sharing the same ABI structure among separate names such as i386 a.out and ELF binaries as well as ELF v1 vs ELF v2 for powerpc64. A few differences are visible due to using PT_GET_SC_RET to fetch the error value of a system call. Note that ktrace/kdump have had the "new" behaviors for a long time already: - System calls that return with EJUSTRETURN or ERESTART will now be noticed and logged as such. Previously sigreturn (which uses EJUSTRETURN) would report whatever random value was in the register holding errno from the previous system call for example. Now it reports EJUSTRETURN. - System calls that return errno as their error value such as posix_fallocate() and posix_fadvise() now report non-zero return values as errors instead of success with a non-zero return value. Reviewed by: kib MFC after: 1 month Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D20963 Notes: svn path=/head/; revision=350069
* truss: Add support for fsync(2) and fdatasync(2).Thomas Munro2019-02-281-0/+4
| | | | | | | | | | | | | The default handling showed the argument as hex. Add explicit handling so we can show it as decimal, since that's how we show file descriptors everywhere else. Approved by: mjg (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D19295 Notes: svn path=/head/; revision=344656
* Validate the string size parameter passed to -s.John Baldwin2018-12-101-1/+4
| | | | | | | | | | | | Use strtonum() to reject negative sizes instead of core dumping. PR: 232206 Submitted by: David Carlier <devnexen@gmail.com> MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D17537 Notes: svn path=/head/; revision=341802
* Rename riscv64-freebsd.c to riscv-freebsd.c.John Baldwin2018-12-061-8/+8
| | | | | | | | | | | This fixes truss when built as part of a riscv64sf world. Additionally, if FreeBSD ever supports RV32 RISC-V most of this file can be used as-is just as a single file is used for all of the MIPS ABIs. Sponsored by: DARPA Notes: svn path=/head/; revision=341656
* Allow truss to operate on ELFv2 processes.Justin Hibbits2018-11-291-0/+11
| | | | | | | | | | | | | | Summary: Currently, truss doesn't work on ELFv2 processes due to not recognizing the ABI. Since there's no special handling needed here, just adding a PROCABI struct for it is sufficient to get it working. Submitted by: git_bdragon.rtk0.net Differential Revision: https://reviews.freebsd.org/D18352 Notes: svn path=/head/; revision=341179
* truss: Fix display of shm_open(SHM_ANON, ...).Thomas Munro2018-10-282-1/+10
| | | | | | | | | | | | | Currently truss(1) shows shm_open(SHM_ANON, ...) as shm_open("(null)", ...). Detect the special value and display it by name. Reviewed by: jhb, allanjude, tuexen Approved by: mjg (mentor) MFC with: r339224 Differential Revision: https://reviews.freebsd.org/D17461 Notes: svn path=/head/; revision=339840
* Teach truss how to display shm_open(2), shm_unlink(2)Allan Jude2018-10-071-0/+4
| | | | | | | | | | | Submitted by: Thomas Munro <munro@ip9.org> Reviewed by: tuexen, kib Approved by: re (rgrimes) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D17457 Notes: svn path=/head/; revision=339224
* Make timespecadd(3) and friends publicAlan Somers2018-07-303-23/+5
| | | | | | | | | | | | | | | | | | | | | | The timespecadd(3) family of macros were imported from NetBSD back in r35029. However, they were initially guarded by #ifdef _KERNEL. In the meantime, we have grown at least 28 syscalls that use timespecs in some way, leading many programs both inside and outside of the base system to redefine those macros. It's better just to make the definitions public. Our kernel currently defines two-argument versions of timespecadd and timespecsub. NetBSD, OpenBSD, and FreeDesktop.org's libbsd, however, define three-argument versions. Solaris also defines a three-argument version, but only in its kernel. This revision changes our definition to match the common three-argument version. Bump _FreeBSD_version due to the breaking KPI change. Discussed with: cem, jilles, ian, bde Differential Revision: https://reviews.freebsd.org/D14725 Notes: svn path=/head/; revision=336914
* Reformat the enum of syscall argument types.John Baldwin2018-03-291-21/+133
| | | | | | | | | | | | List enum values on separate lines to minimize diffs as new types are added. Split the enum values up into groups and use some simple sorting within groups (scalar enums are sorted by size, then base, all other groups are generally sorted alphabetically). No functional change. Notes: svn path=/head/; revision=331716
* Rename ClouduABIFDSFlags to CloudABIFDSFlags.John Baldwin2018-03-292-3/+3
| | | | Notes: svn path=/head/; revision=331715
* Implement getrandom(2) and getentropy(3)Conrad Meyer2018-03-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The general idea here is to provide userspace programs with well-defined sources of entropy, in a fashion that doesn't require opening a new file descriptor (ulimits) or accessing paths (/dev/urandom may be restricted by chroot or capsicum). getrandom(2) is the more general API, and comes from the Linux world. Since our urandom and random devices are identical, the GRND_RANDOM flag is ignored. getentropy(3) is added as a compatibility shim for the OpenBSD API. truss(1) support is included. Tests for both system calls are provided. Coverage is believed to be at least as comprehensive as LTP getrandom(2) test coverage. Additionally, instructions for running the LTP tests directly against FreeBSD are provided in the "Test Plan" section of the Differential revision linked below. (They pass, of course.) PR: 194204 Reported by: David CARLIER <david.carlier AT hardenedbsd.org> Discussed with: cperciva, delphij, jhb, markj Relnotes: maybe Differential Revision: https://reviews.freebsd.org/D14500 Notes: svn path=/head/; revision=331279
* Add missing assignment to make sure non-first cmsgs are handled as such.Michael Tuexen2018-01-171-0/+1
| | | | Notes: svn path=/head/; revision=328081
* Improve the printing of cmgs when the length is 0. Fix error handling.Michael Tuexen2018-01-161-0/+5
| | | | Notes: svn path=/head/; revision=328059
* Using %p already prints "0x", so don't do it explicitly.Michael Tuexen2018-01-161-6/+6
| | | | Notes: svn path=/head/; revision=328058
* Rename 'recv' to 'receive' to appease shadow warnings from GCC.John Baldwin2018-01-161-8/+8
| | | | Notes: svn path=/head/; revision=328037
* Keep list sorted. Thanks to jhb@ to pointing out that I put it at theMichael Tuexen2018-01-151-2/+2
| | | | | | | wrong place in r327919. Notes: svn path=/head/; revision=328034
* Decode msghdr argument of sendmsg() and recvmsg().Michael Tuexen2018-01-152-130/+397
| | | | | | | Sponsored by: Netflix, Inc. Notes: svn path=/head/; revision=328015
* Improve support for sctp_generic_recvmsg() and sctp_generic_sendmsg()Michael Tuexen2018-01-142-6/+38
| | | | | | | | | | and add support for sctp_generic_sendmsg_iov(). Handle the struct iovec argument and the struct sctp_sndrcvinfo arguments. Notes: svn path=/head/; revision=327967
* Mark the iovec parameters of writev() and readv() as IN and OUT.Michael Tuexen2018-01-141-2/+2
| | | | | | | This makes truss work on readv() as expected. Notes: svn path=/head/; revision=327961
* Fix a typo introduced in r327919.Michael Tuexen2018-01-131-1/+1
| | | | Notes: svn path=/head/; revision=327921
* Add support for readv() and writev() to truss.Michael Tuexen2018-01-132-1/+67
| | | | | | | Sponsored by: Netflix, Inc. Notes: svn path=/head/; revision=327919
* Make truss work for CloudABI executables on i386.Ed Schouten2017-12-212-0/+99
| | | | | | | | | | | The system call convention is different from i386 binaries running on FreeBSD/amd64, but this is not noticeable by executables. On FreeBSD/amd64, the vDSO already does padding of arguments and return values to 64-bit values. On i386, it does not, meaning that system call return values are simply stored in registers. Notes: svn path=/head/; revision=327057
* Make truss(8) work for 32-bit CloudABI executables on ARM64.Ed Schouten2017-12-202-0/+113
| | | | | | | | This change effectively merges the existing 64-bit support for ARM64 with the 32-on-64-bit support for AMD64. Notes: svn path=/head/; revision=327022
* Make truss(8) work for i686-unknown-cloudabi binaries on FreeBSD/amd64.Ed Schouten2017-12-162-0/+113
| | | | | | | | | | | | | | | | | This change copies the existing amd64_cloudabi64.c to amd64_cloudabi32.c and reimplements the functions for fetching system call arguments and return values to use the same scheme as used by the vDSO that is used when running cloudabi32 executables. As arguments are automatically padded to 64-bit words by the vDSO in userspace, we can copy the arguments directly into the array used by truss(8) internally. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D13516 Notes: svn path=/head/; revision=326911
* Replace a reference to a license in another file with the license text.John Baldwin2017-11-291-5/+35
| | | | | | | | The relevant file was recently renamed, so the reference was stale. In addition, explicit licenses are more typical in our sources. Notes: svn path=/head/; revision=326356
* various: general adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-1/+3
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified 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. No functional change intended. Notes: svn path=/head/; revision=326276
* Decode kevent structures logged via ktrace(2) in kdump.John Baldwin2017-11-252-76/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add a new KTR_STRUCT_ARRAY ktrace record type which dumps an array of structures. The structure name in the record payload is preceded by a size_t containing the size of the individual structures. Use this to replace the previous code that dumped the kevent arrays dumped for kevent(). kdump is now able to decode the kevent structures rather than dumping their contents via a hexdump. One change from before is that the 'changes' and 'events' arrays are not marked with separate 'read' and 'write' annotations in kdump output. Instead, the first array is the 'changes' array, and the second array (only present if kevent doesn't fail with an error) is the 'events' array. For kevent(), empty arrays are denoted by an entry with an array containing zero entries rather than no record. - Move kevent decoding tables from truss to libsysdecode. This adds three new functions to decode members of struct kevent: sysdecode_kevent_filter, sysdecode_kevent_flags, and sysdecode_kevent_fflags. kdump uses these helper functions to pretty-print kevent fields. - Move structure definitions for freebsd11 and freebsd32 kevent structures to <sys/event.h> so that they can be shared with userland. The 32-bit structures are only exposed if _WANT_KEVENT32 is defined. The freebsd11 structures are only exposed if _WANT_FREEBSD11_KEVENT is defined. The 32-bit freebsd11 structure requires both. - Decode freebsd11 kevent structures in truss for the compat11.kevent() system call. - Log 32-bit kevent structures via ktrace for 32-bit compat kevent() system calls. - While here, constify the 'void *data' argument to ktrstruct(). Reviewed by: kib (earlier version) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D12470 Notes: svn path=/head/; revision=326184
* spdx: initial adoption of licensing ID tags.Pedro F. Giffuni2017-11-1813-11/+37
| | | | | | | | | | | | | | | | | | | | 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. Initially, only tag files that use BSD 4-Clause "Original" license. RelNotes: yes Differential Revision: https://reviews.freebsd.org/D13133 Notes: svn path=/head/; revision=325966
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* Import the latest CloudABI definitions, version 0.16.Ed Schouten2017-10-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The most important change in this release is the removal of the poll_fd() system call; CloudABI's equivalent of kevent(). Though I think that kqueue is a lot saner than many of its alternatives, our experience is that emulating this system call on other systems accurately isn't easy. It has become a complex API, even though I'm not convinced this complexity is needed. This is why we've decided to take a different approach, by looking one layer up. We're currently adding an event loop to CloudABI's C library that is API compatible with libuv (except when incompatible with Capsicum). Initially, this event loop will be built on top of plain inefficient poll() calls. Only after this is finished, we'll work our way backwards and design a new set of system calls to optimize it. Interesting challenges will include integrating asynchronous I/O into such a system call API. libuv currently doesn't aio(4) on Linux/BSD, due to it being unreliable and having undesired semantics. Obtained from: https://github.com/NuxiNL/cloudabi Notes: svn path=/head/; revision=324727
* truss: mention 'H' in usageEd Maste2017-10-131-2/+2
| | | | | | | | | | | | r295930 introduced the 'H' option to display thread IDs, but did not add the option to usage(). PR: 222837 Submitted by: Oliver Kiddle <okiddle@yahoo.co.uk> MFC after: 1 week Notes: svn path=/head/; revision=324594
* Merge pipes and socket pairs.Ed Schouten2017-09-051-4/+3
| | | | | | | | | | | | | | | Now that CloudABI's sockets API has been changed to be addressless and only connected socket instances are used (e.g., socket pairs), they have become fairly similar to pipes. The only differences on CloudABI is that socket pairs additionally support shutdown(), send() and recv(). To simplify the ABI, we've therefore decided to remove pipes as a separate file descriptor type and just let pipe() return a socket pair of type SOCK_STREAM. S_ISFIFO() and S_ISSOCK() are now defined identically. Notes: svn path=/head/; revision=323177
* Decode pathconf() names, *at() flags, and sysarch() numbers in libsysdecode.John Baldwin2017-09-041-33/+4
| | | | | | | | | | Move tables that were previously in truss over to libsysdecode. truss output is unchanged, but kdump has been updated to decode these fields. In addition, sysdecode_sysarch_number() should support all platforms whereas the old table in truss only supported x86. Notes: svn path=/head/; revision=323151
* Decode signal information returned by system calls.John Baldwin2017-08-304-5/+31
| | | | | | | | | Specifically, decode the siginfo structure returned by sigtimedwait(), sigwaitinfo(), and wait6(). While here, also decode the signal number returned in the second argument to sigwait(). Notes: svn path=/head/; revision=323021
* Trim stale prototype for ioctlname().John Baldwin2017-08-301-1/+0
| | | | Notes: svn path=/head/; revision=323020