Commit Graph

13340 Commits

Author SHA1 Message Date
Bryan Drewery
c99b67a794 Utilize SYSROOT from r320119 in places where DESTDIR may be wanting WORLDTMP.
Since buildenv exports SYSROOT all of these uses will now look in
WORLDTMP by default.

sys/boot/efi/loader/Makefile
        A LIBSTAND hack is no longer required for buildenv.

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-06-19 20:47:24 +00:00
Maxim Sobolev
bc3b2c5545 o Move logic that determines size of the input image into its own
file. That logic has grown quite significantly now;

o add a special handling for the snapshot images. Those have some
  extra headers at the end of the image and we don't need those
  in the output image really.

MFC after:	6 weeks
2017-06-17 02:58:31 +00:00
Konstantin Belousov
2b34e84335 Add abstime kqueue(2) timers and expand struct kevent members.
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
2017-06-17 00:57:26 +00:00
Dimitry Andric
4198293b25 Merge ^/head r319801 through r320041. 2017-06-17 00:14:54 +00:00
Dimitry Andric
24d58133b7 Merge llvm, clang, lld, lldb, compiler-rt and libc++ r305575, and update
build glue.
2017-06-17 00:09:34 +00:00
John Baldwin
a4110f9ffa Decode arguments to sched_* family of system calls.
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().
2017-06-16 20:03:09 +00:00
Phil Shafer
264104f268 Merge libxo-0.8.2:
- xohtml: Add "-w" option to pull support files from gh_pages
- Add "upload-xohtml-files" target to publish support files in gh_pages/
- add HISTORY/AUTHORS section to man pages
- xohtml: Add div.units as standard CSS text
- Don't treat values as format strings; they are not
- add "-p" to "mkdir -p build" in setup.sh
- add test case for {U:%%} (from df.c)
- detect end-of-string in '%' and '' escaping
- make xo_simple_field, for common simple cases
- xohtml: nuke "n" in "echo" commands
- rename "format" to "fmt" for consistency; same for "str" to "value"
- update test cases

Submitted by:	phil
2017-06-16 06:29:21 +00:00
Olivier Houchard
f3360c54b1 style(9) fixes.
Reported by:	cem
2017-06-13 16:19:32 +00:00
Stephen J. Kiernan
ee27b3cd98 The variable nargv is allocated but never freed, so free it when the it
is no longer used.

Submitted by:	Thomas Rix <trix@juniper.net>
Reviewed by:	ed
Approved by:	sjg (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D9652
2017-06-13 15:50:16 +00:00
Pietro Cerutti
e9dd5a0c73 Handle partial writes
Reported by:	ed
Reviewed by:	cognet
Approved by:	cognet
2017-06-13 13:26:50 +00:00
Pietro Cerutti
dadfd1ed33 Improve yes' throughput
On my system, this brings up the throughput from ~20 to ~600 MiB/s.

Inspired by: https://www.reddit.com/r/unix/comments/6gxduc/how_is_gnu_yes_so_fast/

Reviewed by:	cognet
Approved by:	cognet
2017-06-13 12:35:01 +00:00
Ed Maste
e47ea033a1 hexdump: actually enter capability mode on last file
Reviewed by:	cem, Kyle Evans
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D10897
2017-06-13 01:05:55 +00:00
Allan Jude
2fcfba285e top: Missing man page update for r319866
MFC after:	3 days
2017-06-12 19:54:42 +00:00
Allan Jude
d9a7232865 top: Change the way the ZFS ARC compression ratio is calculated
Based on feedback from OpenZFS developers Matt Ahrens and George Wilson,
the calculation of the ratio no longer takes in to account overhead.

The old formula could result in reporting a negative compression ratio

This could confuse the user or give a false impression that there would be
an advantage to disabling the compressed ARC feature.

The new formula will more closely match an average of the on-disk
compression ratio, as reported by the ZFS property 'compressratio'

MFC after:	3 days
Sponsored by:	ScaleEngine Inc.
2017-06-12 19:51:57 +00:00
Enji Cooper
74c9a5910c Add some initial basic tests for du(1)
Tests that exercise the following flags are added in this commit:
- -A
- -H
- -I
- -g
- -h
- -k
- -m

Additional tests will be added soon.

MFC after:	1 month
2017-06-12 07:43:58 +00:00
Enji Cooper
29d65f1cb4 Add some testcases for diff --side-by-side support
These are were created proactively, in anticipation of the support being
fully implemented sometime in the future.

The tests currently fail on ^/head@r319845, however. Expect them to fail.

PR:		219933
Tested with:	gdiff
2017-06-12 05:11:43 +00:00
Enji Cooper
9bd154b8e6 du(1): trivial whitespace cleanup
MFC after:	1 month
2017-06-12 02:42:39 +00:00
Enji Cooper
64a82bcd4e Add initial tests for stat(1)
Testcases for -H, -L, and -f haven't been implemented yet, in part due
to additional complexity needed to validate the features:
* -H and -f will require an external "helper" program to display/modify
  the state/permissions for a given path.
* -L is being covered partially via the -n testcase today.

MFC after:	1 month
2017-06-12 00:21:55 +00:00
Enji Cooper
39aed6d61a stat(1): sort flags in the DESCRIPTION section
-x's description should come after -t's description.

MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2017-06-11 21:23:54 +00:00
Enji Cooper
21860bf938 Write up some basic tests for readlink(1)
The tests exercise -f (f_flag), -n (n_flag), and no arguments (basic).

MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2017-06-11 21:13:12 +00:00
Andriy Gapon
40ea8d27de fstat: catch up with r318997 and use 64 bits to store fsid
Discussed with:	kib
2017-06-10 20:38:52 +00:00
Dimitry Andric
db17bf38c5 Merge llvm, clang, lld, lldb, compiler-rt and libc++ r305145, and update
build glue.
2017-06-10 19:17:14 +00:00
Dimitry Andric
686fb94a00 Merge ^/head r319548 through r319778. 2017-06-10 13:22:49 +00:00
John Baldwin
3cd40bc360 Decode arguments to rtprio() and rtprio_thread(). 2017-06-10 01:32:35 +00:00
John Baldwin
66ba8943a1 Decode arguments to rtprio_thread() (same as rtprio()). 2017-06-10 01:32:18 +00:00
John Baldwin
4152441f44 Decode the 'howto' argument to reboot(). 2017-06-10 01:22:40 +00:00
John Baldwin
dd0c462cf5 Decode the arguments to quotactl(). 2017-06-10 00:53:00 +00:00
John Baldwin
5ac1c7ac34 Decode the arguments to ptrace().
This does not decode structures returned by ptrace().
2017-06-10 00:45:07 +00:00
John Baldwin
ad419d3377 Decode arguments to getpriority() and setpriority(). 2017-06-10 00:37:02 +00:00
John Baldwin
9483ab16d4 Fix decoding of setpriority() arguments.
The PRIO_* 'which' value is stored in the first argument to setpriority(2),
not the last.  While here, decode the arguments to getpriority(2).
2017-06-10 00:35:45 +00:00
Gleb Smirnoff
779f106aa1 Listening sockets improvements.
o Separate fields of struct socket that belong to listening from
  fields that belong to normal dataflow, and unionize them.  This
  shrinks the structure a bit.
  - Take out selinfo's from the socket buffers into the socket. The
    first reason is to support braindamaged scenario when a socket is
    added to kevent(2) and then listen(2) is cast on it. The second
    reason is that there is future plan to make socket buffers pluggable,
    so that for a dataflow socket a socket buffer can be changed, and
    in this case we also want to keep same selinfos through the lifetime
    of a socket.
  - Remove struct struct so_accf. Since now listening stuff no longer
    affects struct socket size, just move its fields into listening part
    of the union.
  - Provide sol_upcall field and enforce that so_upcall_set() may be called
    only on a dataflow socket, which has buffers, and for listening sockets
    provide solisten_upcall_set().

o Remove ACCEPT_LOCK() global.
  - Add a mutex to socket, to be used instead of socket buffer lock to lock
    fields of struct socket that don't belong to a socket buffer.
  - Allow to acquire two socket locks, but the first one must belong to a
    listening socket.
  - Make soref()/sorele() to use atomic(9).  This allows in some situations
    to do soref() without owning socket lock.  There is place for improvement
    here, it is possible to make sorele() also to lock optionally.
  - Most protocols aren't touched by this change, except UNIX local sockets.
    See below for more information.

o Reduce copy-and-paste in kernel modules that accept connections from
  listening sockets: provide function solisten_dequeue(), and use it in
  the following modules: ctl(4), iscsi(4), ng_btsocket(4), ng_ksocket(4),
  infiniband, rpc.

o UNIX local sockets.
  - Removal of ACCEPT_LOCK() global uncovered several races in the UNIX
    local sockets.  Most races exist around spawning a new socket, when we
    are connecting to a local listening socket.  To cover them, we need to
    hold locks on both PCBs when spawning a third one.  This means holding
    them across sonewconn().  This creates a LOR between pcb locks and
    unp_list_lock.
  - To fix the new LOR, abandon the global unp_list_lock in favor of global
    unp_link_lock.  Indeed, separating these two locks didn't provide us any
    extra parralelism in the UNIX sockets.
  - Now call into uipc_attach() may happen with unp_link_lock hold if, we
    are accepting, or without unp_link_lock in case if we are just creating
    a socket.
  - Another problem in UNIX sockets is that uipc_close() basicly did nothing
    for a listening socket.  The vnode remained opened for connections.  This
    is fixed by removing vnode in uipc_close().  Maybe the right way would be
    to do it for all sockets (not only listening), simply move the vnode
    teardown from uipc_detach() to uipc_close()?

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D9770
2017-06-08 21:30:34 +00:00
Baptiste Daroussin
45c2cf11d2 Import mandoc snapshot 2017-06-08
It implements missing man(7) macros used in base by kerberos/ntp and makes them
supported by mandoc.

This import should have been done before the removal of groff.

Reported by:	gordon
2017-06-08 19:40:00 +00:00
John Baldwin
114aeee03b Decode arguments passed to msync(). 2017-06-08 08:10:57 +00:00
John Baldwin
8acc8e78ea Decode flags passed to mount(), nmount(), and unmount(). 2017-06-08 08:07:51 +00:00
John Baldwin
94bde7556c Decode arguments to mlock(), mlockall(), and munlock(). 2017-06-08 04:50:50 +00:00
John Baldwin
2d9c998859 Decode arguments to minherit(). 2017-06-08 04:45:13 +00:00
John Baldwin
26606dcaa7 Decode arguments passed to extended attribute related system calls.
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.
2017-06-08 04:31:15 +00:00
John Baldwin
7ce44f08f5 Decode arguments to ACL related system calls.
This only decodes the raw arguments but not the contents of the struct acl
objects.
2017-06-08 03:51:17 +00:00
Pedro F. Giffuni
12300d3aa0 patch: if reading fails, do not go into infinite loop asking for a filename.
This can happen if no tty is available.

Obtained from:	OpenBSD (CVS rev 1.54)
MFC after:	5 days
2017-06-08 03:15:08 +00:00
Richard Gallamore
d4a698487c Add myself (ultima) as a new port committer.
Reviewed by:	matthew (mentor), lifanov (mentor)
Approved by:	matthew (mentor), lifanov (mentor)
Differential Revision:	https://reviews.freebsd.org/D11089
2017-06-08 01:42:32 +00:00
Baptiste Daroussin
8609431e84 Remove leftovers from groff removal
Reported by:	rpokala
2017-06-07 23:41:33 +00:00
Baptiste Daroussin
738919c039 Remove groff from base
All manpages in base are now compatible with mandoc(1), all roff documentation
will be relocated in the doc tree. man(1) can now use groff from the ports tree
if it needs.

Also remove checknr(1) and colcrt(1) which are only useful with groff.

Approved by:	(no objections on the mailing lists)
2017-06-07 23:00:34 +00:00
Stephen J. Kiernan
366dbfa5c0 The memory assigned to the local variable 'copy' needs to be freed.
Found using clang's static analyzer - scan-build

Submitted by:	Thomas Rix <trix@juniper.net>
Reviewed by:	ed
Approved by:	sjg (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D9663
2017-06-06 21:40:35 +00:00
John Baldwin
b60a095b93 Decode arguments to dup, dup2, getdirentries, pread, and pwrite.
- 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>
2017-06-05 05:25:50 +00:00
Colin Percival
0bf051f957 Delete obsolete paragraph; primes(6) is now able to list primes for the
full range up to 2^64 - 1.

MFC after:	1 week
2017-06-04 02:45:18 +00:00
Colin Percival
ade8bcee50 Using results from
J. Sorenson and J. Webster, Strong pseudoprimes to twelve prime
    bases, Math. Comp. 86(304):985-1003, 2017.
teach primes(6) to enumerate primes up to 2^64 - 1.  Until Sorenson
and Webster's paper, we did not know how many strong speudoprime tests
were required when testing alleged primes between 3825123056546413051
and 2^64 - 1.

Reported by:	Luiz Henrique de Figueiredo
Relnotes:	primes(6) now enumerates primes beyond 3825123056546413050,
		up to a new limit of 2^64 - 1.
MFC After:	1 week
2017-06-04 02:36:37 +00:00
Dimitry Andric
a14eb6db99 Merge ^/head r319480 through r319547. 2017-06-03 18:21:50 +00:00
John Baldwin
ee8aa41dca Decode the 'who' argument passed to getrusage().
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
2017-06-03 14:22:15 +00:00
John Baldwin
ebb2cc40d1 Decode the argument passed to cap_getmode().
The returned integer value is output.
2017-06-02 22:35:18 +00:00
Stephen J. Kiernan
e2005cef7f Fix a memory leak with last
free memory allocated to 'buf'

Submitted by:	Thomas Rix <trix@juniper.net>
Reviewed by:	ed
Approved by:	sjg (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D9850
2017-06-02 20:25:25 +00:00
John Baldwin
7136a1d97a Decode the arguments passed to __cap_rights_get() and cap_rights_limit().
Submitted by:	tobik
2017-06-02 13:33:50 +00:00
John Baldwin
ea67c7a015 Add -H as an alias for --speed-large-file to match GNU diff.
This is undocumented to match GNU diff where -H is also undocumented.
Some existing software (such as kompare) uses this option by default.

Reviewed by:	emaste, rpokala
Differential Revision:	https://reviews.freebsd.org/D11022
2017-06-02 03:25:59 +00:00
Dimitry Andric
4224465e82 Merge ^/head r319251 through r319479. 2017-06-01 22:59:41 +00:00
Dimitry Andric
f9448bf33f Merge llvm, clang, lld, lldb, compiler-rt and libc++ r304460, and update
build glue.
2017-06-01 22:47:02 +00:00
Edward Tomasz Napierala
f26315bd9e Use proper capitalization with .Dd.
Submitted by:	oshogbo
MFC after:	2 weeks
2017-06-01 15:03:43 +00:00
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
Dimitry Andric
a773cead9f Merge ^/head r318964 through r319164. 2017-05-29 22:25:33 +00:00
Dimitry Andric
302affcb04 Merge llvm, clang, lld, lldb, compiler-rt and libc++ r304149, and update
build glue.
2017-05-29 22:09:23 +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
Dimitry Andric
d02c951f8e Merge ^/head r318658 through r318963. 2017-05-26 19:11:24 +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
Dimitry Andric
27c240688c Merge ^/head r318560 through r318657. 2017-05-22 19:28:24 +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
Dimitry Andric
ea1e967cbf Merge ^/head r318380 through r318559. 2017-05-19 21:20:01 +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
Dimitry Andric
5517e702c0 Merge llvm, clang, lld, lldb, compiler-rt and libc++ r303197, and update
build glue.
2017-05-16 21:50:29 +00:00
Dimitry Andric
209be20560 Merge ^/head r317971 through r318379. 2017-05-16 19:54:47 +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
Edward Tomasz Napierala
df2a34c016 Random updates to resizewin(1) man page.
Reviewed by:	cem, Daniel O'Connor <darius@dons.net.au>
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D10640
2017-05-09 20:45:21 +00:00
Bryan Drewery
07676084ec DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-05-09 01:48:23 +00:00
Bryan Drewery
6106a50ee6 DIRDEPS_BUILD: Connect new directories.
Sponsored by:	Dell EMC Isilon
2017-05-09 01:48:14 +00:00
Dimitry Andric
7e1b7636c8 Merge ^/head r317808 through r317970. 2017-05-08 19:27:44 +00:00
Dimitry Andric
0f5676f432 Merge llvm, clang, lld, lldb, compiler-rt and libc++ r302418, and update
build glue.
2017-05-08 19:20:55 +00:00
Conrad Meyer
48b644192d csplit(1): Fix extraneous output in edge case
When the input to csplit contains fewer lines than the number of matches
specified, extra output was mistakenly included in some output files.

Fix the bug and add a simple ATF regression test.

PR:		219024
Submitted by:	J.R. Oldroyd <fbsd at opal.com>
2017-05-08 15:51:29 +00:00
Danilo G. Baio
f83d9358c2 Add myself (dbaio) as a new ports committer
Approved by:	garga (mentor)
Differential Revision:	https://reviews.freebsd.org/D10633
2017-05-08 14:33:38 +00:00
Edward Tomasz Napierala
bd274cceae Sort variable declarations; no functional changes.
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2017-05-08 09:14:41 +00:00
Edward Tomasz Napierala
f1504c0c26 Add resizewin -z. It makes resizewin not do anything if the terminal
size is already set to something other than zero. It's supposed to be
called from eg /etc/profile - it's not neccessary to query terminal
size when logging in over the network, because the protocol used already
takes care of this, but it's neccessary when logging over a serial line.

Reviewed by:	cem, Daniel O'Connor <darius@dons.net.au>
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D10637
2017-05-08 08:58:51 +00:00
Edward Tomasz Napierala
048fd859ce Use tcflush(3) instead of (nonstandard) TIOCFLUSH.
Reported by:	kib
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2017-05-08 08:34:50 +00:00
Edward Tomasz Napierala
7ffc8a5418 Make resizewin(1) discard the terminal queues, to lower the chance
for "unable to parse response" error which happens when youre typing
too fast for the machine you're running it on.

Reviewed by:	cem, Daniel O'Connor <darius@dons.net.au>
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D10624
2017-05-07 17:21:22 +00:00
Edward Tomasz Napierala
31cf65bbf8 Rename a variable, hopefully fixing build after r317901.
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2017-05-07 12:08:41 +00:00
Edward Tomasz Napierala
46f44afb63 Improve error reporting in resizewin(1).
Reviewed by:	cem (earlier version)
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D10624
2017-05-07 09:19:42 +00:00
Baptiste Daroussin
1fc317e374 Build zstandard with threading enabled 2017-05-06 10:59:10 +00:00
Baptiste Daroussin
c3b26e0c47 Add a zstdmt which is equivalent as running zstd -T0 2017-05-06 10:28:57 +00:00
Baptiste Daroussin
d5f16c6603 Import Zstandard 1.2.0
Among new things it is now threaded by default, use zstd -T# to chose the
number of threads not that -T0 will automatically determine the number of
threads based on the number of CPU online.
2017-05-06 10:26:40 +00:00
Kenneth D. Merry
64409eeee7 Add basic programmable early warning error injection to the sa(4) driver.
This will help application developers simulate end of tape conditions.

To inject an error in sa0:

sysctl kern.cam.sa.0.inject_eom=1

This will return the next read or write request queued with 0 bytes
written.  Any subsequent writes or reads will go along as usual.

This will also cause the early warning position flag to get set
for the next position query.  So, 'mt status' will show the BPEW
(Beyond Programmable Early Warning) flag on the first query after
an error injection.  After that, the position flags will be as they
are in the underlying tape drive.

Also, update the sa(4) man page to describe tape parameters,
which can be set via 'mt param'.

sys/cam/scsi/scsi_sa.c:
	In saregister(), create the inject_eom sysctl variable.

	In sastart(), check to see whether inject_eom is set.  If
	so, return the read or write with 0 bytes written to
	indicate EOM.  Set the set_pews_status flag so that we
	fake PEWS status in the next position call for reads, and the
	next 3 calls for writes.  This allows the user to see the BPEW
	flag one time via 'mt status'.

	In sagetpos(), check the set_pews_status flag and fake
	PEWS status and decrement the counter if it is set.

share/man/man4/sa.4:
	Document the inject_eom sysctl variable.

	Document all of the parameters currently supported via
	'mt param'.

usr.bin/mt/mt.1:
	Point the user to the sa(4) man page for more details on
	supported parameters.

MFC after:	3 days
Sponsored by:	Spectra Logic
2017-05-05 20:00:53 +00:00
Ed Maste
e2127de812 bsdgrep: don't ouptut matches with -c, -l, -L
Refactoring done in r317703 broke -c, -l, and -L flags implying
suppression of match printing.  Fortunately this is just a matter of not
doing any printing of the resulting matches and context printing was not
broken in this refactoring.

Add some regression tests since this area may still see further
refactoring, include different context flags as well even though they
were not broken in this case.

PR:		219077
Submitted by:	Kyle kevans91@ksu.edu
Reported by:	markj
Reviewed by:	cem, ngie
Differential Revision:	https://reviews.freebsd.org/D10607
2017-05-05 17:35:05 +00:00
Xin LI
f6b74a7d16 MFV r317581: less v491.
MFC after:	1 month
2017-05-05 14:33:39 +00:00
Dimitry Andric
be27b31162 Merge ^/head r317503 through r317807. 2017-05-04 21:30:26 +00:00
Dimitry Andric
f37b6182a5 Merge llvm, clang, lld, lldb, compiler-rt and libc++ r302069, and update
build glue (preliminary, not all option combinations work yet).
2017-05-03 21:54:55 +00:00
Michael Tuexen
c0b72375d8 Add support for sctp_generic_sendmsg() and sctp_generic_recvmsg(). 2017-05-03 16:03:33 +00:00
Ed Maste
83fd8885c4 bsdgrep: correct uninitialized variable introduced in r317703
CID:		1374747
Submitted by:	Kyle Evans <kevans91@ksu.edu>
2017-05-03 13:47:02 +00:00
Michael Tuexen
fca08fe6a2 Add support for sendmsg() and recvmsg(). 2017-05-03 12:26:16 +00:00
Michael Tuexen
8b429b6569 Decode the fourth argument of sendto and recvfrom call. 2017-05-03 12:23:58 +00:00
Michael Tuexen
832af45715 Add support for [gs]etsockopt(). 2017-05-03 12:18:09 +00:00
Michael Tuexen
ecac235bb0 Decode the third argument of socket(). 2017-05-03 09:23:13 +00:00
Michael Tuexen
58227c6061 Add Socklent for handling args of type socklen_t. 2017-05-03 09:20:36 +00:00
Michael Tuexen
e8d2c81d5b Add support for listen() call. 2017-05-03 09:09:34 +00:00
Jilles Tjoelker
daa379c5af csplit: Fix check of fputs() return value, making csplit work again.
As of r295638, fputs() returns the number of bytes written (if not more than
INT_MAX). This broke csplit completely, since csplit assumed only success
only for the return value 0.

PR:		213510
Submitted by:	J.R. Oldroyd
MFC after:	1 week
Relnotes:	yes
2017-05-02 21:56:20 +00:00
Brooks Davis
517b671957 Use MAN=<empty> rather than MK_MAN=no to not install a manpage.
MFC after:	1 week
2017-05-02 21:09:07 +00:00
Ed Maste
476d209821 bsdgrep: avoid use of magic number for REG_NOSPEC
Submitted by:	Kyle Evans <kevans91 at ksu.edu>
Differential Revision:	https://reviews.freebsd.org/D10420
2017-05-02 21:08:38 +00:00
Ed Maste
41e04e8c77 bsdgrep: fix escape map building for multibyte strings
In BSD grep, fix escape map building in the regex parser. It was
previously using memory not explicitly initialized, and the MBS escape
map was being built based on a version of the pattern with escapes
already parsed out.

This is Kyle's change, but I restored the broken style that already
exists in this file.

Submitted by:	Kyle Evans <kevans91 at ksu.edu>
Reviewed by:	cem, Kyle Evans (my style changes)
Differential Revision:	https://reviews.freebsd.org/D10098
2017-05-02 20:44:06 +00:00
Ed Maste
a4f3f02be6 bsdgrep: fix -w flag matching with an empty pattern
-w flag matching with an empty pattern was generally 'broken', allowing
matches to occur on any line whether or not it actually matches -w
criteria.

This fix required a good amount of refactoring to address.  procline()
is altered to *only* process the line and return whether it was a match
or not, necessary to be able to short-circuit the whole function in case
of this matchall flag. -m flag handling is moved out as well because it
suffers from the same fate as context handling if we bypass any actual
pattern matching.

The matching context (matches, mostly) didn't previously exist outside
of procline(), so we go ahead and create context object for file
processing bits to pass around.  grep_printline() was created due to
this, for the scenarios where the matches don't actually matter and we
just want to print a line or two, a la flushing the context queue and
no -o or --color specified.

Damage from this broken behavior would have been mitigated by the fact
that it is unlikely users would invoke grep -w with an empty pattern.

This was identified while checking PR 105221 for problems it this may
cause in BSD grep, but PR 105221 is *not* a report of this behavior.

Submitted by:	Kyle Evans <kevans91 at ksu.edu>
Differential Revision:	https://reviews.freebsd.org/D10433
2017-05-02 20:39:33 +00:00
Ed Maste
a535623c78 bsdgrep: correct test sense from r317700
Kyle's change in review D10098 was correct. I introduced the error when
extracting a portion of that change.
2017-05-02 20:08:04 +00:00
Ed Maste
e0780d5479 bsdgrep: use calloc where appropriate in grep's tre-fastmatch
Also apply style(9) to a related NULL check.

Submitted by:	Kyle Evans <kevans91 at ksu.edu> (D10098)
2017-05-02 19:56:42 +00:00
Ed Maste
f76958b1c2 bsdgrep: correct nls usage data after r317049
r317049 added -z/--null-data to BSD grep but missed the update to nls
catalogs.

Submitted by:	Kyle Evans <kevans91 at ksu.edu>
Differential Revision:	https://reviews.freebsd.org/D10456
2017-05-02 13:47:15 +00:00
Ed Maste
cc41ba26bb bsdgrep: Add GNU compatible version string indicator
As reported in r218614 it's useful to have an indication of whether or not
BSD grep was built with GNU_GREP_COMPAT.

Submitted by:	Kyle Evans <kevans91 at ksu.edu>
Reported by:	mandree
Differential Revision:	https://reviews.freebsd.org/D10451
2017-05-02 13:38:20 +00:00
Ed Maste
945fc991b2 bsdgrep: fix -w -v matching improperly with certain patterns
-w and -v flag matching was mostly functional but had some minor
problems:

1. -w flag processing only allowed one iteration through pattern
   matching on a line. This was problematic if one pattern could match
   more than once, or if there were multiple patterns and the earliest/
   longest match was not the most ideal, and

2. Previous work "fixed" things to not further process a line if the
   first iteration through patterns produced no matches. This is clearly
   wrong if we're dealing with the more restrictive -w matching.

#2 breakage could have also occurred before recent broad rewrites, but
it would be more arbitrary based on input patterns as to whether or not
it actually affected things.

Fix both of these by forcing a retry of the patterns after advancing
just past the start of the first match if we're doing more restrictive
-w matching and we didn't get any hits to start with. Also move -v flag
processing outside of the loop so that we have a greater change to match
in the more restrictive cases. This wasn't strictly wrong, but it could
be a little more error prone.

While here, introduce some regressions tests for this behavior and fix
some excessive wrapping nearby that hindered readability. GNU grep
passes these new tests.

PR:		218467, 218811
Submitted by:	Kyle Evans <kevans91 at ksu.edu>
Reviewed by:	cem, ngie
Differential Revision:	https://reviews.freebsd.org/D10329
2017-05-02 02:32:10 +00:00
Bryan Drewery
9f665e12ce Redo r288270: Hookup mkcsmapper_static and mkesdb_static for 'make clean'
These are only built as part of the top-level 'build-tools' call for
'make buildworld'.  They still need to be cleaned during the 'make clean'
treewalks though.

Reported by:	markj
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-05-01 19:34:15 +00:00
Jilles Tjoelker
342b089bca printf: Output formatted data directly, instead of via asprintf.
Long ago, sh used to have its own optimized and restricted string formatting
implementation, which the printf builtin had to bypass via asprintf() to a
temporary buffer. Since sh has used libc's string formatting implementation
for a long time, remove the workaround.

Add a check to keep  printf %c ''  working the same way (output nothing);
POSIX allows both outputting nothing and outputting a NUL byte.

Also, this change avoids silently discarding format directives for whose
output asprintf() cannot allocate memory.
2017-04-29 21:48:11 +00:00
Pedro F. Giffuni
336c5fb5cd Fix some cases where an index was used before its limits check.
Obtained from:	DragonFlyBSD (git 799ba435)
MFC after:	5 days
2017-04-29 06:41:51 +00:00
Dimitry Andric
af3f36025b Merge ^/head r317281 through r317502. 2017-04-27 12:59:14 +00:00
Dimitry Andric
51690af2a4 Merge llvm, clang, lld, lldb, compiler-rt and libc++ r301441, and update
build glue.
2017-04-26 22:33:09 +00:00
Brooks Davis
b4e2ab78df Remove NATM configuration bits and assorted NATM and ATM remnants.
Reported by:	ak
Reviewed by:	ngie (first version)
Differential Revision:	https://reviews.freebsd.org/D10497
2017-04-25 21:59:34 +00:00
Brooks Davis
5f20d1ae1b Clean up Makefile.
Prefer SRCTOP vs .CURDIR relative paths.

Find libnetbsd using LIBADD infrastructure rather than manual hackery.

Reviewed by:	ngie, bapt
Obtained from:	CheriBSD
MFC after:	1 week
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D10461
2017-04-24 21:31:27 +00:00
Dimitry Andric
7ef35d05aa Fix the following warning from gcc 4.2 in usr.bin/diff:
usr.bin/diff/diffreg.c: In function 'change':
usr.bin/diff/diffreg.c:1085: warning: 'i' may be used uninitialized in this function

This version of gcc is not smart enough to see that 'i' cannot actually
be used unitialized.  However, the variable is confusingly re-used, so
it is better to give it another name, and clearly initialize it before
attempting to use it.

Reviewed by:	bapt
Differential Revision: https://reviews.freebsd.org/D10484
2017-04-24 20:34:56 +00:00
Benedict Reuschling
0ae98ab709 Fix the last example to really replace all occurrences of the search string
in the file by adding the global (g) option at the end.  Without it, only the
first match is replaced, subsequent ones are ignored.  The intention of the
example is to demonstrate something else, but adding the g matches the example
to what the description says.

Discussed with:	    brd (on IRC)
MFC after:	    1 week
2017-04-24 16:52:26 +00:00
Enji Cooper
22c00e3b85 Only expect :grep_r_implied to pass with bsdgrep(1)
The test fails with gnu grep from base and ports.

Sponsored by:	Dell EMC Isilon
2017-04-22 21:40:31 +00:00
Dimitry Andric
d0338a294d Merge ^/head r317216 through r317280. 2017-04-22 11:30:07 +00:00
Edward Tomasz Napierala
c71c6c734b Add basic example to the cu(1) man page. Srsly, folks, you don't
need to install minicom for this...

MFC after:	2 weeks
2017-04-22 09:38:43 +00:00
Dimitry Andric
b33474c89f Strip out a few objects from libclang, liblldb and lldb, which are not
referenced due to the selection of tools that we build, and our compile
time options.
2017-04-21 21:06:11 +00:00
Dimitry Andric
482a8244bf Update some more build glue. All llvm extras, lld and lldb should link now. 2017-04-21 15:59:58 +00:00
Ed Maste
3f39ffc893 bsdgrep: add BSD_GREP_FASTMATCH knob for built-in fastmatch
Bugs have been found in the fastmatch implementation as used in bsdgrep.
Some have been fixed (r316495) while fixes for others are in review
(D10098).

In comparison with the fastmatch implementation, Kyle Evans found that:

- regex(3)'s performance with literal expressions offers a speed
  improvement over fastmatch

- regex(3)'s performance, both with simple BREs and EREs, seems to be
  comparable

The regex implementation was imported in r226035, and the commit message
reports:

    This is a temporary solution until the whole regex library is
    not replaced so that BSD grep development can continue and the
    backported code gets some review and testing. This change only
    improves scalability slightly, there is no big performance boost
    yet but several minor bugs have been found and fixed.

Introduce a WITH_/WITHOUT_BSD_GREP_FASTMATCH knob to support testing
of both approaches.

PR:		175314, 194823
Submitted by:	Kyle Evans <kevans91 at ksu.edu>
Reviewed by:	bdrewery (in part)
Differential Revision:	https://reviews.freebsd.org/D10282
2017-04-21 14:36:09 +00:00
Simon J. Gerraty
e1cee40d8b Merge bmake-20170420 2017-04-21 00:45:44 +00:00
Gleb Smirnoff
89aa578fde - When reading VM stats, provide proper size argument to sysctl.
- While here, remove unused arguments from mysysctl().
2017-04-21 00:00:23 +00:00
Jung-uk Kim
795cd431cb Fix systat(1) regression. It was broken by r317061. 2017-04-20 22:30:39 +00:00
Dimitry Andric
554491ffbd Merge ^/head r316992 through r317215. 2017-04-20 21:04:21 +00:00
Baptiste Daroussin
a17665bcef Replace again GNU diff with BSD diff
After a firts failed attempt, BSD diff is now good enough to replace
GNU diff.

Relnotes:	yes
2017-04-20 19:24:51 +00:00
Baptiste Daroussin
933870f0d1 Cross reference pr(1) which diff might call with -l option 2017-04-20 19:14:52 +00:00
Baptiste Daroussin
fa0a8c0192 Update the TODO list to reflect what has been changed 2017-04-20 19:07:52 +00:00
Baptiste Daroussin
bcf91ad6d3 Document all long options 2017-04-20 19:05:43 +00:00
Baptiste Daroussin
fddcb7b82f Implement a basic --changed-group-format
etcupdate(8) requires that option, while GNU diff supports many more variation
of that options, their behaviour beside the simple verion implemented here are
quite inconsistent as such I do not plan to implement those.

The only special keyword supported by this implementation are: %< and %>
%= is not implemented as the documentation of GNU diff says: common lines, but
it actually when tested print the changes from the first file
2017-04-20 14:22:33 +00:00
Baptiste Daroussin
05d06ecac3 Add a regression test for diff -D 2017-04-20 11:32:18 +00:00
Emmanuel Vadot
041ec0d284 pom: Remove useless cap_rights_init
Pointy-Hat:	manu

Reported by:	bapt
2017-04-19 20:35:04 +00:00
Emmanuel Vadot
3756a6d8f8 Capsicumize pom
Since pom is the only binary that can save lives, capsicumize it to be
sure that it's safe to run it.

Reviewed by:	bapt
2017-04-19 20:27:48 +00:00
Enji Cooper
d481fdf224 which(1): sort #includes
No functional change [intended].

MFC after:	7 weeks
Sponsored by:	Dell EMC Isilon
2017-04-19 19:55:38 +00:00
Enji Cooper
a6b1979b15 Clean up trailing whitespace
No functional changes

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-04-19 19:52:40 +00:00
Dimitry Andric
f8bb7d0f87 Add new objects to usr.bin/clang/lld for the MK_LLD=yes case. 2017-04-18 19:15:06 +00:00
Dimitry Andric
050e2df194 Add new objects to lib/clang/lib{llvm,clang} and usr.bin/clang for the
MK_CLANG_EXTRAS=yes case.
2017-04-18 17:39:20 +00:00
Gleb Smirnoff
83c9dea1ba - Remove 'struct vmmeter' from 'struct pcpu', leaving only global vmmeter
in place.  To do per-cpu stats, convert all fields that previously were
  maintained in the vmmeters that sit in pcpus to counter(9).
- Since some vmmeter stats may be touched at very early stages of boot,
  before we have set up UMA and we can do counter_u64_alloc(), provide an
  early counter mechanism:
  o Leave one spare uint64_t in struct pcpu, named pc_early_dummy_counter.
  o Point counter(9) fields of vmmeter to pcpu[0].pc_early_dummy_counter,
    so that at early stages of boot, before counters are allocated we already
    point to a counter that can be safely written to.
  o For sparc64 that required a whole dummy pcpu[MAXCPU] array.

Further related changes:
- Don't include vmmeter.h into pcpu.h.
- vm.stats.vm.v_swappgsout and vm.stats.vm.v_swappgsin changed to 64-bit,
  to match kernel representation.
- struct vmmeter hidden under _KERNEL, and only vmstat(1) is an exclusion.

This is based on benno@'s 4-year old patch:
https://lists.freebsd.org/pipermail/freebsd-arch/2013-July/014471.html

Reviewed by:	kib, gallatin, marius, lidl
Differential Revision:	https://reviews.freebsd.org/D10156
2017-04-17 17:34:47 +00:00
Ed Maste
21d5d37ba4 dtc: update to upstream 227d6a3
- Report missing includes at the correct location.
- Add initial support for the -@ option emitting a symbol table.
- Add support for running tests with and without -@
- Add support for generating __fixups__ and __local_fixups__
- Attach the to-string transform to the node path.
2017-04-17 17:23:19 +00:00
Ed Maste
654fdfe87a dtc: remove unused (since r306806) string.hh 2017-04-17 17:18:49 +00:00
Ed Maste
e06ffa3230 bsdgrep: fix zero-length matches without the -o flag
r316477 broke zero-length matches when not using the -o flag, by
skipping over them entirely.

Add a regression test so that it doesn't break again in the future.

Submitted by:	Kyle Evans <kevans91 at ksu.edu>
Reviewed by:	cem emaste ngie
Differential Revision:	https://reviews.freebsd.org/D10333
2017-04-17 14:59:55 +00:00
Ed Maste
22130a21ba bsdgrep: remove output separators between overlapping segments
Make bsdgrep more sensitive to context overlaps.  If it's printing
context that either overlaps or is immediately adjacent to another bit
of context, don't print a separator.

- Non-overlapping segments no longer have two separators between them

- Overlapping segments no longer have separators between them with
  overlapping sections repeated

Submitted by:	Kyle Evans <kevans91 at ksu.edu>
Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D10105
2017-04-17 13:36:30 +00:00
Ed Maste
a461896a2f bsdgrep: for -r, use the working directory if none specified
This is more sensible than the previous behaviour of grepping stdin,
and matches newer GNU grep behaviour.

PR:		216307
Submitted by:	Kyle Evans <kevans91 at ksu.edu>
Reviewed by:	cem, emaste, ngie
Relnotes:	Yes
Differential Revision:	https://reviews.freebsd.org/
2017-04-17 13:22:39 +00:00
Ed Maste
5ee1ea02fd bsdgrep: add -z/--null-data support
-z treats input and output data as sequences of lines terminated by a
zero byte instead of a newline. This brings it more in line with GNU grep
and brings us closer to passing the current tests with BSD grep.

Submitted by:	Kyle Evans <kevans91 at ksu.edu>
Reviewed by:	cem
Relnotes:	Yes
Differential Revision:	https://reviews.freebsd.org/D10101
2017-04-17 13:14:18 +00:00
Dimitry Andric
5897d2f01b Initial update of clang/llvm build glue, for building just a minimal
clang executable.
2017-04-17 11:21:42 +00:00
Patrick Kelsey
2f8c6c0a58 Fix userland tools that don't check the format of routing socket
messages before accessing message fields that may not be present,
removing dead/duplicate/misleading code along the way.

Document the message format for each routing socket message in
route.h.

Fix a bug in usr.bin/netstat introduced in r287351 that resulted in
pointer computation with essentially random 16-bit offsets and
dereferencing of the results.

Reviewed by:	ae
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D10330
2017-04-16 19:17:10 +00:00
Baptiste Daroussin
e96cc41320 Install the zstdgrep shell wrapper 2017-04-15 21:12:11 +00:00
Baptiste Daroussin
7a4dc5404b rename zstless into zstdless to be consistent with other zstdcommands 2017-04-15 20:55:09 +00:00
Baptiste Daroussin
404fe49137 Add forgotten links for zstdcat and unzstd 2017-04-15 20:53:51 +00:00
Baptiste Daroussin
7ccae4e0a4 Add a zstdless equivalent to zless, bzless xzless 2017-04-15 20:06:24 +00:00
Baptiste Daroussin
e229090553 Import zstandard 1.1.4 in base
zstandard is a new compression library/tool which is very fast at
compression/decompression

For now import as a private library
2017-04-15 20:05:22 +00:00
Baptiste Daroussin
7752043c9d Clean up headers declaration 2017-04-15 13:57:35 +00:00
Simon J. Gerraty
b46b903930 Update to bmake 20170413 2017-04-15 01:44:45 +00:00
Conrad Meyer
17fac79462 banner(6): Squash a harmless coverity warning
The destination buffer is sized as the sum of program argument lengths, so
it has plenty of room for *argv.  Appease Coverity by using strlcpy instead
of strcpy.  Similar to a nearby cleanup performed in r316500.

No functional change.

Reported by:	Coverity (CWE-120)
CID:		1006703
Sponsored by:	Dell EMC Isilon
2017-04-13 23:22:18 +00:00
Baptiste Daroussin
a077708d35 add a stub --speed-large-files for compatibility with GNU diff
There is no intention to implement it, but lots of scripts/tools using
diff(1) passes GNU diff option
2017-04-08 08:46:02 +00:00
Baptiste Daroussin
bcc76a2e83 Remove a useless loop over the long options before passing through some
options to diff(1)
2017-04-08 08:42:25 +00:00
Baptiste Daroussin
85bb63bd29 When passingthrough from sdiff to diff the -H/--speed-large-files
options rename it to the long version as GNU diff only support the long
version of the option not the short version
2017-04-08 08:41:05 +00:00
Alan Somers
2b8aaacea9 usr.bin/netstat: strcpy -> strlcpy
Reported by:	Coverity
CID:		1006741, 1006744
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
2017-04-07 15:15:10 +00:00
Ed Maste
d204af1e41 bsdgrep: Handle special case of single-byte NUL pattern
PR:		202022
Submitted by:	Kyle Evans <kevans91 at ksu.edu>
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D10102
2017-04-05 20:11:05 +00:00
Ed Maste
799c5faa8b bsdgrep: create additional tests for coverage on recent fixes
Create additional tests to cover regressions that were discovered by
PRs linked to reviews D10098, D10102, and D10104.

It is worth noting that neither bsdgrep(1) nor gnugrep(1) in the base
system currently pass all of these tests, and gnugrep(1) not quite being
up to snuff was also noted in at least one of the PRs.

PR:		175314 202022 195763 180990 197555 197531 181263 209116
Submitted by:	Kyle Evans <kevans91@ksu.edu>
Reviewed by:	cem, ngie, emaste
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D10112
2017-04-05 18:41:44 +00:00
Alan Somers
6504428e9c Remove a duplicate fclose() that snuck into r316501
Reported by:	Coverity
CID:		1373338
MFC after:	20 days
X-MFC-With:	316501
Sponsored by:	Spectra Logic Corp
2017-04-05 16:13:36 +00:00
Alan Somers
6dc025ea3a Fix file descriptor and memory leaks in pr(1)
Also, hook NetBSD's pr test into the build, and add three more test cases.

Reported by:	Coverity, Valgrind
CID:		271650 271651 271652 271653 271654 271655 271656 271656
CID:		271657 271658 271659 1006939 1006940 1006941 1006942 1009098
Reviewed by:	ngie
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D9137
2017-04-04 20:03:57 +00:00
Alan Somers
9039018c34 strcpy => strlcpy, strcat => strlcat
Reported by:	Coverity
CID:		1006703 978863 1006745 1347163
Reviewed by:	cem
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D10192
2017-04-04 19:46:23 +00:00
Conrad Meyer
f48d142551 bsdgrep(1): Fix errors with invalid expressions
Invalid expressions with an ultimate compiled pattern length of 0 (e.g.,
"grep -E {") were not taken into account and caused a segfault while trying
to fill in the good suffix table.

Submitted by:	Kyle Evans <kevans91 at ksu.edu>
Reviewed by:	me
Differential Revision:	https://reviews.freebsd.org/D10113
2017-04-04 17:05:37 +00:00
Conrad Meyer
5dc41cb0f2 bsdgrep(1): Rip out "xmalloc" bits
xmalloc was a debug malloc implementation, but the x{malloc,calloc,free}
functions default to calling the malloc(3) equivalents.

Instead of relying on this malloc shim, we can devise better ways to debug
malloc issues that aren't misleading upon initial inspection.  (I.e., using
jemalloc's various built-in debugging capabilities.)

Submitted by:	Kyle Evans <kevans91 at ksu.edu>
Reviewed by:	emaste, cem
Differential Revision:	https://reviews.freebsd.org/D10269
2017-04-04 16:08:51 +00:00
Ed Maste
a5ed868511 bsdgrep: revert color changes from r316477
r316477 changed the color output to match exactly the in-tree GNU grep,
but introduces unnecessary escape sequences.

Submitted by:	Kyle Evans <kevans91 at ksu.edu>
Reported by:	ache
MFC after:	1 month
MFC with:	r316477
2017-04-04 14:17:50 +00:00
Ed Maste
a734ae9c14 bsdgrep: Initialize vars to avoid a false positive GCC warning
Reported by:	lwhsu
MFC after:	1 month
MFC with:	r316477
2017-04-04 13:34:19 +00:00
Conrad Meyer
bf10f246fe bsdgrep(1): create rgrep link
Create a convenience rgrep link for bsdgrep(1) that observes 'grep -r'
behavior.

A follow-up to r316473.

Submitted by:	Kyle Evans <kevans91 at ksu.edu>
Reviewed by:	emaste (earlier version), cem
Differential Revision:	https://reviews.freebsd.org/D10109
2017-04-04 05:56:42 +00:00
Ed Maste
87c485cfb5 bsdgrep: fix matching behaviour
- Set REG_NOTBOL if we've already matched beginning of line and we're
  examining later parts

- For each pattern we examine, apply it to the remaining bits of the
  line rather than (potentially) smaller subsets

- Check for REG_NOSUB after we've looked at all patterns initially
  matching the line

- Keep track of the last match we made to later determine if we're
  simply not matching any longer or if we need to proceed another byte
  because we hit a zero-length match

- Match the earliest and longest bit of each line before moving the
  beginning of what we match to further in the line, past the end of the
  longest match; this generally matches how gnugrep(1) seems to behave,
  and seems like pretty good behavior to me

- Finally, bail out of printing any matches if we were set to print all
  (empty pattern) but -o (output matches) was set

PR:		195763, 180990, 197555, 197531, 181263, 209116
Submitted by:	"Kyle Evans" <kevans91@ksu.edu>
Reviewed by:	cem
MFC after:	1 month
Relnotes:	Yes
Differential Revision:	https://reviews.freebsd.org/D10104
2017-04-03 23:16:51 +00:00
Ed Maste
491b8b1623 bsdgrep: treat rgrep as grep -r
Submitted by:	   Kyle Evans <kevans91@ksu.edu>
2017-04-03 21:10:02 +00:00
Allan Jude
f901525697 Revert debugging that was accidently committed in r316314 2017-03-31 03:11:25 +00:00
Allan Jude
8554754c7b fix top(1) ZFS compressed ARC support
top(1) read the wrong amount of data from sysctl, uint64_t instead of
boolean_t, resulting in the stats not showing in many cases.

X-MFC-With:	r315435
Sponsored by:	ScaleEngine Inc.
2017-03-31 03:08:07 +00:00
Tycho Nightingale
86be94fca3 Add support for capturing 'struct ptrace_lwpinfo' for signals
resulting in a process dumping core in the corefile.

Also extend procstat to view select members of 'struct ptrace_lwpinfo'
from the contents of the note.

Sponsored by:	Dell EMC Isilon
2017-03-30 18:21:36 +00:00
Brad Davis
d09b527f96 Add some useful examples to the sed man page.
Reviewed by:	wblock, bcr
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D9958
2017-03-27 16:01:44 +00:00
Jilles Tjoelker
385a67dc6a diff: Show nanoseconds in -u/-c header line.
Show nanoseconds in the -u/-c header line.

The present portability conditionals cannot handle the POSIX standard
st_mtim, so remove them and unconditionally use st_mtim.

PR:		218018
Reported by:	jbeich
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D10145
2017-03-26 19:47:43 +00:00
Robert Watson
abc58cc4d9 Provide proper contemporary function prototypes for many of the functions
implemented in top(1), rather than relying on K&R prototypes, which can
cause problems on targets where there are multiple incompatible calling
conventions and the compiler requires argument information to select the
correct one.

(There's a bit more to do here, since it looks like top(1) also sometimes
provides prototypes for various curses functions rather than relying on
the header file...)

Sponsored by:	DARPA, AFRL
MFC after:	1 week
2017-03-26 17:22:44 +00:00
Jilles Tjoelker
58cf4d864f diff: Fix mtime of file1 in -u/-c header line.
PR:		218018
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D10140
2017-03-26 14:09:25 +00:00
Martin Matuska
e46d471413 MFV r315875:
Sync libarchive with vendor.

Vendor changes (FreeBSD-related):
- store extended attributes with extattr_set_link() if no fd is provided
- add extended attribute tests to libarchive and bsdtar
- fix tar's test_option_acls
- support the UF_HIDDEN file flag

X-MFC with:	315636
2017-03-24 00:02:12 +00:00
Enji Cooper
7dacb9e765 diff(1): document remaining long options
While here, try and tie together some of the short options with
their long option equivalents, where possible.

Sponsored by:	Dell EMC Isilon
2017-03-23 04:35:52 +00:00
Enji Cooper
458cbf0ae6 Rename tests from <foo> to <foo>_test to match the FreeBSD test suite
naming scheme

usr.bin/diff/diff_test was renamed to usr.bin/diff/netbsd_diff_test
to avoid collisions with the renamed FreeBSD test.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-23 03:28:24 +00:00
Baptiste Daroussin
6b8059c4ed Use MIN macros from sys/param.h 2017-03-22 21:59:04 +00:00
Baptiste Daroussin
5c8e56f615 Use strndup(3) instead of malloc + memcpy 2017-03-22 21:52:22 +00:00
Baptiste Daroussin
42c88c4100 Use MAX and MIN macros from sys/param.h 2017-03-22 21:35:01 +00:00
Enji Cooper
78b83a1ea1 diff(1): fix SYNOPSIS section noting non-existent option, --no-ignore-case
`--no-ignore-case` should be `--no-ignore-file-name-case` per code for
compatibility with [g]diff(1).

Sponsored by:	Dell EMC Isilon
2017-03-22 18:13:14 +00:00
Gleb Smirnoff
bf40d2ca68 Shut up gcc. 2017-03-21 08:57:20 +00:00
Gleb Smirnoff
cc65eb4e79 Hide struct inpcb, struct tcpcb from the userland.
This is a painful change, but it is needed.  On the one hand, we avoid
modifying them, and this slows down some ideas, on the other hand we still
eventually modify them and tools like netstat(1) never work on next version of
FreeBSD.  We maintain a ton of spares in them, and we already got some ifdef
hell at the end of tcpcb.

Details:
- Hide struct inpcb, struct tcpcb under _KERNEL || _WANT_FOO.
- Make struct xinpcb, struct xtcpcb pure API structures, not including
  kernel structures inpcb and tcpcb inside.  Export into these structures
  the fields from inpcb and tcpcb that are known to be used, and put there
  a ton of spare space.
- Make kernel and userland utilities compilable after these changes.
- Bump __FreeBSD_version.

Reviewed by:	rrs, gnn
Differential Revision:	D10018
2017-03-21 06:39:49 +00:00
Baptiste Daroussin
5bbffb0049 Cache tzdata when running under capsicum
PR:		217957
Reported by:	tobik@
2017-03-20 19:24:16 +00:00
Eric van Gyzen
f5b9907c86 Port the getaddrinfo(1) utility from NetBSD
Submitted by:	Lohith Bellad <lohithbsd@gmail.com>
Reviewed by:	hiren (earlier rev), ae
Obtained from:	NetBSD
MFC after:	1 week
Relnotes:	yes
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D9365
2017-03-20 16:44:55 +00:00
Martin Matuska
4657548d18 MFV r315633, 315635:
Sync libarchive with vendor

Vendor changes/bugfixes (FreeBSD-related):
  PR 867 (bsdcpio): show numeric uid/gid when names are not found
  PR 870 (seekable zip): accept files with valid ZIP64 EOCD headers
  PR 880 (pax): Fix handling of "size" pax header keyword
  PR 887 (crypto): Discard 3072 bytes instead of 1024 of first keystream
  OSS-Fuzz issue 806 (mtree): rework mtree_atol10 integer parser
  Break ACL read/write code into platform-specific source files
  Unbreak static dependency on libbz2

MFC after:	1 week
2017-03-20 13:02:27 +00:00
Enji Cooper
9ba2762423 diff(1): add --strip-trailing-cr to last example in the SYNOPSIS
This syncs the last example in the SYNOPSIS with the other examples.

Reviewed by:	bapt
Sponsored by:	Dell EMC Isilon
Differential Revision:	D10017
2017-03-19 21:49:15 +00:00
Baptiste Daroussin
2c5ddcf8b6 Temporary readd GNU diff
etcupdate requires --change-group-format it is not easy to implement
in bsd diff so for now readd GNU diff
2017-03-19 17:19:59 +00:00
John Baldwin
a776eeafdc Improve decoding of last arguments to ioctl() and sendto().
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.
2017-03-19 00:36:29 +00:00
John Baldwin
98fdbeec47 Decode arguments to madvise(). 2017-03-19 00:31:21 +00:00
John Baldwin
e261fb2a5b Add a Sizet type for 'size_t' values and use it instead of Int.
Various size_t arguments were previously decoded as Int values instead
which would have truncated values above 2^31 on 64-bit systems.
2017-03-19 00:27:07 +00:00
John Baldwin
94e854c517 Decode arguments passed to kldsym() and kldunloadf().
This does not currently decode the kld_sym_lookup structure passed to
kldsym().
2017-03-18 19:59:21 +00:00
John Baldwin
ab43bedcce Decode arguments passed to getfsstat().
Note that this does not yet decode the statfs structures returned by
getfsstat().
2017-03-18 18:31:45 +00:00
John Baldwin
dd92181f60 Decode flock() operation. 2017-03-18 18:26:56 +00:00
John Baldwin
27459358ed Decode file flags passed to *chflags*().
While here, decode arguments passed to fchflags() and chflagsat().
2017-03-18 18:21:41 +00:00
John Baldwin
d2a9748593 Decode arguments passed to posix_fadvise(). 2017-03-18 18:12:09 +00:00
John Baldwin
bed418c8bd Decode the arguments passed to cap_fcntls_get() and cap_fcntls_limit(). 2017-03-18 18:10:02 +00:00
Allan Jude
1dbfa4b530 Add ZFS compressed ARC stats to top(1)
Provides:
amount of compressed data
logical size of compressed data (how much it would have taken uncompressed)
compression ratio (logical size : total ARC size)
Overhead (space consumed for compression headers)

Example output:
ARC: 31G Total, 18G MFU, 9067M MRU, 2236K Anon, 615M Header, 2947M Other
     25G Compressed, 54G Uncompressed, 1.76:1 Ratio, 2265M Overhead

Reviewed by:	jpaetzel, smh, imp, jhb (previous version)
MFC after:	2 week
Relnotes:	yes
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D9829
2017-03-17 00:46:50 +00:00
John Baldwin
c05cc0d6c8 Automate the handling of QUAD_ALIGN and QUAD_SLOTS.
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
2017-03-15 23:08:11 +00:00
John Baldwin
64f4703b9b Remove duplicate argument from linux_stat64() decoding. 2017-03-15 22:39:15 +00:00
John Baldwin
c4561fab03 Decode arguments to chflagsat(). 2017-03-15 22:36:26 +00:00
Enji Cooper
b7ea08a976 diff(1): sort long options under -D example in SYNOPSYS
Sponsored by:	Dell EMC Isilon
2017-03-15 17:54:47 +00:00