aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/truss
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Complete the CloudABI networking refactoring.Ed Schouten2017-08-301-49/+0
| | | | | | | | | | | | | | Now that all of the packaged software has been adjusted to either use Flower (https://github.com/NuxiNL/flower) for making incoming/outgoing network connections or can have connections injected, there is no longer need to keep accept() around. It is now a lot easier to write networked services that are address family independent, dual-stack, testable, etc. Remove all of the bits related to accept(), but also to getsockopt(SO_ACCEPTCONN). Notes: svn path=/head/; revision=323015
* Decode extra signal information for caught signals.John Baldwin2017-08-281-3/+61
| | | | | | | | | Decode fields from the siginfo_t stored in the PT_LWPINFO structure when a signal is caught by a traced process. This includes the signal code (si_code) as well as additional members such as si_addr, si_pid, etc. Notes: svn path=/head/; revision=322959
* Decode arguments passed to thr_set_name().John Baldwin2017-08-251-0/+2
| | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=322899
* Sync CloudABI compatibility against the latest upstream version (v0.13).Ed Schouten2017-08-251-6/+0
| | | | | | | | | | | | | | | | | | | With Flower (CloudABI's network connection daemon) becoming more complete, there is no longer any need for creating any unconnected sockets. Socket pairs in combination with file descriptor passing is all that is necessary, as that is what is used by Flower to pass network connections from the public internet to listening processes. Remove all of the kernel bits that were used to implement socket(), listen(), bindat() and connectat(). In principle, accept() and SO_ACCEPTCONN may also be removed, but there are still some consumers left. Obtained from: https://github.com/NuxiNL/cloudabi MFC after: 1 month Notes: svn path=/head/; revision=322885
* Upgrade to the latest sources generated from the CloudABI specification.Ed Schouten2017-07-261-15/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The CloudABI specification has had some minor changes over the last half year. No substantial features have been added, but some features that are deemed unnecessary in retrospect have been removed: - mlock()/munlock(): These calls tend to be used for two different purposes: real-time support and handling of sensitive (cryptographic) material that shouldn't end up in swap. The former use case is out of scope for CloudABI. The latter may also be handled by encrypting swap. Removing this has the advantage that we no longer need to worry about having resource limits put in place. - SOCK_SEQPACKET: Support for SOCK_SEQPACKET is rather inconsistent across various operating systems. Some operating systems supported by CloudABI (e.g., macOS) don't support it at all. Considering that they are rarely used, remove support for the time being. - getsockname(), getpeername(), etc.: A shortcoming of the sockets API is that it doesn't allow you to create socket(pair)s, having fake socket addresses associated with them. This makes it harder to test applications or transparently forward (proxy) connections to them. With CloudABI, we're slowly moving networking connectivity into a separate daemon called Flower. In addition to passing around socket file descriptors, this daemon provides address information in the form of arbitrary string labels. There is thus no longer any need for requesting socket address information from the kernel itself. This change also updates consumers of the generated code accordingly. Even though system calls end up getting renumbered, this won't cause any problems in practice. CloudABI programs always call into the kernel through a kernel-supplied vDSO that has the numbers updated as well. Obtained from: https://github.com/NuxiNL/cloudabi Notes: svn path=/head/; revision=321514
* Make truss(1) cross-reference dtrace(1) and bump .Dd.Edward Tomasz Napierala2017-07-211-1/+2
| | | | | | | | MFC after: 2 weeks Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=321329
* Use more usual formatting for the EXAMPLES section of truss(1).Edward Tomasz Napierala2017-07-211-3/+5
| | | | | | | | MFC after: 2 weeks Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=321328
* Decode FreeBSD11 fstatat calls.Mark Johnston2017-07-191-0/+3
| | | | Notes: svn path=/head/; revision=321258
* Sort the compat11.* syscalls I added. Remove duplicate compat11.stat.Warner Losh2017-06-261-8/+6
| | | | | | | Submitted by: jhb@ Notes: svn path=/head/; revision=320389
* Decode FreeBSD 11 compat stat, fstat and lstat calls.Warner Losh2017-06-232-1/+28
| | | | Notes: svn path=/head/; revision=320279
* Add abstime kqueue(2) timers and expand struct kevent members.Konstantin Belousov2017-06-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This change implements NOTE_ABSTIME flag for EVFILT_TIMER, which specifies that the data field contains absolute time to fire the event. To make this useful, data member of the struct kevent must be extended to 64bit. Using the opportunity, I also added ext members. This changes struct kevent almost to Apple struct kevent64, except I did not changed type of ident and udata, the later would cause serious API incompatibilities. The type of ident was kept uintptr_t since EVFILT_AIO returns a pointer in this field, and e.g. CHERI is sensitive to the type (discussed with brooks, jhb). Unlike Apple kevent64, symbol versioning allows us to claim ABI compatibility and still name the new syscall kevent(2). Compat shims are provided for both host native and compat32. Requested by: bapt Reviewed by: bapt, brooks, ngie (previous version) Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D11025 Notes: svn path=/head/; revision=320043
* Decode arguments to sched_* family of system calls.John Baldwin2017-06-162-1/+30
| | | | | | | | | | This includes decoding both scheduler policy constants and the sched_param structure for sched_get_priority_max(), sched_get_priority_min(), sched_getparam(), sched_getscheduler(), sched_rr_get_interval(), sched_setparam(), and sched_setscheduler(). Notes: svn path=/head/; revision=320010
* Decode arguments to rtprio() and rtprio_thread().John Baldwin2017-06-102-1/+9
| | | | Notes: svn path=/head/; revision=319768
* Decode the 'howto' argument to reboot().John Baldwin2017-06-102-1/+6
| | | | Notes: svn path=/head/; revision=319766
* Decode the arguments to quotactl().John Baldwin2017-06-102-1/+7
| | | | Notes: svn path=/head/; revision=319764
* Decode the arguments to ptrace().John Baldwin2017-06-102-0/+7
| | | | | | | This does not decode structures returned by ptrace(). Notes: svn path=/head/; revision=319763
* Decode arguments to getpriority() and setpriority().John Baldwin2017-06-102-1/+8
| | | | Notes: svn path=/head/; revision=319762
* Decode arguments passed to msync().John Baldwin2017-06-082-1/+6
| | | | Notes: svn path=/head/; revision=319689