aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/truss
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Decode flags passed to mount(), nmount(), and unmount().John Baldwin2017-06-082-3/+8
| | | | Notes: svn path=/head/; revision=319688
* Decode arguments to mlock(), mlockall(), and munlock().John Baldwin2017-06-082-1/+10
| | | | Notes: svn path=/head/; revision=319681
* Decode arguments to minherit().John Baldwin2017-06-082-1/+7
| | | | Notes: svn path=/head/; revision=319680
* Decode arguments passed to extended attribute related system calls.John Baldwin2017-06-082-0/+41
| | | | | | | | | The cmd argument passed to extattrctl() is not decoded as a string constant but is just printed in hex. The value is filesystem-specific but in practice is only used with UFS1 filesystems. Notes: svn path=/head/; revision=319679
* Decode arguments to ACL related system calls.John Baldwin2017-06-082-1/+28
| | | | | | | | This only decodes the raw arguments but not the contents of the struct acl objects. Notes: svn path=/head/; revision=319677
* Decode arguments to dup, dup2, getdirentries, pread, and pwrite.John Baldwin2017-06-052-1/+24
| | | | | | | | | | | | | | | | - dup and dup2 print fd arguments in decimal. - pread and pwrite are similar to read and write with the addition of the file offset. - getdirentries displays the output entries as a string for now and also prints the value returned in *basep. Eventually the buffer for getdirentries should perhaps be decoded as an array of dirent structures. PR: 214885 Submitted by: Jonathan de Boyne Pollard <J.deBoynePollard-newsgroups@NTLWorld.COM> Notes: svn path=/head/; revision=319595
* Decode the 'who' argument passed to getrusage().John Baldwin2017-06-032-3/+6
| | | | | | | | | | | | | Add a new sysdecode_getrusage_who() which decodes the RUSAGE_* constant passed as the first argument to getrusage(). Use this function in both kdump and truss to decode the first argument to getrusage(). PR: 215448 Submitted by: Anton Yuzhaninov <citrin+pr@citrin.ru> MFC after: 1 month Notes: svn path=/head/; revision=319520
* Decode the argument passed to cap_getmode().John Baldwin2017-06-022-1/+13
| | | | | | | The returned integer value is output. Notes: svn path=/head/; revision=319509
* Decode the arguments passed to __cap_rights_get() and cap_rights_limit().John Baldwin2017-06-022-1/+19
| | | | | | | Submitted by: tobik Notes: svn path=/head/; revision=319493
* Improve the decoding of the third argument of the socket() call.Michael Tuexen2017-05-251-2/+9
| | | | | | | | | | Decoding of the third argument depends on the first one. For doing this, add a corresponding function to libsysdecode. Thanks to jhb@ for suggesting this. Notes: svn path=/head/; revision=318879
* Add support for sctp_generic_sendmsg() and sctp_generic_recvmsg().Michael Tuexen2017-05-031-0/+8
| | | | Notes: svn path=/head/; revision=317750
* Add support for sendmsg() and recvmsg().Michael Tuexen2017-05-031-0/+4
| | | | Notes: svn path=/head/; revision=317739
* Decode the fourth argument of sendto and recvfrom call.Michael Tuexen2017-05-032-5/+10
| | | | Notes: svn path=/head/; revision=317737
* Add support for [gs]etsockopt().Michael Tuexen2017-05-032-1/+26
| | | | Notes: svn path=/head/; revision=317736
* Decode the third argument of socket().Michael Tuexen2017-05-032-2/+13
| | | | Notes: svn path=/head/; revision=317732
* Add Socklent for handling args of type socklen_t.Michael Tuexen2017-05-032-4/+7
| | | | Notes: svn path=/head/; revision=317731
* Add support for listen() call.Michael Tuexen2017-05-031-1/+3
| | | | Notes: svn path=/head/; revision=317730
* Improve decoding of last arguments to ioctl() and sendto().John Baldwin2017-03-191-2/+2
| | | | | | | | | | | Decode the last argument to ioctl() as a pointer rather than an int. Eventually this could use 'int' for the _IOWINT() case and pointers for all others. The last argument to sendto() is a socklen_t value, not a pointer. Notes: svn path=/head/; revision=315525
* Decode arguments to madvise().John Baldwin2017-03-192-1/+6
| | | | Notes: svn path=/head/; revision=315524
* Add a Sizet type for 'size_t' values and use it instead of Int.John Baldwin2017-03-192-11/+14
| | | | | | | | Various size_t arguments were previously decoded as Int values instead which would have truncated values above 2^31 on 64-bit systems. Notes: svn path=/head/; revision=315523
* Decode arguments passed to kldsym() and kldunloadf().John Baldwin2017-03-182-1/+13
| | | | | | | | This does not currently decode the kld_sym_lookup structure passed to kldsym(). Notes: svn path=/head/; revision=315509
* Decode arguments passed to getfsstat().John Baldwin2017-03-182-1/+7
| | | | | | | | Note that this does not yet decode the statfs structures returned by getfsstat(). Notes: svn path=/head/; revision=315504
* Decode flock() operation.John Baldwin2017-03-182-1/+6
| | | | Notes: svn path=/head/; revision=315502
* Decode file flags passed to *chflags*().John Baldwin2017-03-182-3/+17
| | | | | | | While here, decode arguments passed to fchflags() and chflagsat(). Notes: svn path=/head/; revision=315500
* Decode arguments passed to posix_fadvise().John Baldwin2017-03-182-1/+7
| | | | Notes: svn path=/head/; revision=315497
* Decode the arguments passed to cap_fcntls_get() and cap_fcntls_limit().John Baldwin2017-03-182-0/+31
| | | | Notes: svn path=/head/; revision=315496
* Automate the handling of QUAD_ALIGN and QUAD_SLOTS.John Baldwin2017-03-151-28/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the offset in a system call description specified the array index of the start of a system call argument. For most system call arguments this was the same as the index of the argument in the function signature. 64-bit arguments (off_t and id_t values) passed on 32-bit platforms use two slots in the array however. This was handled by adding (QUAD_SLOTS - 1) to the slot indicies of any subsequent arguments after a 64-bit argument (though written as ("{ Quad, 1 }, { Int, 1 + QUAD_SLOTS }" rather than "{ Quad, 1 }, { Int, 2 + QUAD_SLOTS - 1 }"). If a system call contained multiple 64-bit arguments (such as posix_fadvise()), then additional arguments would need to use 'QUAD_SLOTS * 2' but remember to subtract 2 from the initial number, etc. In addition, 32-bit powerpc requires 64-bit arguments to be 64-bit aligned, so if the effective index in the array of a 64-bit argument is odd, it needs QUAD_ALIGN added to the current and any subsequent slots. However, if the effective index in the array of a 64-bit argument was even, QUAD_ALIGN was omitted. This approach was messy and error prone. This commit replaces it with automated pre-processing of the system call table to do fixups for 64-bit argument offsets. The offset in a system call description now indicates the index of an argument in the associated function call's signature. A fixup function is run against each decoded system call description during startup on 32-bit platforms. The fixup function maintains an 'offset' value which holds an offset to be added to each remaining system call argument's index. Initially offset is 0. When a 64-bit system call argument is encountered, the offset is first aligned to a 64-bit boundary (only on powerpc) and then incremented to account for the second argument slot used by the argument. This modified 'offset' is then applied to any remaining arguments. This approach does require a few things that were not previously required: 1) Each system call description must now list arguments in ascending order (existing ones all do) without using duplicate slots in the register array. A new assert() should catch any future descriptions which violate this rule. 2) A system call description is still permitted to omit arguments (though none currently do), but if the call accepts 64-bit arguments those cannot be omitted or incorrect results will be displated on 32-bit systems. Tested on: amd64 and i386 Notes: svn path=/head/; revision=315336
* Remove duplicate argument from linux_stat64() decoding.John Baldwin2017-03-151-2/+2
| | | | Notes: svn path=/head/; revision=315335
* Adopt SRCTOP in usr.binWarner Losh2017-03-121-2/+2
| | | | | | | | | | | | Prefer ${SRCTOP}/foo over ${.CURDIR}/../../foo and ${SRCTOP}/usr.bin/foo over ${.CURDIR}/../foo for paths in Makefiles. Differential Revision: https://reviews.freebsd.org/D9932 Sponsored by: Netflix Silence on: arch@ (twice) Notes: svn path=/head/; revision=315170
* Add RISC-V support for truss(1)Li-Wen Hsu2017-01-241-0/+106
| | | | | | | | | | While here, extract NARGREG as a definition. Reviewed by: br Differential Revision: https://reviews.freebsd.org/D9249 Notes: svn path=/head/; revision=312691
* Rework syscall structure lookups.John Baldwin2016-12-0619-46/+141
| | | | | | | | | | | | | | | | | | | | Avoid always using an O(n^2) loop over known syscall structures with strcmp() on each system call. Instead, use a per-ABI cache indexed by the system call number. The first 1024 system calls (which should cover all of the normal system calls in currently-supported ABIs) use a flat array indexed by the system call number to find system call structure. For other system calls, a linked list of structures storing an integer to structure mapping is stored in the ABI. The linked list isn't very smart, but it should only be used by buggy applications invoking unknown system calls. This also fixes handling of unknown system calls which currently trigger a NULL pointer dereference. Reviewed by: kib MFC after: 2 weeks Notes: svn path=/head/; revision=309589
* Move mksubr from kdump into libsysdecode.John Baldwin2016-10-1721-226/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Restructure this script so that it generates a header of tables instead of a source file. The tables are included in a flags.c source file which provides functions to decode various system call arguments. For functions that decode an enumeration, the function returns a pointer to a string for known values and NULL for unknown values. For functions that do more complex decoding (typically of a bitmask), the function accepts a pointer to a FILE object (open_memstream() can be used as a string builder) to which decoded values are written. If the function operates on a bitmask, the function returns true if any bits were decoded or false if the entire value was valid. Additionally, the third argument accepts a pointer to a value to which any undecoded bits are stored. This pointer can be NULL if the caller doesn't care about remaining bits. Convert kdump over to using decoder functions from libsysdecode instead of mksubr. truss also uses decoders from libsysdecode instead of private lookup tables, though lookup tables for objects not decoded by kdump remain in truss for now. Eventually most of these tables should move into libsysdecode as the automated table generation approach from mksubr is less stale than the static tables in truss. Some changes have been made to truss and kdump output: - The flags passed to open() are now properly decoded in that one of O_RDONLY, O_RDWR, O_WRONLY, or O_EXEC is always included in a decoded mask. - Optional arguments to open(), openat(), and fcntl() are only printed in kdump if they exist (e.g. the mode is only printed for open() if O_CREAT is set in the flags). - Print argument to F_GETLK/SETLK/SETLKW in kdump as a pointer, not int. - Include all procctl() commands. - Correctly decode pipe2() flags in truss by not assuming full open()-like flags with O_RDONLY, etc. - Decode file flags passed to *chflags() as file flags (UF_* and SF_*) rather than as a file mode. - Fix decoding of quotactl() commands by splitting out the two command components instead of assuming the raw command value matches the primary command component. In addition, truss and kdump now build without triggering any warnings. All of the sysdecode manpages now include the required headers in the synopsis. Reviewed by: kib (several older versions), wblock (manpages) MFC after: 2 months Differential Revision: https://reviews.freebsd.org/D7847 Notes: svn path=/head/; revision=307538