Commit Graph

13065 Commits

Author SHA1 Message Date
Enji Cooper
c0c5c2f45a 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
2017-05-31 08:01:12 +00:00
Enji Cooper
301441dcd8 Fix "make rebase" after ^/head@r315776
"make rebase" can be used for rebasing the output files from mkimg
after making a change to mkimg. This will come in handy soon, per
bug 219673.

MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-05-31 07:49:49 +00:00
Enji Cooper
605b213ee1 Formalize the dependent/dependency relationship for <foo>.gz.uu vs <foo>
This helps ensure that the output files are regenerated if the input files
change, after the output files have been created.

MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-05-31 07:42:14 +00:00
Alexey Dokuchaev
ab0dffafb7 - Add a simple example to uname(1) manual page to show how the hardware
platform (returned by -m) can be different from the machine's processor
  architecture (-p)
- Document that make(1) sets universal MACHINE and MACHINE_ARCH variables
  based on these values

Reviewed by:		imp, manpages (bjk)
Approved by:		bjk, imp (implied)
Differential Revision:	https://reviews.freebsd.org/D10489
2017-05-31 03:44:31 +00:00
Ed Maste
b05c7cdeb1 bsdgrep: bump version number and add Kyle Evans copyright
The following changes have been made over the last couple of months:

Features:

 - With bsdgrep -r, the working directory is implied if no directory is
   specified
 - bsdgrep will now behave as bsdgrep -r does when it's named rgrep
 - bsdgrep now understands -z/--null-data to use \0 as EOL
 - GNU regex compatibility is now indicated with a "GNU compatible" in
   the version string

Fixes:

 - --mmap no longer hangs when coming across an EOF without an
   accompanying EOL
 - -o/--color matching generally improved, now produces earliest /
   longest matches
 - Context output now more closely aligns with GNU grep
 - Zero-length matches no longer exhibit broken behavior
 - Every output line now honors -b/-H/-n flags

Tests have been added for previous regressions as well as other
previously untested behaviors.

Various other fixes have been commited, and refactoring for further /
later improvements has taken place.

(The original submission changed the version string to 2.5.2, but I
decided to use 2.6.0 to reflect the addition of new features.)

Submitted by:	Kyle Evans <kevans91@ksu.edu>
Differential Revision:	https://reviews.freebsd.org/D10982
2017-05-29 13:10:01 +00:00
Emmanuel Vadot
6b14aecae7 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
2017-05-29 12:51:02 +00:00
Edward Tomasz Napierala
f2e34224fa Declutter rctl(8) by moving kernel build instructions into newly
created rctl(4).

MFC after:	2 weeks
2017-05-28 17:25:47 +00:00
Edward Tomasz Napierala
859f4b702e Random tweaks to rctl(8).
MFC after:	2 weeks
2017-05-28 17:13:38 +00:00
Enji Cooper
80c5ef109c :rgrep : use atf-check to check the exit code/save the output of grep -r instead
of calling grep -r without it, and saving the output to a file

This ensures that any errors thrown via grep -r are caught, not lost, and uses
existing atf-sh idioms for saving files.

Tested with:	bsdgrep, gnu grep (base, ports)
Sponsored by:	Dell EMC Isilon
2017-05-27 22:40:20 +00:00
John Baldwin
708e72dc37 Add descriptions for AES-GCM IPSec authentication (AH) counters.
MFC after:	1 week
Sponsored by:	Chelsio Communications
2017-05-27 16:53:39 +00:00
Conrad Meyer
95b978955c procstat(1): Add TCP socket send/recv buffer size
Add TCP socket send and receive buffer size to procstat -f output.

Reviewed by:	kib, markj
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D10689
2017-05-26 22:17:44 +00:00
Brooks Davis
fbf87d4016 Add missing usage and getopt(3) options
- Add the missing option 'n' to the getopt(3) string
- Add the missing options 'libxo' and 'N' to the usage message
- Add the missing options 'M' and 'N' to the man-page

Submitted by:	Keegan Drake H.P. <kdrakehp@zoho.com>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D10915
2017-05-26 21:10:01 +00:00
Ed Maste
6068d3b2c9 bsdgrep: use safer sizeof() construct
Submitted by:	Kyle Evans <kevans91@ksu.edu>
2017-05-26 03:35:59 +00:00
Ed Maste
8bf4606408 bsdgrep: correct assumptions to prepare for chunking
Correct a couple of minor BSD grep assumptions that are valid for line
processing but not future chunk-based processing.

Submitted by:	Kyle Evans <kevans91@ksu.edu>
Reviewed by:	bapt, cem
Differential Revision:	https://reviews.freebsd.org/D10824
2017-05-26 02:30:26 +00:00
Baptiste Daroussin
9500abb088 Update the diff3 manpage to reflect the fact the version in freebsd does
not use temporary files nor uses a /usr/libexec/diff3prog
2017-05-25 18:46:13 +00:00
Baptiste Daroussin
cb5a670ece For now comment tests for arguments which are not in par with GNU diff3 yet 2017-05-25 17:58:01 +00:00
Baptiste Daroussin
433115a0a4 Remove the MAX_CHECK macro, it was initially used to test if a file was a
text file or not.

The check is not done by diff3 but by diff (the argument -a is directly passed
to diff(1))
2017-05-25 17:55:40 +00:00
Baptiste Daroussin
e1910ebda4 Import working progress BSD diff3
import bsd diff3 from OpenBSD.
Differences with OpenBSD:
- lots of warning fixed
- no shell wrapper with diff3 actually living in libexec
- capsicumized

Keep it disconnected as it is not yet good enough to replace GNU diff

The motivation to import it now it to allow other people to jump in and also to
have an open development on it

Obtained from:	OpenBSD
2017-05-25 17:45:50 +00:00
Michael Tuexen
738a93a461 Improve the decoding of the third argument of the socket() call.
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.
2017-05-25 14:27:54 +00:00
Konstantin Belousov
6992112349 Commit the 64-bit inode project.
Extend the ino_t, dev_t, nlink_t types to 64-bit ints.  Modify
struct dirent layout to add d_off, increase the size of d_fileno
to 64-bits, increase the size of d_namlen to 16-bits, and change
the required alignment.  Increase struct statfs f_mntfromname[] and
f_mntonname[] array length MNAMELEN to 1024.

ABI breakage is mitigated by providing compatibility using versioned
symbols, ingenious use of the existing padding in structures, and
by employing other tricks.  Unfortunately, not everything can be
fixed, especially outside the base system.  For instance, third-party
APIs which pass struct stat around are broken in backward and
forward incompatible ways.

Kinfo sysctl MIBs ABI is changed in backward-compatible way, but
there is no general mechanism to handle other sysctl MIBS which
return structures where the layout has changed. It was considered
that the breakage is either in the management interfaces, where we
usually allow ABI slip, or is not important.

Struct xvnode changed layout, no compat shims are provided.

For struct xtty, dev_t tty device member was reduced to uint32_t.
It was decided that keeping ABI compat in this case is more useful
than reporting 64-bit dev_t, for the sake of pstat.

Update note: strictly follow the instructions in UPDATING.  Build
and install the new kernel with COMPAT_FREEBSD11 option enabled,
then reboot, and only then install new world.

Credits: The 64-bit inode project, also known as ino64, started life
many years ago as a project by Gleb Kurtsou (gleb).  Kirk McKusick
(mckusick) then picked up and updated the patch, and acted as a
flag-waver.  Feedback, suggestions, and discussions were carried
by Ed Maste (emaste), John Baldwin (jhb), Jilles Tjoelker (jilles),
and Rick Macklem (rmacklem).  Kris Moore (kris) performed an initial
ports investigation followed by an exp-run by Antoine Brodin (antoine).
Essential and all-embracing testing was done by Peter Holm (pho).
The heavy lifting of coordinating all these efforts and bringing the
project to completion were done by Konstantin Belousov (kib).

Sponsored by:	The FreeBSD Foundation (emaste, kib)
Differential revision:	https://reviews.freebsd.org/D10439
2017-05-23 09:29:05 +00:00
Mark Johnston
114e38325e Let vmstat -o recognize OBJT_MGTDEVICE objects.
MFC after:	1 week
2017-05-23 07:20:29 +00:00
Baptiste Daroussin
4d16f068f2 Make catman(1) use mandoc(1) by default
catman(1) checks if mandoc(1) do support the manpage before trying to generate
the catpage and falls back on nroff, using the same mechanism as man(1).
2017-05-21 22:28:28 +00:00
Jilles Tjoelker
f084f76687 compress: Allow uncompress -c with multiple pathnames, as required by POSIX.
Per POSIX, allow passing multiple pathnames to uncompress -c, concatenating
the uncompressed data.

Passing multiple pathnames to compress -c remains disallowed, since the
result cannot be decompressed.

PR:		219387
Reported by:	Jörg Schilling
2017-05-21 14:35:16 +00:00
Jilles Tjoelker
fd1c67ef4e compress: Add basic tests. 2017-05-21 14:05:32 +00:00
Ed Maste
6d635d3b32 bsdgrep: Correct per-line line metadata printing
Metadata printing with -b, -H, or -n flags suffered from a few flaws:

1) -b/offset printing was broken when used in conjunction with -o

2) With -o, bsdgrep did not print metadata for every match/line, just
   the first match of a line

3) There were no tests for this

Address these issues by outputting this data per-match if the -o flag is
specified, and prior to outputting any matches if -o but not --color,
since --color alone will not generate a new line of output for every
iteration over the matches.

To correct -b output, fudge the line offset as we're printing matches.

While here, make sure we're using grep_printline in -A context.  Context
printing should *never* look at the parsing context, just the line.

The tests included do not pass with gnugrep in base due to it exhibiting
similar quirky behavior that bsdgrep previously exhibited.

Submitted by:	Kyle Evans <kevans91@ksu.edu>
Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D10580
2017-05-20 11:20:03 +00:00
Ed Maste
fe8c9d5bf1 bsdgrep: emit more than MAX_LINE_MATCHES per line
We should not set an arbitrary cap on the number of matches on a line,
and in any case MAX_LINE_MATCHES of 32 is much too low.  Instead, if we
match more than MAX_LINE_MATCHES, keep processing and matching from the
last match until all are found.

For the regression test, we produce 4096 matches (larger than we expect
we'll ever set MAX_LINE_MATCHES) and make sure we actually get 4096
lines of output with the -o flag.

We'll also make sure that every distinct line is getting its own line
number to detect line metadata not being printed as appropriate along
the way.

PR:		218811
Submitted by:	Kyle Evans <kevans91@ksu.edu>
Reported by:	jbeich
Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D10577
2017-05-20 03:51:31 +00:00
Ed Maste
9a1452026e bsdgrep: fix segfault with --mmap
r313948 partially fixed --mmap behavior but was incomplete.  This commit
generally reverts it and does it the more correct way- by just consuming
the rest of the buffer and moving on.

PR:		219402
Submitted by:	Kyle Evans <kevans91@ksu.edu>
Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D10820
2017-05-20 00:42:47 +00:00
Edward Tomasz Napierala
980e53a299 Language fixes.
Submitted by:	wblock
MFC after:	2 weeks
2017-05-18 19:42:19 +00:00
Piotr Pawel Stefaniak
bd2969a00d indent(1): Support binary integer literals.
This was done by Romain Tartière for PR123553. I initially thought that it would break code like this:
#define b00101010 -1
if (0 b00101010)
...

by joining 0 and b00101010 together. However, the real problem with that patch was that once it saw a 0, it assumed that the number was base 2, 8 or 16, ignoring base 10 floating point numbers. I fixed that.

I didn't copy the diagnostic part of the original patch as it seems out of scope of implementing binary integer literals formatting.

PR:		123553
Submitted by:	romain (original version)
Approved by:	pfg (mentor)
2017-05-18 17:15:58 +00:00
Allan Jude
49dd63a9bd Explain the new fields in top(1) related to ZFS compressed ARC
Reviewed by:	bcr
X-MFC-with:	316314
Differential Revision:	https://reviews.freebsd.org/D10781
2017-05-18 12:55:07 +00:00
Enji Cooper
382cc5a494 Revert local changes to find_progenv accidentally committed in r318436
MFC after:	2 weeks
MFC with:	r318436
Sponsored by:	Dell EMC Isilon
2017-05-18 01:46:30 +00:00
Enji Cooper
20d90b10b1 usr.bin/getconf: add some initial tests
Items tested via this commit are:
- Some basic POSIX constants.
- Some valid programming environments with -v.
- Some invalid programming environments via -v.

NOTE: this test makes assumptions about ILP32/LP32 vs LP64 that are
currently not true on all architectures to avoid hardcoding some
architectures in the tests. I'm working on improving getconf(1) to be
more sane about handling ILP32/LP32 vs LP64. Future commits are coming
soon to address this.

MFC after:	2 weeks
Tested with:	amd64, i386
Sponsored by:	Dell EMC Isilon
2017-05-18 01:43:30 +00:00
Enji Cooper
ea64204213 Make the .gperf.c suffix rule depend on fake-gperf.awk
Parameterize out fake-gperf.awk to avoid duplicating the path

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-05-18 01:35:07 +00:00
Phil Shafer
8a6eceff3c Import libxo-0.7.2; add xo_options.7.
Submitted by:	phil
Reviewed by:	sjg
Approved by:	sjg (mentor)
2017-05-16 18:46:56 +00:00
Enji Cooper
c7d813a93e Start writing up some basic feature tests for procstat
These tests query a running process for information related to the -b,
-c, -e, and -f flags; the -f testcase is largely stubbed out, pending
additional work to determine a good, deterministic descriptor.

Core file test support is coming soon--it requires a bit more effort
due to the fact that:
- coredumps can be disabled (kern.coredump=0).
- corefiles can be put in different directories than the current
  directory, or be named something other than `<prog>.core`
  (`kern.corefile`).

MFC after:	2 months
Sponsored by:	Dell EMC Isilon
2017-05-15 22:52:25 +00:00
Ed Maste
a520574d76 uniq: allow -c to be used with -d or -u
Bring in some bits from NetBSD and lift the restriction in uniq(1) that
-c cannot be used with the -d and -u options.  This restriction seems
unnecessary and is supported at least by GNU, OpenBSD, and NetBSD.  Lift
the restriction and simplify the show() logic a little bit to maintain
functionality when -c is provided with -d/-u.

Also with this change, -d and -u are now actually a mutually exclusive,
albeit valid, combination.  Given that they both indicate opposite
behavior, uniq(1) will no longer output anything if both -d and -u are
supplied.  This is in line with NetBSD as well as GNU.

Adjust the man page and usage() to reflect that -c is its own standalone
option.

PR:		200553
Submitted by:	Kyle Evans <kevans91@ksu.edu>
Reviewed by:	cem, emaste
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D10694
2017-05-15 20:18:14 +00:00
Ed Maste
b5fc583c27 bsdgrep: don't allow negative -A / -B / -C
Previously, when given a negative -A/-B/-C argument bsdgrep would
overflow the respective context flag(s) and exhibited surprising
behavior.

Fix this by removing unsignedness of Aflag/Bflag and erroring out if
we're given a value < 0.  Also adjust the type used to track 'tail'
context in procfile() so that it accurately reflects the Aflag value
rather than overflowing and losing trailing context.

This also fixes an inconsistency previously existing between -n and
-C "n" behavior.  They are now both limited to LLONG_MAX, to be
consistent.

Add some test cases to make sure grep errors out properly for both
negative context values as well as non-numeric context values rather
than giving bogus matches.

Submitted by:	Kyle Evans <kevans91@ksu.edu>
Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D10675
2017-05-15 17:51:01 +00:00
Enji Cooper
df630de5e1 getconf: use nitems(..) to compute NWORDS instead of hardcoding
the equivalent macro

MFC after: 	1 month
Sponsored by:	Dell EMC Isilon
2017-05-14 20:39:01 +00:00
Enji Cooper
ead8d64aed Mark errf _Noreturn, and mark errf and warn __printflike
The _Noreturn attribute was added to placate Coverity and other static
analysis tools. The __printflike attribute was added to catch issues
with the calls related to printf(3) abuse.

- Modify the code to facilitate the __printflike attribute addition.
- Convert errf calls in to_mb(..) and to_mb_string(..) to warn(..) so
  the calls will return instead of exiting, as the code suggests it
  should.

Differential Revision:	D10704
MFC after:	1 month
Reviewed by:	pfg
Sponsored by:	Dell EMC Isilon
2017-05-14 18:47:09 +00:00
Enji Cooper
6d284c0153 style(9): sort headers
MFC after:	3 weeks
Sponsored by:	Dell EMC Isilon
2017-05-13 19:59:03 +00:00
Kenneth D. Merry
0183e01516 Add LTO-8 density codes.
lib/libmt/mtlib.c:
	Add the LTO-8 density code to the density table in libmt.

usr.bin/mt/mt.1:
	Add the LTO-8 density code, tracks, bpmm, and bpi to the density
	table in the mt(1) man page.

MFC after:	3 days
Sponsored by:	Spectra Logic
2017-05-11 13:46:30 +00:00
Enji Cooper
1ec87e7fc8 procstat(1): also reference icmp(4) and sctp(4)
This was missed in the previous commit by accident.

MFC after:	3 weeks
MFC with:	r318178
Sponsored by:	Dell EMC Isilon
2017-05-11 07:58:04 +00:00
Enji Cooper
316ccf01fd procstat(1): document all possible PRO (network protocol) values
Reference the appropriate section 4 manpages for networking
protocols.

MFC after:	3 weeks
Sponsored by:	Dell EMC Isilon
2017-05-11 07:55:38 +00:00
Enji Cooper
9c72afc9dd procstat(1): clarify the Signal Disposition section
- Fix a typo (SIGIGN -> SIG_IGN). Use .Dv when referencing SIG_IGN.
- Use semi-colons as soft breaks when separating sentences for
  the FLAGS section.
- Tweak wording for C slightly to flow better and to be a bit
  more technically correct (signals with handlers installed will
  be caught by the target program).
- Reference signal(3) in the SEE ALSO section.

MFC after:	3 weeks
Sponsored by:	Dell EMC Isilon
2017-05-11 06:35:23 +00:00
Enji Cooper
83fbc8857f procstat(1): fix a typo (it's -> its)
MFC after:	3 weeks
Sponsored by:	Dell EMC Isilon
2017-05-11 06:24:57 +00:00
Simon J. Gerraty
cac6fd1154 Merge bmake-20170510
No-op change other than version update.
2017-05-10 22:45:05 +00:00
Alan Somers
0ce59aa848 Don't depend on assert(3) getting evaluated
Reported by:	imp
MFC after:	3 weeks
X-MFC-With:	318141, 318143
Sponsored by:	Spectra Logic Corp
2017-05-10 16:06:22 +00:00
Alan Somers
5cbe126a6d strcpy => strlcpy
Reported by:	Coverity
CID:		1352771
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
2017-05-10 15:27:36 +00:00
Edward Tomasz Napierala
50bc66f437 Revert to pre-r318116 wording to not give the false impression
that setting the kernels' idea of terminal size is somehow an
alternative to environment variables.

Reported by:	kib
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2017-05-10 14:54:32 +00:00
Emmanuel Vadot
2dcfca637d 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
2017-05-10 09:36:34 +00:00