Commit Graph

13903 Commits

Author SHA1 Message Date
Brooks Davis
a78849183c Don't override LDFLAGS set in bsd.cpu.mk.
This is a direct commit to a generated file.  Simon plans to fix this
upstream before the next import.

PR:		231557
Approved by:	re (gjb)
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
2018-09-25 15:25:42 +00:00
Baptiste Daroussin
61d06d6bd1 Import mandoc 1.14.4
Approved by:	re (kib)
MFC after:	1 week
2018-09-20 10:58:52 +00:00
Brad Davis
bca3325319 Move remote & phones to usr.bin/tip/tip/
Approved by:	re (blanket, pkgbase), will (mentor)
Differential Revision:	https://reviews.freebsd.org/D17219
2018-09-19 14:56:53 +00:00
Brad Davis
1b491096a4 Move install of locate.rc to usr.bin/locate/locate/
This leverages CONFS to handle the install and purges an old comment.

Approved by:	re (blanket, pkgbase), bapt (mentor)
Differential Revision:	https://reviews.freebsd.org/D17215
2018-09-18 20:50:07 +00:00
Brad Davis
22917b7e0e Move mail.rc install to usr.bin/mail.
This leverages CONFS to do the install

Approved by:	re (blanket, pkgbase), bapt (mentor)
Differential Revision:	https://reviews.freebsd.org/D17216
2018-09-18 20:47:06 +00:00
Ed Maste
1ae9615a9a lld: add -z interpose support
-z interpose sets the DF_1_INTERPOSE flag, marking the object as an
interposer.

Committed upstream as LLVM r342239.

PR:		230604
Reported by:	jbeich
Reviewed by:	markj
Approved by:	re (kib)
MFC after:	1 week
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D17172
2018-09-14 15:15:16 +00:00
Martin Matuska
a7bc28227e MFV r338519:
Update libarchive to 3.3.3

As all important changes have already been merged from libarchive git
this is just version number bump, documentation update and some
polishing for cpio tests. Other source code changes are not relevant to
FreeBSD.

Approved by:	re (gjb)
MFC after:	1 week
2018-09-11 20:51:34 +00:00
Ed Maste
5a9066b4de remove doubled name in objcopy manpage
We generate the installed objcopy man page from ELF Tool Chain's
elfcopy, but the sed expresion used for this ended up producing
"objcopy, objcopy - copy and translate object files".

Instead of replacing the first "elfcopy" with objcopy, just remove it.

Approved by:	re (gjb)
2018-09-11 20:32:57 +00:00
Dag-Erling Smørgrav
6434dda6e3 Through a combination of insufficient variable initialization and
imprudent reuse of static buffers, the end-of-transfer statistics
displayed when stdout is not a tty always ended up as 0 B / 0 Bps.
Reorganize the code to use caller-provided buffers, tweak the ETA
display a bit, and reduce the visual differences between the tty and
non-tty end-of-transfer displays.

PR:		202424
Approved by:	re (gjb@)
2018-09-10 19:39:20 +00:00
Kevin Bowling
205f11bbe4 Add kbowling to ports committer list and calendar
Approved by:	re (rgrimes), timur (mentor), krion (mentor)
Differential Revision:	https://reviews.freebsd.org/D17021
2018-09-05 01:46:27 +00:00
Brad Davis
d3b764acc6 Move fbtab, login.conf, and motd to usr.bin/login/
Approved by:	Approved by: re (gjb), bapt (mentor), will (mentor)
Differential Revision:	https://reviews.freebsd.org/D16947
2018-08-30 15:52:03 +00:00
Mark Johnston
b480502648 sed: Fix -i option behavior with 'q' command.
Don't just exit when encountering the 'q' command if we edit file
inplace, and give mf_fgets() a chance to actually handle the
inplace case.

Also add a regression test.

Submitted by:	Yuri Pankov <yuripv@yuripv.net>
Approved by:	re (kib)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D16798
2018-08-29 17:09:03 +00:00
John Baldwin
fd036deac1 Dynamically allocate IRQ ranges on x86.
Previously, x86 used static ranges of IRQ values for different types
of I/O interrupts.  Interrupt pins on I/O APICs and 8259A PICs used
IRQ values from 0 to 254.  MSI interrupts used a compile-time-defined
range starting at 256, and Xen event channels used a
compile-time-defined range after MSI.  Some recent systems have more
than 255 I/O APIC interrupt pins which resulted in those IRQ values
overflowing into the MSI range triggering an assertion failure.

Replace statically assigned ranges with dynamic ranges.  Do a single
pass computing the sizes of the IRQ ranges (PICs, MSI, Xen) to
determine the total number of IRQs required.  Allocate the interrupt
source and interrupt count arrays dynamically once this pass has
completed.  To minimize runtime complexity these arrays are only sized
once during bootup.  The PIC range is determined by the PICs present
in the system.  The MSI and Xen ranges continue to use a fixed size,
though this does make it possible to turn the MSI range size into a
tunable in the future.

As a result, various places are updated to use dynamic limits instead
of constants.  In addition, the vmstat(8) utility has been taught to
understand that some kernels may treat 'intrcnt' and 'intrnames' as
pointers rather than arrays when extracting interrupt stats from a
crashdump.  This is determined by the presence (vs absence) of a
global 'nintrcnt' symbol.

This change reverts r189404 which worked around a buggy BIOS which
enumerated an I/O APIC twice (using the same memory mapped address for
both entries but using an IRQ base of 256 for one entry and a valid
IRQ base for the second entry).  Making the "base" of MSI IRQ values
dynamic avoids the panic that r189404 worked around, and there may now
be valid I/O APICs with an IRQ base above 256 which this workaround
would incorrectly skip.

If in the future the issue reported in PR 130483 reoccurs, we will
have to add a pass over the I/O APIC entries in the MADT to detect
duplicates using the memory mapped address and use some strategy to
choose the "correct" one.

While here, reserve room in intrcnts for the Hyper-V counters.

PR:		229429, 130483
Reviewed by:	kib, royger, cem
Tested by:	royger (Xen), kib (DMAR)
Approved by:	re (gjb)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D16861
2018-08-28 21:09:19 +00:00
Philip Paeps
c7c5d8e387 Add libxo(3) support to last(1).
Reviewed by:	kp
Approved by:	re (gjb)
MFC after:	1 week
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D16922
2018-08-28 17:10:19 +00:00
Kirk McKusick
d81347652c When doing a -S "safe copy", the install command should do an
fsync(2) system call after copying the installed file to ensure
that it is on stable storage.

PR:          230851
Reviewed by: kib
Approved by: re (marius)
2018-08-27 15:20:42 +00:00
Mark Johnston
fedded8d04 Fix column alignment in per-thread mode.
PR:		230872
Approved by:	re (marius)
MFC after:	1 week
2018-08-25 15:59:51 +00:00
Alex Richardson
101db63b42 Don't use absolute path to sed when building usr.bin/join
This is required to build sort on Linux hosts since sed is in /bin there.

Approved By:	jhb (mentor)
2018-08-23 18:18:43 +00:00
Alan Somers
7dbe228c6a tftp(1): switch default transfer mode to binary
netascii is obsolete and inefficient. It isn't even supported by many
clients. Better to use binary mode by default.

Reviewed by:	cem
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D16869
2018-08-23 17:00:07 +00:00
Mark Johnston
4023442dc9 Add an lld option to emit PC-relative relocations for ifunc calls.
The current kernel ifunc implementation creates a PLT entry for each
ifunc definition.  ifunc calls therefore consist of a call to the
PLT entry followed by an indirect jump.  The jump target is written
during boot when the kernel linker resolves R_[*]_IRELATIVE relocations.
This implementation is defined by requirements for userland code, where
text relocations are avoided.  This requirement is not present for the
kernel, so the implementation has avoidable overhead (namely, an extra
indirect jump per call).

Address this for now by adding a special option to the static linker
to inhibit PLT creation for ifuncs.  Instead, relocations to ifunc call
sites are passed through to the output file, so the kernel linker can
enumerate such call sites and apply PC-relative relocations directly
to the text section.  Thus the overhead of an ifunc call becomes exactly
the same as that of an ordinary function call.  This option is only for
use by the kernel and will not work for regular programs.

The final form of this optimization is up for debate; for now, this
change is simple and static enough to be acceptable as an interim
solution.

Reviewed by:	emaste
Discussed with:	arichardson, dim
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D16748
2018-08-23 14:58:19 +00:00
Kyle Evans
67b60a1b7d dtc(1): Update to 0892ec7; HACKING and implicit header fixes
Fixes courtesy of arichardson and jmg:
- HACKING was pointing to the wrong place
- Added headers were being relied on implicitly, but libstdc++ did not
  comply with the unspoken wishes of dtc.

MFC after:	1 week
2018-08-23 02:26:40 +00:00
Eitan Adler
17be5f230a top(1): Use warnx and errx instead of fprintf
This also makes make "-v" exit without error, since it isn't.
2018-08-22 10:07:15 +00:00
Eitan Adler
eeb147d528 top(1): issue warning on invalid delay
When top -sH is run it continually updates. It should issue an warning
instead.

Reported by:	jmg
PR:		230803
2018-08-22 09:49:38 +00:00
John-Mark Gurney
9d58ffcf21 minor grammar nit, to what? between them.. 2018-08-21 15:11:43 +00:00
Mateusz Piotrowski
6ddfef55bd Adjust formatting of grep and zgrep manual pages.
grep(1) changes:
 - Pet mandoc & igor.
 - Stylize the text more with macros when appropriate.
 - Stylize equal signs in long options (e.g., "--color=auto") with
   the "Cm" macro as suggested by mdoc(7).
 - Add missing arguments to --exlude, --exclude-dir, --include and
   --include-dir.
 - Remove a duplicate entry for the --context flag.
 - Use a list in the EXAMPLES sections to make it easier to tell
   which paragraphs belong to which example.
 - Cross reference zgrep(1).

zgrep(1) changes:
 - Fix Nd.
 - Split synopsis into paragraphs for readability.
 - Cross reference bzip(1), grep(1) and xz(1).

Reviewed by:	bcr
Approved by:	mat (mentor)
Differential Revision:	https://reviews.freebsd.org/D16779
2018-08-20 22:23:59 +00:00
John Baldwin
7b87f99aa8 Fully retire the unimplemented -t option from vmstat(8).
It was #ifdef'd out in the 4.4BSD import and hasn't been re-enabled
since then.

Reviewed by:	kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D16804
2018-08-20 09:29:21 +00:00
Eitan Adler
4750b59aca send-pr: wave goodbye
Entering into the world of 12.x we no longer need even the placeholder
for send-pr. It has not done anything for some time.

With Hat: bugmeister
2018-08-19 07:12:35 +00:00
Kyle Evans
9488de009c diff(1): Refactor -B a little bit
Instead of doing a second pass to skip empty lines if we've specified -I, go
ahead and check both at once. Ignore critera has been split out into its own
function to try and keep the logic cleaner.
2018-08-19 04:15:38 +00:00
Kyle Evans
e68edb8cf0 diff(1): Implement -B/--ignore-blank-lines
As noted by cem in r338035, coccinelle invokes diff(1) with the -B flag.
This was not previously implemented here, so one was forced to create a link
for GNU diff to /usr/local/bin/diff

Implement the -B flag and add some primitive tests for it. It is implemented
in the same fashion that -I is implemented; each chunk's lines are scanned,
and if a non-blank line is encountered then the chunk will be output.
Otherwise, it's skipped.

MFC after:	2 weeks
2018-08-19 03:57:20 +00:00
John Baldwin
5cb9940ce2 Use 'bool' instead of 'int' for various boolean flags.
Reviewed by:	kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D16611
2018-08-18 20:23:53 +00:00
Kyle Evans
1a36f105a4 dtc(1): Update to 97d2d5715eeb45108cc60367fdf6bd5b2046b050
Notable fixes:
- Overlays may now be generated properly without -@
- /__local_fixups__ were not including unit address in their structure
- The error reporting a magic token was misleading, reporting
  "Bad magic token in header.  Got d00dfeed expected 0xd00dfeed"
  if the token was missing. This has been split out into a separate message.

MFC after:	1 week
2018-08-17 13:24:48 +00:00
Pedro F. Giffuni
43daed4774 Revert r337419.
The fix is only partial and causes an asymmetry which breaks a test in
multi_test.sh.

We should consider both parts of the issue found in OpenBSD[1], but for now
just revert the change.

[1] http://undeadly.org/cgi?action=article;sid=20180728110010

Reported by: asomers
2018-08-16 18:35:39 +00:00
Piotr Pawel Stefaniak
dad19de0e6 indent(1): bug fix after r336333
The bug was that isalnum() is not exactly equivalent to previous code which
also allowed characters "$" and "_", so check for those explicitly.

Reported by:	tuexen@
2018-08-15 18:19:45 +00:00
Alan Somers
e40369745c tftp: Close a resource leak when putting files
Reported by:	Coverity
CID:		1394842
MFC after:	2 weeks
2018-08-14 17:20:31 +00:00
Jilles Tjoelker
17fffb23f6 printf: Add test for width and precision in %b format
PR:		229641
Submitted by:	pfg
2018-08-13 21:54:27 +00:00
Cy Schubert
61bbe5bf9f Chasing r337661, fix systat after arc accounting change. 2018-08-12 07:47:44 +00:00
Matt Macy
ef8e2d2d01 fix top after arc accounting change 2018-08-11 22:11:12 +00:00
Piotr Pawel Stefaniak
0dee472dd2 indent(1): revert r334640 and r334632
While STACKSIZE macro is indeed problematic on some systems, the commits
were wrong to shrink il[] and cstk[], because they need to be of the same
size as p_stack[] as they're accessed with the same index ps.tos.
2018-08-11 19:20:06 +00:00
Alexander Leidinger
bb50c31811 - Correct the description when jobs are executed related to load avg
to match reality (slightly different to what was submitted in the
   PR: use english word instead of math-symbol).
 - Wrap the corresponding part to below 80 characters per line.

Submitted by:	yamagi@yamagi.org
PR:		202202
Sponsored by:	Essen Hackathon
2018-08-11 16:29:54 +00:00
Brad Davis
bf8a86cd14 Move cron.d/at to usr.bin/at/
This helps with pkgbase as it tags this as a config file so it is handled as
such

Approved by:	allanjude (mentor)
Sponsored by:	Essen Hackathon
Differential Revision:	https://reviews.freebsd.org/D16673
2018-08-11 13:52:23 +00:00
Jilles Tjoelker
051c7fdd5c printf: Fix \c in %b in printf builtin exiting the shell after r337458
SVN r337458 erroneously partially reverted r265885.

This is immediately visible when running the Kyua/ATF tests for
usr.bin/printf, which actually test sh's printf builtin.

PR:		229641
2018-08-11 11:13:34 +00:00
Conrad Meyer
a04ed7615e stat(1): cache id->name resolution
When invoked on a large list of files, it is most common for a small number of
uids/gids to own most of the results.

Like ls(1), use pwcache(3) to avoid repeatedly looking up the same IDs.

Example microbenchmark and non-scientific results:

$ time (find /usr/src -type f -print0 | xargs -0 stat >/dev/null)

BEFORE:
3.62s user 5.23s system 102% cpu 8.655 total
3.47s user 5.38s system 102% cpu 8.647 total

AFTER:
1.23s user 1.81s system 108% cpu 2.810 total
1.43s user 1.54s system 107% cpu 2.754 total

Does this microbenchmark have any real-world significance?  Until a use case
is demonstrated otherwise, I doubt it.  Ordinarily I would be resistant to
optimizing pointless microbenchmarks in base utilities (e.g., recent totally
gratuitous changes to yes(1)).  However, the pwcache(3) APIs actually
simplify stat(1) logic ever so slightly compared to the raw APIs they wrap,
so I think this is at worst harmless.

PR:		230491
Reported by:	Thomas Hurst <tom AT hur.st>
Discussed with:	gad@
2018-08-11 02:56:43 +00:00
Kyle Evans
f032f7b307 apply(1): Fix magic number substitution with magic character ' '
Using a space as the magic character would result in problems if the command
started with a number:

- For a 'valid' number n, n < size of argv, it would erroneously get
  replaced with that argument; e.g. `apply -a ' ' -d 1rm x => `execxrm x`

- For an 'invalid' number n, n >= size of argv, it would segfault.
  e.g. `apply -a ' ' 2to3 test.py` would try to access argv[2]

This problem occurred because apply(1) would prepend "exec " to the command
string before doing the actual magic number replacements, so it would come
across "exec 2to3 1" and assume that the " 2" is also a magic number to be
replaced.

Re-work this to instead just append "exec " to the command sbuf and
workaround the ugliness. This also simplifies stuff in the process.

PR:		226948
Submitted by:	Tobias Stoeckmann <tobias@stoeckmann.org>
MFC after:	1 week
2018-08-08 21:21:28 +00:00
Alan Somers
47cc9ee1b1 Switch the default pager for most commands to less
Finally, a pager for the nineties.

MFC after:	Never
Relnotes:	Yes
Differential Revision:	https://reviews.freebsd.org/D13465
Poll:		https://reviews.freebsd.org/V7
2018-08-08 19:24:20 +00:00
Pedro F. Giffuni
702da35288 Fix printf(1) ignores width and precision in %b format.
The precision with the conversion specifier b is specified by POSIX: see
point 7 in the reference documentation.

This corrects previous wrong log in r337440.

Reference: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html

PR:	229641
Reported by:	Rudolf Cejka
Submitted by:	Garrett D'Amore (illumos)
MFC after:	1 week
2018-08-08 15:25:01 +00:00
Pedro F. Giffuni
94e460157d Revert r337440: the log message is wrong. 2018-08-08 15:12:32 +00:00
Eitan Adler
550ddd16ed top(1): hide THR column in separate-thread mode.
It does not make sense to show a "thread count" column when displaying
threads separately. In fact we don't, but do show the header for this
column. Fix this.
2018-08-08 06:31:46 +00:00
Pedro F. Giffuni
e21ce9d742 Fix printf(1) ignores width and precision in %b format.
The precision with behavior is "unspecified" by POSIX (as of 2018), but
most implementations seem to have taken it to be treated the same as for
"s"; applied after the unescaping.
Adopt the same treatment on our printf.

PR:	229641
Submitted by:	Garrett D'Amore (illumos)
2018-08-07 23:03:50 +00:00
Pedro F. Giffuni
5102499601 sed(1): partial fix for the case of the regex delimited with '['.
We don't generally support the weird case of regular expresions delimited
by an opening square bracket ('[') but POSIX says that inside
bracket expressions, escaping is not possible and both '[' and '\'
represent themselves.

PR:		230198 (exp-run)
Obtained from:	OpenBSD
2018-08-07 14:47:39 +00:00
John Baldwin
7cf2ca3b01 Remove spurious ABI tags from kdump output.
The abidump routine output an ABI tag when -A was specified for records
that were not displayed due to type or pid filtering.  To fix, split
the code to lookup the ABI from the code to display the ABI, move the
code to display the ABI into dumpheader(), and move dumpheader() later
in the main loop as a simplification.  Previously dumpheader() was
called under a condition that repeated conditions made later in the
main loop.

Reviewed by:	kib
MFC after:	1 month
Sponsored by:	DARPA / AFRL
Differential Revision:	https://reviews.freebsd.org/D16608
2018-08-07 00:10:58 +00:00
Conrad Meyer
84b851c23f wc(1): Fix 'wc -L'
I inadvertently broke 'wc -L' in r326736.  We must skip the fast path if -L
was specified, in addition to the existing check for the -l option.

Document long-standing -L behavior (count varies depending on whether wc(1)
is run with the -m option or not) in wc.1.  That behavior dates back to the
introduction of the -L option, but was not documented.

PR:		230300
Reported by:	<amstrnad+bugzilla AT gmail.com>
Sponsored by:	Dell EMC Isilon
2018-08-02 23:45:14 +00:00