summaryrefslogtreecommitdiffstats
path: root/usr.bin
Commit message (Collapse)AuthorAgeFilesLines
...
* MFC r303540:eadler2018-03-081-1/+1
| | | | | | Use nitems() from sys/param.h Sponsored by: gandi.net (BSD Day Taiwan)
* MFC r313544:eadler2018-03-0833-0/+312
| | | | | | | | | | | | | | | | | | | indent(1): add regression test cases These examples show expected behavior of indent(1). They are meant to be used together with a regression test mechanism, either Kyua, a Makefile or perhaps something else. The mechanism should in essence do this: indent -P${test}.pro < ${test}.0 > ${test}.0.run and compare ${test}.0.stdout to ${test}.0.run. If the files differ or the exit status isn't 0, the test failed. * ${test}.pro is an indent(1) profile: a list of options passed through a file. The program doesn't complain if the file doesn't exist. * ${test}.0 is a C source file which acts as input for indent(1). It doesn't have to have any particular formatting, since it's the output that matters. * ${test}.0.stdout contains expected output. It doesn't have to be formatted in Kernel Normal Form as the point of the tests is to check for regressions in the program and not to check that it always produces KNF.
* MFC r309220:eadler2018-03-083-0/+16
| | | | | | | | | indent(1): Properly handle the wide string literal and wide char constant L. indent(1) treated the "L" in "L'a'" as if it were an identifier and forced a space character after it, breaking valid code. PR: 143090
* MFC r316339,317396,317829,326010,329554: less v530.delphij2018-03-071-1/+6
| | | | Relnotes: yes
* MFC r327117:eadler2018-03-051-0/+1
| | | | | | calendar: add missing header file time.h is required for strftime and struct tm
* MFC r326434:eadler2018-03-051-2/+2
| | | | fmt(1): Fix usage of Nm macro
* MFC r311581:eadler2018-03-051-0/+7
| | | | | | | | Capsicum: add capability mode to users binary Submitted by: Tyler Littlefield <tyler@tysdomain.com> Reviewed by: cem, oshogbo Differential Revision: https://reviews.freebsd.org/D9046
* MFC r326276:eadler2018-03-05179-46/+415
| | | | | | | | | | | | | | | | various: general adoption of SPDX licensing ID tags. 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.
* MFC r322428:eadler2018-03-031-2/+2
| | | | | | | | | | | | | Set usage() to show -d flag mkesdb supports the -d flag for enabling debug mode, as documented in the manual. PR: 209865 Submitted by: Maya Rashish <coypu AT sdf DOT org> Reviewed by: imp Approved by: bcr (mentor) Obtained from: NetBSD MFC after: 7 days Differential Revision: https://reviews.freebsd.org/D11987
* MFC r314409:eadler2018-03-032-1/+19
| | | | | | | dc(1): Introduce e command, equivalent to p, but writes to stderr Obtained from: OpenBSD MFC after: 2 weeks
* MFC r325095:eadler2018-03-037-11/+9
| | | | | | | | Update URLs in usr.bin - http -> https - contents have moved locations - removal of URL if I could not find new location
* MFC r322424:eadler2018-03-031-2/+2
| | | | | | Correct the -H longopt equivillant PR: 209876
* MFC 328134: Update various statements in vmstat(8) to match reality.jhb2018-02-271-20/+25
| | | | | | | | | | | | | | | | | | | | - The process stats are actually thread counts rather than process counts. - Simplify various descriptions to remove mention of stats that are updated every 5 seconds (all VM related stats are now "instant", only the load average is updated every 5 seconds). - Don't make any mention of special treatment for processes that have been active in the last 20 seconds. We don't track that stat. - Rework the description of active virtual memory. Call it mapped virtual memory and explicitly point out it is not the same as the active page queue (which corresponds to "Active" in top(1)), and also hint at the possible bogusness of the value (e.g. if a process maps a single page out of a multiple GB file, the entire file's size is considered mapped). - Simplify a few descriptions that implied their output was a value per interval. All of the "rate" values are per-second rates scaled across the interval. - Update a few comments for 'struct vmtotal' along similar lines.
* MFC r328995:markj2018-02-141-12/+12
| | | | | | Fix the WITH_SORT_THREADS build. PR: 201664
* MFC r312667 (by pfg):markj2018-02-141-24/+28
| | | | sort - Don't live-loop threads.
* MFC r306325, r306329-r306330, r306333, r306620-r306622, r307544, r307550, ↵manu2018-02-0946-1051/+1363
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r318137, r319125, r319295 r306325 by marcel: Replace the use of linker sets with constructors for both the formats and schemes. Formats and schemes are registered at runtime now, rather than collected at link time. r306329 by marcel: Eliminate the use of EDOOFUS. The error code was used to signal programming errors, but is really a poor substitute for assert. And less portable as well. r306330 by marcel: Avoid depending on the <sys/endian.h> header for le*enc and be*enc. Not only is the header unportable, the encoding/decoding functions are as well. Instead, duplicate the handful of small inlines we need into a private header called endian.h. Aside: an alternative approach is to move the encoding/decoding functions to a separate system header. While the header is still nonportable, such an approach would make it possible to re-use the definitions by playing games with include paths. This may be the preferred approach if more (build) utilities need this. This change does not preclude that. In fact, it makes it easier. r306333 by marcel: Portability changes: 1. macOS nor Linux have MAP_NOCORE nor MAP_NOSYNC. Define as 0. 2. macOS doesn't have SEEK_DATA nor SEEK_HOLE. Define as -1 so that lseek will return -1 (with errno set to EINVAL). 3. gcc correctly warns that error is assigned but not used in image_copyout_region(). Fix by returning on the first error. r306620 by marcel: Replace STAILQ with TAILQ. TAILQs are portable enough that they can be used on both macOS and Linux. STAILQs are not. In particular, STAILQ_LAST does not next on Linux. Since neither STAILQ_FOREACH_SAFE nor TAILQ_FOREACH_SAFE exist on Linux, replace its use with a regular TAILQ_FOREACH. The _SAFE variant was only used for having the next pointer in a local variable. r306621 by marcel: Prefer <stdint.h> over <sys/types.h>. While here remove redundant inclusion of <sys/queue.h>. Move the inclusion of the disk partitioning headers out of order and inbetween standard headers and local header. They will change in a subsequent commit. r306622 by marcel: Replace OFF_MAX with INT64_MAX. The former is defined on Linux. r307544 by marcel: o Provide a private definition for UUIDs (mkimg_uuid_t) because UUIDs are not portable. o Move mkimg_uuid() to a new file and merge both gpt_uuid_enc() and vhd_uuid_enc() into a single mkimg_uuid_enc() that lives in the same file. o Move the OS-specific implementation of generating a UUID to osdep_uuidgen() and provide the implementations for FreeBSD, macOS and Linux. o Expect the partitioning scheme headers to be found by having a search to the directory in which the headers live. This avoids conflicts on non-FreeBSD machines. r307550 by imp: Add a new flag to mkimg (-a num) to specify the active partition for those partitioning schemes that have this concept. Implement it as an override for mbr's setting 0x80 in the flags for the first partition when we have boot code. Differential Revision: https://reviews.freebsd.org/D4403 r318137: mkimg: Add -C argument to specify maximum capacity Add a -C option to specify a maximum capacity for the final image file. It is useful to control the size of the generated image for sdcard or when we will add dynamic size partition. Add --capacity which is a shorthand to define min and max capacity at the same time. Reviewed by: bapt, marcel, wblock (manpages) Sponsored by: Gandi.net Differential Revision: https://reviews.freebsd.org/D10509 r319125: mkimg: Correct an off by one error in the PMBR size The PMBR last sector should be number of sector - 1 (As stated in UEFI Spec 2.6 page 118 table 17). This fixes warning printed by linux tools like parted or fdisk. Sponsored by: Gandi.net r319295 by ngie: Update the usr.bin/mkimg golden test output files after ^/head@r319125 ^/head@r319125 changed the location of the backup pmbr, requiring the output files to be regenerated, since they're binary disk dumps. The output files were regenerated with "make rebase"--fixed in ^/head@r319294. MFC with: r319125, r319294 PR: 219673 Sponsored by: Dell EMC Isilon
* Revert r328974, r307387 was not supposed to be part of it.manu2018-02-0746-1389/+1130
|
* MFC r306325, r306329-r306330, r306333, r306620-r306622, r307387, r307544, ↵manu2018-02-0746-1130/+1389
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r307550, r318137, r319125, r319295 r306325 by marcel: Replace the use of linker sets with constructors for both the formats and schemes. Formats and schemes are registered at runtime now, rather than collected at link time. r306329 by marcel: Eliminate the use of EDOOFUS. The error code was used to signal programming errors, but is really a poor substitute for assert. And less portable as well. r306330 by marcel: Avoid depending on the <sys/endian.h> header for le*enc and be*enc. Not only is the header unportable, the encoding/decoding functions are as well. Instead, duplicate the handful of small inlines we need into a private header called endian.h. Aside: an alternative approach is to move the encoding/decoding functions to a separate system header. While the header is still nonportable, such an approach would make it possible to re-use the definitions by playing games with include paths. This may be the preferred approach if more (build) utilities need this. This change does not preclude that. In fact, it makes it easier. r306333 by marcel: Portability changes: 1. macOS nor Linux have MAP_NOCORE nor MAP_NOSYNC. Define as 0. 2. macOS doesn't have SEEK_DATA nor SEEK_HOLE. Define as -1 so that lseek will return -1 (with errno set to EINVAL). 3. gcc correctly warns that error is assigned but not used in image_copyout_region(). Fix by returning on the first error. r306620 by marcel: Replace STAILQ with TAILQ. TAILQs are portable enough that they can be used on both macOS and Linux. STAILQs are not. In particular, STAILQ_LAST does not next on Linux. Since neither STAILQ_FOREACH_SAFE nor TAILQ_FOREACH_SAFE exist on Linux, replace its use with a regular TAILQ_FOREACH. The _SAFE variant was only used for having the next pointer in a local variable. r306621 by marcel: Prefer <stdint.h> over <sys/types.h>. While here remove redundant inclusion of <sys/queue.h>. Move the inclusion of the disk partitioning headers out of order and inbetween standard headers and local header. They will change in a subsequent commit. r306622 by marcel: Replace OFF_MAX with INT64_MAX. The former is defined on Linux. r307387 by marcel: Switch to using the portable partition scheme headers. r307544 by marcel: o Provide a private definition for UUIDs (mkimg_uuid_t) because UUIDs are not portable. o Move mkimg_uuid() to a new file and merge both gpt_uuid_enc() and vhd_uuid_enc() into a single mkimg_uuid_enc() that lives in the same file. o Move the OS-specific implementation of generating a UUID to osdep_uuidgen() and provide the implementations for FreeBSD, macOS and Linux. o Expect the partitioning scheme headers to be found by having a search to the directory in which the headers live. This avoids conflicts on non-FreeBSD machines. r307550 by imp: Add a new flag to mkimg (-a num) to specify the active partition for those partitioning schemes that have this concept. Implement it as an override for mbr's setting 0x80 in the flags for the first partition when we have boot code. Differential Revision: https://reviews.freebsd.org/D4403 r318137: mkimg: Add -C argument to specify maximum capacity Add a -C option to specify a maximum capacity for the final image file. It is useful to control the size of the generated image for sdcard or when we will add dynamic size partition. Add --capacity which is a shorthand to define min and max capacity at the same time. Reviewed by: bapt, marcel, wblock (manpages) Sponsored by: Gandi.net Differential Revision: https://reviews.freebsd.org/D10509 r319125: mkimg: Correct an off by one error in the PMBR size The PMBR last sector should be number of sector - 1 (As stated in UEFI Spec 2.6 page 118 table 17). This fixes warning printed by linux tools like parted or fdisk. Sponsored by: Gandi.net r319295 by ngie: Update the usr.bin/mkimg golden test output files after ^/head@r319125 ^/head@r319125 changed the location of the backup pmbr, requiring the output files to be regenerated, since they're binary disk dumps. The output files were regenerated with "make rebase"--fixed in ^/head@r319294. MFC with: r319125, r319294 PR: 219673 Sponsored by: Dell EMC Isilon
* MFH r328332:mm2018-02-031-0/+1
| | | | | | | | | | | | | Sync libarchive with vendor. Relevant vendor changes: PR #893: delete dead ppmd7 alloc callbacks PR #904: Fix archive freeing bug in bsdcat PR #961: Fix ZIP format names PR #962: Don't modify attributes for existing directories when ARCHIVE_EXTRACT_NO_OVERWRITE is set PR #964: Fix -Werror=implicit-fallthrough= for GCC 7 PR #970: zip: Allow backslash as path separator
* MFC r328641: dtc(1): Revert WARNS change from r328173kevans2018-02-031-0/+2
| | | | WARNS > 3 breaks xtoolchain builds to varying degrees. Revert it.
* MFC r328212:eadler2018-01-281-1/+1
| | | | limits(1): fix always true condition
* MFC r328206:eadler2018-01-271-0/+1
| | | | limits(1): add missing break
* MFC r328188,r328189,r328200: Fix wrong output for multibyte corner caseskevans2018-01-275-2/+72
| | | | | | | | | | | | | | | | | MFC r328188: od(1): Fix wrong output for corner cases in multibyte locales. Restore the original character to print if we used the look-ahead buffer, but that didn't help -- we either got an illegal sequence or still can't complete. MFC r328189: od(1): Fix mis-patch from r328188 od_test.sh got duplicated erroneously when it was added in r328188. Dedup. MFC r328200: Silence the gcc warning: 'op' may be used uninitialized in this function PR: 224552
* MFC r320296, r328173: Update dtc(1)kevans2018-01-277-83/+447
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MFC r320296 (manu): dtc: Update to upstream 9ce35ff8 - Add "compatible with gpl dtc X.Y.Z" to version output so U-Boot doesn't complain - Fix cross reference node This fixes some Allwinner DTS (and probably others). MFC r328173: dtc(1): Update to upstream ea3c233 Highlights of this update: - /__local_fixups__ is now generated to be GPL dtc and libfdt compliant - Compiling with -@ will now cause dtc to assign phandles to all labelled nodes - /include/ and /incbin/ now handle absolute paths correctly - The manpage now has information about overlays, including how to apply them and how to generate them - Syntactic sugar for overlays is now supported, allowing an overlay DTS like: = /dts-v1/; /plugin/; &foo { foo,status = "okay"; }; = to generate a fragment targetting <&foo>.
* MFC r320930,r324286: Add tests for hexdump(1)kevans2018-01-2726-0/+295
| | | | | | | | | | | | | | | | | | MFC r320930: Add some basic tests for hexdump(1)'s various output flags. Formatting tests are omitted for this initial run as there are still some bugs to work out there. This covers -s flag testing on devices and non-devices that would have caught breakage found in PR 219173 as well as other subtle breakage caused locally. MFC r324286: hexdump: Remove expected test failures for now succeeding tests r323990 fixed the -s flag breakage reported by PR 219173. Mark the corresponding hexdump tests accordingly, since they should now both succeed. PR: 222781
* MFC r327826: patch(1): Don't check for NUL bytes in Plan Akevans2018-01-271-2/+5
| | | | | | | | | | | | | | | | | | | Plan A mmap()'s the entire input file and operates on it in memory. The map(2) call succeeded, so we shouldn't need to bother checking for the NUL byte as long as we're within our buffer space. This was clearly intentional to match "the behavior of the original code", but it creates a discrepancy between Plan A and Plan B that doesn't seem sensible and it's not inherently wrong to allow a NUL byte. This change was motivated by the gemspec in net/rubygem-grpc failing to patch, despite the patch being generated with diff, because a NUL byte was used as a delimiter in the header briefly in an otherwise text file. An alternative was considered: to fallback to plan B if plan A won't process the entire file due to a NUL byte, but I deemed this to be the better option since plan A isn't failing due to memory limitations and will fail later on if it's really dealing with a file it shouldn't be.
* MFC r326483: grep test: Fix copyright noticekevans2018-01-271-11/+11
| | | | | | The copyright notice was erroneously introduced as one from the NetBSD foundation due to it being copied from a file in the NetBSD test suite, but this file itself is not derived from or supplied with the NetBSD test suite.
* MFC 326184: Decode kevent structures logged via ktrace(2) in kdump.jhb2018-01-264-77/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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(). Note that this version of the change for 11.x does not include freebsd11 kevent structures or _WANT_FREEBSD11_KEVENT. It also does not include the change to decode the compat11.kevent system call in truss.
* MFC r328297:brooks2018-01-261-3/+3
| | | | | | | | | | Don't escape '?'s in protocol output. This isn't required by mandoc and is nonfunctional in groff. PR: 224632 Reported by: w.schwarzenfeld@utanet.at Differential Revision: https://reviews.freebsd.org/D13779
* MFC r327770: lld: introduce basic man pageemaste2018-01-242-1/+366
| | | | | | | | | | | | Upstream lld has no man page. Introduce a basic one for FreeBSD based on ld.lld --help, with a brief introduction and additional detail for some options. We'll continue refining this in FreeBSD, and then submit it upstream once the first round of edits are complete. Submitted by: krion, Arshan Khanifar, emaste, bjk Sponsored by: The FreeBSD Foundation
* MFC r328008:eadler2018-01-221-2/+8
| | | | | | units(1) free savescr in error condition too CID: 978392
* MFC r327946 r327947:eadler2018-01-201-3/+3
| | | | | | limits(1): fix grammar PR: 225147
* MFC r327567: hexdump(1): Speed up -s flag on deviceskevans2018-01-181-11/+35
| | | | | | | | | | Using the -s flag on devices is extraordinarily slow due to using fseek(3) a little too conservatively. Address this by using fseek on character/block devices as well, falling back to getchar(3) only if we fail to seek or we're operating on tape drives, where fseek may succeed while not actually being supported. PR: 86485
* MFC r326084: patch(1): don't assume match if we run out of context to checkkevans2018-01-181-0/+3
| | | | | | | | | | | | Patches with very little context (-U0 and -U1) could get misapplied if the file to be patched changes and a hunk is no longer applicable. Matching with fuzz would be attempted and default to a match when we unexpectedly ran out of context. This also affected patches with higher levels of context but had limited actual context due to the hunk being located near the beginning/end of file. PR: 74127
* MFC r324431: patch(1): Don't overrun line buffer in some caseskevans2018-01-181-1/+6
| | | | | | | | | | | Patches like file.txt attached to PR 190195 with a final line formed like ">(EOL)" could cause a copy past the end of the current line buffer. In the case of PR 191641, this caused a duplicate line to be copied into the resulting file. Instead of running past the end, treat it as if it were a blank line. PR: 191641
* MFC r322291: du(1): Add --si option to display in terms of powers of 1000kevans2018-01-183-21/+60
|
* MFC r322177: Respect SIMPLE_BACKUP_SUFFIX environment variable in indent(1)kevans2018-01-182-4/+13
| | | | | | Instead of using a non-configurable ".BAK" suffix, respect the SIMPLE_BACKUP_SUFFIX environment variable also used by patch(1). This simplifies cleanup operations in some patch/indent workflows.
* MFC r326698:asomers2018-01-111-0/+3
| | | | | | | | at(1): annotate some intended switch-case fallthroughs Reported by: Coverity CID: 1008191 Sponsored by: Spectra Logic Corp
* MFC r326455:asomers2018-01-111-6/+1
| | | | | | | | Reap dead code usr.bin/dc/inout.c Reap some dead code that was killed back in 2003 in OpenBSD, in version 1.8 of this file.
* Do not build lint(1) by default on stable-11, add WITH_LINT to enableian2018-01-111-1/+1
| | | | | | | | | | | | | | | | | | building it. lint(1) is required on the host build system to build lint(1) libraries, and it is no longer available on FreeBSD 12. This prevents using a 12 or later host to build an 11 or earlier system, which causes problems for building jails and using poudriere. The problem could be fixed by treating lint as a bootstrap tool when building on 12+, but that just adds complexity and build time to build a broken tool that virtually nobody uses anymore. This is a direct commit to 11-stable because lint no longer exists in later branches. PR: 223892 Relnotes: yes Differential Revision: https://reviews.freebsd.org/D13799
* MFC r327235:delphij2018-01-111-1/+0
| | | | Don't initialize lastlong before assigning it.
* MFC r327236:delphij2018-01-101-1/+1
| | | | | Replace send-mail with the more standarized sendmail, we do not create links for send-mail in mailwrapper so it did not work anyway.
* MFC r327578:eadler2018-01-081-1/+1
| | | | | | units(1): add missing ':' for two short arguments PR: 209850
* MFC r326769:bapt2018-01-071-11/+17
| | | | | | | | | | | | | | | | Remove hard coded number of lun definition The number of lun exposed is now exposed via sysctl by the kernel. Use that number in ctlstat instead of the hardcoded version Add a backward compatibility in case the sysctl(2) request fails. This also allows ctlstat -l 1118 to actually work when having more than 1024 luns. Reviewed by: avg, manu (both before the backward compatibility addition) Approved by: avg, manu (both before the backward compatibility addition) Sponsored by: Gandi.net Differential Revision: https://reviews.freebsd.org/D13446
* MFC r327396:eadler2018-01-071-0/+2
| | | | | | | | | man(1): document exit code man(1) uses standard exit codes, document that. PR: 223517 Reported by: wosch
* MFC r302480:eadler2018-01-061-1/+1
| | | | Add -P to pathchk usage
* MFC r324547:mjg2017-12-311-2/+4
| | | | | | | | xinstall: plug an infinite loop in directory creation If stat continues to fail with ENOENT and mkdir with EEXIST the code wont finish. In particular this can show up when the target path follows through a symlink to a non-existent directory.
* MFC r326791: Close the correct file descriptor.delphij2017-12-261-1/+1
|
* MFC r326289:asomers2017-12-266-0/+380
| | | | | | | | | | | | | | | Add basic tests for ctfconvert(1), fold(1) and rs(1) Add basic command line parsing test coverage for these utilities. The tests were automatically generated based on their man pages. These tests can be expanded by hand for more thorough coverage. The aim is to generate very basic amount of test coverage for all the utilities in the base system. Tests generated via: https://github.com/shivansh/smoketestsuite/ Submitted by: shivansh Reviewed by: asomers Differential Revision: https://reviews.freebsd.org/D12424
* MFC r326185: Set errno to EFTYPE instead of EINVAL to be more consistentdelphij2017-12-251-1/+1
| | | | with the rest of code.
OpenPOWER on IntegriCloud