Commit Graph

12969 Commits

Author SHA1 Message Date
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
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
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
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