summaryrefslogtreecommitdiffstats
path: root/usr.bin
Commit message (Collapse)AuthorAgeFilesLines
* Make sure to not skip any argument when converting from deprecatedbapt2014-10-021-1/+1
| | | | | | | | | +POS1, -POS2 to -kPOS1,POS2, so that sort +0n gets translated to sort -k1,1n as it is expected PR: 193994 Submitted by: rodrigo MFC after: 3 days
* Improve performance of mking(1) by keeping a list of "chunks" in memory,marcel2014-10-012-94/+586
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that keeps track of a particular region of the image. In particular the image_data() function needs to return to the caller whether a region contains data or is all zeroes. This required reading the region from the temporary file and comparing the bytes. When image_data() is used multiple times for the same region, this will get painful fast. With a chunk describing a region of the image, we now also have a way to refer to the image provided on the command line. This means we don't need to copy the image into a temporary file. We just keep track of the file descriptor and offset within the source file on a per-chunk basis. For streams (pipes, sockets, fifos, etc) we now use the temporary file as a swap file. We read from the input file and create a chunk of type "zeroes" for each sequence of zeroes that's a multiple of the sector size. Otherwise, we allocte from the swap file, mmap(2) it, read into the mmap(2)'d memory and create a chunk representing data. For regular files, we use SEEK_HOLE and SEEK_DATA to handle sparse files eficiently and create a chunk of type zeroes for holes and a chunk of type data for data regions. For data regions, we still compare the bytes we read to handle differences between a file system's block size and our sector size. After reading all files, image_write() is used by schemes to scribble in the reserved sectors. Since this never amounts to much, keep this data in memory in chunks of exactly 1 sector. The output image is created by looking using the chunk list to find the data and write it out to the output file. For chunks of type "zeroes" we prefer to seek, but fall back to writing zeroes to handle pipes. For chunks of type "file" and "memoty" we simply write. The net effect of this is that for reasonably large images the execution time drops from 1-2 minutes to 10-20 seconds. A typical speedup is about 5 to 8 times, depending on partition sizes, output format whether in input files are sparse or not. Bump version to 20141001.
* Suffix the cookie constants with ULL to silence warnings from compilersmarcel2014-10-011-2/+2
| | | | that try to treat them as 32-bit values.
* Sigh, remove a line that needs to be removed along with previous commit.delphij2014-09-291-1/+0
| | | | | | Submitted by: mjg MFC after: 3 days X-MFC-with: 272288
* When setting environment variables in the atrun script, use thedelphij2014-09-291-1/+1
| | | | | | | | | | "export foo=bar" form instead of "foo=bar; export foo" since the former allows the shell to catch variable names that are not valid shell identifiers. This will cause /bin/sh to exit with an error (which gets mailed to the at user) and it will not run the script. Obtained from: OpenBSD (r1.63 millert) MFC after: 3 days
* Fix integer truncation in affecting systat -ifstatrstone2014-09-291-10/+10
| | | | | | | | | | | The "systat -ifstat" command was using a u_int to store byte counters. With a 10Gbps or faster interface, this overflows within the default 5 second refresh period. Switch to using a uint64_t across the board, which matches the size used for all counters as of r263102. PR: 182448 MFC after: 1 week Sponsored by: Sandvine Inc
* Update the usage message and the man page to account for the new longmarcel2014-09-273-10/+40
| | | | | | | | | | options. Bump the version number to 20140927. While here, use explicit fputc() calls to skip a line in the output. This to avoid having to hunt for extra '\n' characters in the printf format strings. MFC after: 1 week Relnotes: yes
* Add 3 long options for getting information about mkimg itself:marcel2014-09-272-13/+90
| | | | | | | | | | | | | --version print the version of mkimg and also whether it's 64- or 32-bit. --formats list the supported output formats separated by space. --schemes list the supported partitioning schemes separated by space. Inspired by a patch from: gjb@ MFC after: 1 week Relnotes: yes
* Replace the macros used in the previous man(1) commit with literal text,allanjude2014-09-261-9/+9
| | | | | | | | because the macros seem to be specific to groff, and do not render in mandoc Approved by: bcr (mentor) Sponsored by: ScaleEngine Inc.
* Update man(1) to list the different sections of the manualallanjude2014-09-251-1/+31
| | | | | | | | | Add each of the intro sections to the 'Also See' list PR: 193460 Differential Revision: D834 Approved by: bcr (mentor) Sponsored by: ScaleEngine Inc.
* bsdgrep: Work-around for segmentation fault.pfg2014-09-251-1/+1
| | | | | | | | Fix by David Carlier. Obtained from: HardenedBSD PR: 167921 MFC after: 1 month
* Add baseline files for QCOW2.marcel2014-09-2429-1/+625
|
* Finish QCOW version 2 and stop making it conditional.marcel2014-09-241-44/+66
| | | | | | | | | | | | We have a different ordering for the RC block(s) and L2 tables. This is expected to be a non-issue, because everything is found through file offsets in the corresponding RC table and L1 table. Files that grow organically have RC blocks and L2 tables scattered all over the place anyway. The reason for the difference is that mkimg needs to be able to write to a pipe. We can't seek forward and backward to fill in the bits in non-sequential order.
* Add myself (jch) to calendar.freebsd and committers-src.dotjch2014-09-241-0/+1
| | | | Approved by: jhb (mentor)
* Update the baseline for QCOW version 1. A bug was found that renderedmarcel2014-09-2428-1466/+3456
| | | | the baseline invalid.
* Fix the creation of the L2 cluster table for version 1. The blkofsmarcel2014-09-241-44/+77
| | | | | | | | | | | | | | | | variable was assigned the image offset in bytes and not in blocks (i.e. sectors). This had image_data() return FALSE, which meant that we didn't assign a cluster when we needed and also meant that we didn't write parts of the L2 table when we should have. The result being that the actual data clusters were written at the wrong offset. Improve support for QCOW version 2. We're having the right layout and even know how many refcnt blocks we need. All we need to do is populate the refcnt blocks for every cluster we write and allocate a cluster when we need a new refcnt block. The allocation part is tricky in that it'll interleave with the assignment of clusters to L2 tables and data. Since version 2 is not quite done, keep it compiled out for now.
* Clean the generated baseline files by adding them to CLEANFILES.marcel2014-09-241-0/+2
|
* install: re-check failed mkdir for EEXISTmjg2014-09-231-5/+10
| | | | | | | | | | | | Since the code stats and mkdirs in 2 separate steps, it is possible that the directory will be created in the meantime by something else (e.g. concurrent install).[1] While here alter the code to properly report stat failure, previously it would always claim it was mkdir which failed. Noted by: royger [1] MFC after: 1 week
* Rename the tests to something more meaningful. I spent way too longmarcel2014-09-221-5/+2
| | | | | | | | | | | | trying to get the test name right, failed, gave up and used a sequence number instead. When I realized it wasn't because of the number of underscores in the name that I really started to think. I didn't have braces around the variable names ... Thus: test_1 is now called apm_1x1_512_qcow, which gives you all you need to run mkimg by hand. Dumb-ass: marcel
* Don't update the baseline file when the result of the test is identicalmarcel2014-09-221-5/+30
| | | | | | | | | | | | | | to the baseline. Since we don't run gzip with the -n option, the output of gzip varies for identical result files if and when they are created at different time. Ouch... Rather than add -n and commit a 600K+ diff for the changes to all the .uu files, it's less of a churn to uudecode and gunzip the baseline file and compare that to the new result file to determine if the baseline file needs to be updated. This way, "atf-sh mkimg.sh rebase" can be run as many times as people like and a subsequent "svn status" will not show unnecessary diffs.
* Don't echo '# $FreeBSD$' as the first line into the .uu file. Keywordmarcel2014-09-221-1/+2
| | | | | substitution applies to this file, including the echo command. Avoid the match (and substitution) by breaking the string up into 3 parts.
* Update the unit tests to include the QCOW (version 1) format.marcel2014-09-2229-1/+1579
| | | | This is a good safety net for when V2 is added.
* Add support for QCOW version 1. Version 2 is partially implemented.marcel2014-09-222-0/+315
| | | | | | | | | | | | | | | | | | | And because of that, it's entirely disabled for now. Both versions are similar enough that a single header definition works for both of them. The only "diverting" side-effect is that the union of the two is larger than the official V1 header. What this means for our V1 support is that we can't put the L1 table adjacent to the V1 header (i.e. at offset 0x30 in the file), unless we revert to hackery and klugery. Let's not. Instead, we align the L1 table at the cluster boundary. This is in line with the V2 layout and perfectly ok for V1 anyway (ok -- as far as I've seen so far). Due to the alignment, our V1 image seems to be 1 cluster larger than the V1 image created by qemu-img (on average). Compression of the clusters is not supported at this time. MFC after: 2 months
* Add unit tests for mkimg(1):marcel2014-09-20115-0/+3757
|
* Fix partition alignment and image rounding when any of -P (block size),marcel2014-09-1910-54/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | -T (track size) or -H (number of heads) is given: o scheme_metadata() always rounded to the block size. This is not always valid (e.g. vtoc8 that must have partitions start at cylinder boundaries). o The bsd and vtoc8 schemes "resized" the image to make it match the geometry, but since the geometry is an approximation and the size of the image computed from cylinders * heads * sectors is always smaller than the original image size, the partition information ran out of bounds. The fix is to have scheme_metadata() simply pass it's arguments to the per-scheme metadata callback, so that schemes not only know where the metadata is to go, but also what the current block address is. It's now up to the per-scheme callback to reserve room for metadata and to make sure alignment and rounding is applied. The BSD scheme now has the most elaborate alignment and rounding. Just to make the point: partitions are aligned on block boundaries, but the image is rounded to the next cyclinder boundary. vtoc8 now properly has all partitions aligned (and rounded) to the cyclinder boundary. Obtained from: Juniper Networks, Inc. MFC after: 3 days
* Fix incremental builds involving non-root users with read-only source files.will2014-09-181-1/+1
| | | | | | | | | | | Makefiles should not assume that source files can be overwritten. This is the common case for Perforce source trees. This is a followup commit to r211243 in the same vein. MFC after: 1 month Sponsored by: Spectra Logic MFSpectraBSD: r1036319 on 2014/01/29, r1046711 on 2014/03/06
* Fix a typo.markj2014-09-161-1/+1
| | | | MFC after: 3 days
* Add the new iscsi(4) man pageallanjude2014-09-131-2/+3
| | | | | | | | | Cross reference it from iscsid(8) and iscsictl(8) Reviewed by: trasz Approved by: bcr (mentor), wblock (mentor) Sponsored by: ScaleEngine Inc. CR: https://reviews.freebsd.org/D741
* Add support for adding empty partition entries. I.e. skip partitionmarcel2014-09-122-1/+29
| | | | | | | | | | numbers or names. This gives more control over the actual layout and helps to construct BSD disklabels with /usr or /var at dedicated partitions. Obtained from: Juniper Networks, Inc. MFC after: 3 days Relnotes: yes
* Be compatible with boot code that starts right after the disk label inmarcel2014-09-121-1/+4
| | | | | | | | | | | | | | | | | | | | | the second sector by only clearing the amount of bytes needed for the disklabel in the second sector. Previously we were clearing exactly 1 sector worth of bytes and as such writing over boot code that may have been there. Since we do support more than 8 partitions, make sure to set all fields in d_partitions. For the first 8 partitions this is unneeded, but for partitioons 9 and up this compensates for the fact that we don't clear an entire sector anymore. Obviously, one cannot use more than 8 partitions when using boot code that starts right after the disk label. Relevant GRNs: 107879 - Employ unused bytes after the disklabel in the second sector. 189500 - Revert the part of change 107879 that employs the unused bytes after the disklabel in the 2nd sector for boot code. Obtained from: Juniper Networks, Inc. MFC after: 3 days
* Fix checksum calculation:marcel2014-09-121-4/+7
| | | | | | | | | | | 1. Iterate over all partitions counted in the label, which can be more than the number of partitions given to mkimg(1). 2. Start the checksum from the beginning of the label; not the beginning of the bootarea. Tested with bsdlabel(8). MFC after: 3 days
* Fix typo.trasz2014-09-111-2/+2
| | | | | MFC after: 3 days Sponsored by: The FreeBSD Foundation
* Fix header output when -P is specified and (ncpus - 1) != maxid.hrs2014-09-101-6/+10
| | | | | Reported by: Hiroaki Shimizu PR: 152738
* Unify interrupts bit definition and usage. While here remove PSR_C_bit.andrew2014-09-101-1/+1
| | | | | | Submitted by: Svatopluk Kraus <onwahe at gmail.com>, Michal Meloun <meloun at miracle.cz> Differential Revision: https://reviews.freebsd.org/D754
* Stop accessing the saved stack pointer by looking past the end of theandrew2014-09-101-1/+1
| | | | | | array of registers. Submitted by: Michal Meloun <meloun at miracle.cz>
* Add the ability to set `prefer_source' flag to an IPv6 address.ae2014-09-091-1/+1
| | | | | | | | | | | It affects the IPv6 source address selection algorithm (RFC 6724) and allows override the last rule ("longest matching prefix") for choosing among equivalent addresses. The address with `prefer_source' will be preferred source address. Obtained from: Yandex LLC MFC after: 1 month Sponsored by: Yandex LLC
* Add the reverse part to rule #9. Also change its description in theae2014-09-011-1/+1
| | | | | | netstat(8) output. MFC after: 1 week
* Clarify that the -c argument clears the list of tracepoints specified byjhb2014-08-261-4/+6
| | | | | | | -t (it does not clear all tracepoints). Submitted by: jmg, Eric van Gyzen <eric@vangyzen.net> MFC after: 1 week
* Add svnlite.1 to CLEANFILES.gjb2014-08-261-0/+1
| | | | | | MFC after: 3 days X-MFC-To: stable/10 only Sponsored by: The FreeBSD Foundation
* Add host.1 to CLEANFILES.gjb2014-08-261-0/+1
| | | | | | MFC after: 3 days X-MFC-To: stable/10 only Sponsored by: The FreeBSD Foundation
* Missed comma.pluknet2014-08-261-1/+1
|
* More man pages that need to know about vt in addition to syscons.se2014-08-261-0/+3
| | | | MFC after: 3 dayS
* Convert LIBCURSES to LIBNCURSES to fix "make checkdpadd"ngie2014-08-263-6/+6
| | | | | | | | | | Also, add a missing LIBPANEL dependency for lldb Approved by: rpaulo (mentor) Suggested by: brooks MFC after: 5 days Phabric: D675 (as part of a larger diff) PR: 192762
* Fix "make checkdpadd" in usr.bin/iscsictl by removing -lfl dependencyngie2014-08-232-1/+2
| | | | | Approved by: rpaulo (mentor) MFC after: 1 week
* Suppress warnings when retrieving protocol stats from interfaces thatmarkj2014-08-221-6/+6
| | | | | | | don't support IPv6 (e.g. pflog(4)). Reviewed by: hrs MFC after: 2 weeks
* elfdump: Remove extraneous _SUNW_ in reported DT_ namesemaste2014-08-211-5/+5
| | | | Sponsored by: The FreeBSD Foundation
* Rename DT_FEATURE_1 to DT_FEATUREemaste2014-08-211-1/+1
| | | | | | | | This provides a minor cleanup in elfdump; there are otherwise no consumers in the tree. Old SUN documentation can be found for either variant, but GNU binutils switched to DT_FEATURE around 2000. Sponsored by: The FreeBSD Foundation
* Make the iSCSI stack use __FBSDID() properly.trasz2014-08-211-1/+3
| | | | | MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
* Always check the limits of array index variables before using them.pfg2014-08-211-1/+1
| | | | | Obtained from: DragonFlyBSD MFC after: 1 week
* Revert r267233 for now. PIE support needs to be reworked.bdrewery2014-08-1916-32/+0
| | | | | | | | | | | | | | | | | | | | | | | | 1. 50+% of NO_PIE use is fixed by adding -fPIC to INTERNALLIB and other build-only utility libraries. 2. Another 40% is fixed by generating _pic.a variants of various libraries. 3. Some of the NO_PIE use is a bit absurd as it is disabling PIE (and ASLR) where it never would work anyhow, such as csu or loader. This suggests there may be better ways of adding support to the tree. Many of these cases can be fixed such that -fPIE will work but there is really no reason to have it in those cases. 4. Some of the uses are working around hacks done to some Makefiles that are really building libraries but have been using bsd.prog.mk because the code is cleaner. Had they been using bsd.lib.mk then NO_PIE would not have been needed. We likely do want to enable PIE by default (opt-out) for non-tree consumers (such as ports). For in-tree though we probably want to only enable PIE (opt-in) for common attack targets such as remote service daemons and setuid utilities. This is also a great performance compromise since ASLR is expected to reduce performance. As such it does not make sense to enable it in all utilities such as ls(1) that have little benefit to having it enabled. Reported by: kib
OpenPOWER on IntegriCloud