aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
Commit message (Collapse)AuthorAgeFilesLines
...
* | | last: Mild style cleanupDag-Erling Smørgrav2025-08-121-15/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Prefer explicit NULL comparisons to using pointers as booleans * Prefer explicit 0 comparisons to using strcmp() as a predicate * Avoid use of strcpy() Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D51876
* | | sockstat: fix port parsing after libxo integrationAlan Somers2025-08-126-54/+326
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | parse_ports has been broken ever since 7b35b4d, and it's a sufficiently complicated function that it really deserves some unit tests. Fix it, and add tests. Refactor the code a little bit to facilitate unit tests. Chiefly, split the tested functions out of main.c into sockstat.c . PR: 288731 Fixes: 7b35b4d ("sockstat: add libxo support") Sponsored by: ConnectWise PR: https://github.com/freebsd/freebsd-src/pull/1807 Reviewed by: rido
* | | sockstat: rename sockstat.c to main.cAlan Somers2025-08-122-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | In preparation for splitting the file up. This commit is a clean rename, so git's rename detection will work. Sponsored by: ConnectWise PR: https://github.com/freebsd/freebsd-src/pull/1807
* | | sockstat: complete libxo integration and improve formattingDamin Rido2025-08-121-70/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed missing field names in xo_emit() calls for xolint compliance, treated XO_STYLE_HTML like XO_STYLE_TEXT to apply space-padded formatting for human-readable output, and updated usage() to indicate that --libxo accepts arguments. Reported by: Phil Shafer <phil@juniper.net> Sponsored by: Google, LLC (GSoC 2025) MFC after: 2 weeks Pull Request: https://github.com/freebsd/freebsd-src/pull/1806 Reviewed by: asomers
* | | lsvfs(1): Make slight refactorFaraz Vahedi2025-08-111-10/+8
| | | | | | | | | | | | | | | | | | | | | Signed-off-by: Faraz Vahedi <kfv@kfv.io> Reviewed by: markj, asomers (both earlier version) Pull Request: https://github.com/freebsd/freebsd-src/pull/1498
* | | top: improve sort field storage/lookupKyle Evans2025-08-095-71/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Switch up comparator mapping to avoid these kinds of errors, use a simple array of (name, comparator) pairs rather than having to maintain entries in two separate arrays that must have matching indices. Reviewed by: obiwac MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D37083
* | | sockstat: revert incorrect use of path-state for SCTP connectionsDamin Rido2025-08-081-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revert a change that mistakenly used SCTP path state and the field name `path-state` instead of the correct `conn-state` and `sctp_conn_state()` call. This was introduced in 7b35b4d during the addition of libxo support. Fixes: 7b35b4d ("sockstat: add libxo support") Reported by: Phil Shafer <phil@juniper.net> Sponsored by: Google, LLC (GSoC 2025) Pull Request: https://github.com/freebsd/freebsd-src/pull Reviewed by: asomers
* | | grep: toss in some explicit fflush()Kyle Evans2025-08-081-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | grep|tee of the src/ tree for infrequently-occurring strings is fairly annoying; drop some tactical flushes at line-match boundaries to reduce the long stalls. In the case of `grep -o`, we'll flush after multiple lines if there are multiple matches within a single line of text, while for non`-o` we'll flush generally after every line.
* | | indent: Fix buffer overflowDag-Erling Smørgrav2025-08-072-23/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function used to create a backup of the input before starting work used a static buffer and did not check that the file name it constructed did not overflow. Switch to using asprintf(), clean up the rest of the function, and update some comments that still referred to an earlier version of the code. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: bnovkov Differential Revision: https://reviews.freebsd.org/D51796
* | | indent: Simplify test scriptDag-Erling Smørgrav2025-08-071-40/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Much of the test script was concerned with working around RCS tags and dealing with cases which don't apply to indent. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D51795
* | | find: Fix -printfDag-Erling Smørgrav2025-08-073-62/+223
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Each -printf invocation created a memstream, then freed the underlying buffer without closing the stream, resulting in a segfault on exit when libc tried to flush all the streams. Drop the memstream, which isn't really needed. Furthermore: * Change escape() to return char * instead of const char * * Simplify the implementation of %h * Fix %M, which printed an extra space * Implement %l correctly * Implement %Y and %y * Add tests for everything except %S Fixes: 7b9c912c41f4 Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D51776
* | | tail: Fix -b, -c, -n optionsDag-Erling Smørgrav2025-08-062-5/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Switching from strtoll() to expand_number() was improper at the time as it only accepted positive numbers. Now that it also accepts negative numbers, the -b option is still broken because the same commit that switched to expand_number() also dropped the multiplication by units. Fixes: 643ac419fafb Reviewed by: delphij Differential Revision: https://reviews.freebsd.org/D51757
* | | Merge bmake-20250804Simon J. Gerraty2025-08-053-3/+8
|\| | | | | | | | | | | | | | | | | Fixes bug in meta mode output capture. Merge commit '787302bde4d89279180303b753eb73b9bc6820b9'
* | | id: revert to historical and documented behavior for `id`Kyle Evans2025-08-041-16/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The manpage claims that we display the credentials for the calling process if no user/flags are specified, but this has not been true since r145628 / 68b9b81e792a9108d. Currently, we display: - uid from the calling process - gid from /etc/passwd - egid from the calling process, if different from that gid - supplementary groups from the calling process This doesn't really match the description in the manpage, and it doesn't match other implementations. Fix it to use the current process credentials for the gid as well. Drop the extra arguments to id_print(), since these facts can be derived from whether we're displaying live data (`pw == NULL`) or not. Reviewed by: olce Differential Revision: https://reviews.freebsd.org/D51689
* | | sockstat: add libxo supportDamin Rido2025-07-303-180/+306
| | | | | | | | | | | | | | | | | | | | | | | | Sponsored by: Google, LLC (GSoC 2025) MFC after: 2 weeks Reviewed by: asomers Pull Request: https://github.com/freebsd/freebsd-src/pull/1770 Relnotes: yes
* | | find: Put back clearing the NOSTAT bitWarner Losh2025-07-301-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In fd186cd16eaf I read the condition backwards. We want to stat all the time until we can implement something to do it more inteligently as Jiles suggested in the review. Fixes: fd186cd16eaf Noticed by: des Sponsored by: Netflix
* | | Move toolchain utils to -toolchain packageLexi Winter2025-07-286-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move LLVM ar, nm, and size. Also move elftoolchain strings, which should have already been there. The remaining LLVM utilities (including strings) stay in -clang for now since they're links to other executables. Reviewed by: des, dim Differential Revision: https://reviews.freebsd.org/D51583
* | | bmake: Add a package for bmake and share/mkLexi Winter2025-07-281-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bmake along with /usr/share/mk seems to meet the criteria for being in its own package: it's self-contained and the majority of users (who are using binary packages) don't need to install it, so it doesn't belong in FreeBSD-utilities. Instead, put it in its own package. Add a dependency on the new package from: - sendmail (uses make to build its configuration) - NIS (uses make to build the database). But not from examples, because while some of the examples do require make, they are intended as examples rather than something to be used directly. Reviewed by: manu, sjg Differential Revision: https://reviews.freebsd.org/D50149
* | | clang-scan-deps: Pass ${TDFILE} to tblgen, not ${.ALLSRC}Lexi Winter2025-07-281-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ${.ALLSRC} can include the dependency OptParser.td, which causes llvm-tblgen to fail since it only accepts a single input argument. Use ${TDFILE} directly instead, which matches the other invocations of tblgen in the LLVM Makefiles. Fixes: d3c06bed2c16 ("clang: install clang-scan-deps") MFC after: 3 days Reviewed by: dim Differential Revision: https://reviews.freebsd.org/D51569
* | | pom: Cache tzdata before entering capability modeEd Maste2025-07-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pom uses localtime() so needs tzdata available. PR: 278574 Reported by: Tatsuki Makino Reviewed by: ivy Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51521
* | | find: Remove duplicate caseDag-Erling Smørgrav2025-07-262-8/+0
| | | | | | | | | | | | Fixes: a52d0d76fa3e
* | | find: Document possible formatsWarner Losh2025-07-262-2/+80
| | | | | | | | | | | | | | | | | | | | | Accidentlaly committed with XXX write this. So write which formats -printf supports. Sponsored by: Netflix
* | | xargs: Convert tests to ATFDag-Erling Smørgrav2025-07-264-39/+194
| | | | | | | | | | | | | | | | | | | | | | | | Also add license and copyright statement, with permission from the original author. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D51537
* | | xargs: Limit -n to {ARG_MAX}Dag-Erling Smørgrav2025-07-264-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since it's not possible to pass more than {ARG_MAX} bytes on the command line, it's also not possible to pass more than {ARG_MAX} individual arguments. Therefore, {ARG_MAX} is a reasonable upper bound for the -n option. This resolves both the arithmetic overflow issue and the CI OOM issue, so we can safely re-enable the test. Fixes: eab91d008165 Fixes: 2682a1552724 MFC after: 1 week Reviewed by: jlduran, emaste Differential Revision: https://reviews.freebsd.org/D51536
* | | Replace last few remaining MAN[1-8] with MANDag-Erling Smørgrav2025-07-265-6/+4
| | | | | | | | | | | | | | | Reviewed by: ivy Differential Revision: https://reviews.freebsd.org/D51530
* | | find: Use formats that work on 32-bit too...Warner Losh2025-07-261-6/+6
| | | | | | | | | | | | Sponsored by: Netflix
* | | find: Fix items from the review I missed for printfWarner Losh2025-07-252-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | Minor fixes I missed in a review comment until after the commit. Pointy-hat-to: imp Fixes: 7b9c912c41f4 Sponsored by: Netflix
* | | find: implement -fprint and -fprint0Warner Losh2025-07-255-2/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement -fprint fn which will print the matching files to fn, each followed by a newline ('\n'). And -fprint0 (same, except followed by a NUL). Both of these are always true. The file is created if it does not exist, or truncated if it does. This is done first thing unconditionally, so if there's no output, the file will have zero length. Note: GNU Find appears to collect the output for -fprint* to the same file such that they don't interfere. That detail is unimplemented at present. Sponsored by: Netflix Discussed with: jilles Reviewed by: pauamma@gundo.com (man) Differential Revision: https://reviews.freebsd.org/D42667
* | | find: Add GNU find's -printfWarner Losh2025-07-257-2/+426
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implements most of gnu find's -printf predicate. However, the '#', '-', '.' and size format modifiers are unimplemented, as are %P, %H, %F, %y, and %Y formats. Follows what I think it should do based on the info page, I've not looked at the gnu find code. Sponsored by: Netflix Discussed with: des, jilles Reviewed by: pauamma@gundo.com (man) Differential Revision: https://reviews.freebsd.org/D38138
* | | pom.6: add a more complete bibliographyLexi Winter2025-07-241-2/+8
| | | | | | | | | | | | | | | Source: Wikipedia <https://en.wikipedia.org/wiki/Practical_Astronomy_with_Your_Calculator>
* | | top.1: Fix incorrect default value for -s optionArtem Bunichev2025-07-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The default delay between screen updates was incorrectly transfered from roff(7) register that was used in previous version of man page. Reviewed by: ziaee Fixes: 9d6cce02a78c (initial pass to freebsdize) Differential Revision: https://reviews.freebsd.org/D51503
* | | asa.1: Drop SEE ALSO reference to long-gone f77(1)Ed Maste2025-07-241-2/+0
| | | | | | | | | | | | Sponsored by: The FreeBSD Foundation
* | | man.sh: avoid endless loopWolfram Schneider2025-07-211-2/+11
| | | | | | | | | | | | | | | | | | | | | limit the number of .so includes to a value of 32 instead of infinity. PR: 287037 Differential Revision: https://reviews.freebsd.org/D51412
* | | committers-src: add myself (obiwac@)Aymeric Wibo2025-07-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add obiwac@ (myself) as new src committer with mckusick@ and jrm@ as mentors. Reviewed by: mckusick (mentor), jrm (mentor) Approved by: mckusick (mentor), jrm (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51428
* | | Merge bmake-20250707Simon J. Gerraty2025-07-192-4/+5
|\| | | | | | | | | | | Merge commit '3d772e596c1acf76f555c1f51fd8d834e56b0c35'
* | | manpages: prefer linking to xo_options.7 over xo_parse_args.3Alan Somers2025-07-169-26/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most libxo-enabled utilities link to xo_parse_args.3. But that man page doesn't actually describe how to format command-line arguments. Rather, xo_options.7 does. I suspect that these utilities link to the former because the latter man page did not exist until libxo-0.7.2 (8a6eceff3ce). And newer utilities have probably been copy/pasting the same text from older ones. But the superior man page does exist now, so we should link to it instead. MFC after: 2 weeks Sponsored by: ConnectWise Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D51354
* | | sockstat: Reintroduce -w flag with altered behaviorDamin Rido2025-07-152-38/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The -w flag was previously removed when automatic column sizing was introduced. Originally, -w enabled wider output, but used hardcoded column widths that did not guarantee alignment with actual content. This commit reintroduces the -w flag with a new purpose: to dynamically size columns based on the longest entry in the current output. Unlike the original behavior, this version ensures fully aligned and consistently formatted rows. By default, sockstat now uses fixed-width columns for more compact output, especially in 80-column terminals. Users who prefer a full-width view can now use -w to enable automatic column sizing. Sponsored by: Google, LLC (GSoC 2025) MFC after: 2 weeks Pull Request: https://github.com/freebsd/freebsd-src/pull/1746 Reviewed by: asomers, glebius
* | | top.1: Document the THR columnAlexander Ziaee2025-07-151-1/+2
| | | | | | | | | | | | | | | | | | | | | MFC after: 3 days Fixes: 32efd26355e2 (Add a THR column) Reviewed by: bcr Differential Revision: https://reviews.freebsd.org/D50754
* | | sed.1: Adjust examples to fit in one line + SPDXAlexander Ziaee2025-07-151-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Examples were previously overflowing at MANWIDTH 80. Keep the same complexity but use shorter phrases to make them easier to read. Tag SPDX while here. MFC after: 3 days Reviewed by: bcr Discussed with: emaste Differential Revision: https://reviews.freebsd.org/D50867
* | | find.1: Correct HISTORY grammar typoJeffrey R. Day2025-07-141-1/+1
| | | | | | | | | | | | | | | | | | PR: 286292 MFC after: 3 days Reviewed by: ziaee
* | | fortune: Fix typo in dmesgd.nycbug.org exampleChristos Margiolis2025-07-131-1/+1
| | | | | | | | | | | | | | | | | | | | | No functional change, but commit for correctness nonetheless. MFC after: 1 day Differential Revision: https://reviews.freebsd.org/D51293
* | | netstat.1: Add common example to list listening socketsLukas Engelhardt2025-07-131-14/+16
| | | | | | | | | | | | | | | | | | | | | While here, wrap to 80 characters. Approved by: ziaee Differential Revision: https://reviews.freebsd.org/D51280
* | | cross-build: fix after the recent sqlite3 importKonstantin Belousov2025-07-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Stop adding contrib/sqlite3 into the include path for usr.bin/kyua, take headers from the install sysroot env. sqilte3 now has the VERSION file, which clashes with c++ include <version>. Submitted by: jrtc27 (see https://reviews.freebsd.org/D51217) Tested by: kib Fixes: 17f0f75308f2 ("sqlite3: Vendor import of sqlite3 3.50.2")
* | | shar: remove from the tree well in advance of the 15.0 releaseKyle Evans2025-07-105-214/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have had deprecation notice in the manpage for nearly six months, and it is also present both in 13.5 and 14.3. tar(1) can supply this functionality for those that truly need it, and cy@ has also created a sysutils/freebsd-shar port for this version of a frontend to live on in ports -- this port has been available since December 18, 2024. Reviewed by: allanjude, cy, emaste, jrm Differential Revision: https://reviews.freebsd.org/D50925
* | | lockf: minor cosmetic cleanups, no functional changeKyle Evans2025-07-101-20/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Switch various flags from int -> bool. kill(getpid(), foo) and raise(foo) are equivalent in this context, so switch to the latter as a minor preference for readability. Use proper signal fences instead of volatile for our SIGALRM handler. Reviewed by: kib (earlier version), des Differential Revision: https://reviews.freebsd.org/D51027
* | | lockf: tests: add tests for the -p and -T featuresKyle Evans2025-07-101-0/+95
| | | | | | | | | | | | | | | Reviewed by: des Differential Revision: https://reviews.freebsd.org/D51026
* | | lockf: add a -T option to terminate the child upon early abortKyle Evans2025-07-102-2/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is useful to avoid having the command running twice in the face of the admin terminating the process. Notably, if the -p option is not in use (or can't be used, e.g., because we can't open the file for writing) then this provides a nice alternative where one simply needs to send a SIGTERM to the lockf(1) process associated with the lock file to clean it all up. Reviewed by: des Differential Revision: https://reviews.freebsd.org/D51025
* | | lockf: switch to a SIGCHLD model for reaping childKyle Evans2025-07-102-5/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A future change will add a -T flag to forward SIGTERM along to the child before we cleanup and terminate ourselves. Using a SIGCHLD handler to do that with SIGTERM blocked only while the child is actively being collected will enable us to safely do so without having to worry that our pid is potentially invalid. Add a test that concisely checks that the child's error is properly bubbled up to the caller. Reviewed by: des, kib Differential Revision: https://reviews.freebsd.org/D51024
* | | lockf: add a -p mode to write the child's pidKyle Evans2025-07-102-5/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | If we're going to hold the lock, it can be useful to scribble down the pid that we spawned off to quickly associate the lock back to the process that's keeping it open. Reviewed by: allanjude (previous version), des Differential Revision: https://reviews.freebsd.org/D51014
* | | truncate.1: Polish title and examplesAlexander Ziaee2025-07-091-13/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + describe better + switch examples to human readable sizes, with consistent spacing + `Downsize ... in 5 Megabytes` >> `Downsize ... by 5 Megabytes` + remove prompt from lone example with prompt for consistency + remove x permissions from kernel example + examples now fit on standard console without wrapping While here: + fold a line to eliminate linter warning + tag spdx + add -nosplit to AUTHORS to eliminate a rendering glitch MFC after: 3 days Discussed with: asomers, jhb, maxim Reviewed by: imp (previous version) Closes: https://github.com/freebsd/freebsd-src/pull/1568