Commit Graph

14550 Commits

Author SHA1 Message Date
Konstantin Belousov
a24ac0ce9b posixshmcontrol: add an undocumented alias 'list' for the 'ls' command.
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2020-03-09 23:08:24 +00:00
Dimitry Andric
2ac6b71f31 Merge ^/head r358712 through r358730. 2020-03-07 15:09:45 +00:00
Hiroki Sato
d726e6331b Fix an issue of net.inet.igmp.stats handler.
The header of (struct igmpstat) could be cleared by sysctl(3).
This can be reproduced by "netstat -s -z -p igmp".

PR:	244584
MFC after:	1 week
2020-03-07 08:41:10 +00:00
Dimitry Andric
e43d33d286 Merge ^/head r358466 through r358677. 2020-03-05 17:55:36 +00:00
Ed Maste
d06e23f9d9 Reserve WXNEEDED ELF feature control flag
This will be used to tag binaries that require W+X mappings, in advance
of the ability to prevent W^X in mmap/mprotect.

There is still some discussion about the flag's name, but the ABI won't
change even if the name does (as kib pointed out in the review).

Reviewed by:	csjp, kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D23909
2020-03-04 18:21:30 +00:00
Ed Maste
76cd520d45 elfctl: check read return value
CID:		1420212, 1420213
Reported by:	Coverity Scan
Sponsored by:	The FreeBSD Foundation
2020-03-04 16:57:23 +00:00
Ed Maste
87a920c065 elfctl: style(9): use C99 uintX_t types
Sponsored by:	The FreeBSD Foundation
2020-03-04 16:53:49 +00:00
Bjoern A. Zeeb
d2b8fd0da1 Add new ICMPv6 counters for Anti-DoS limits.
Add four new counters for ND6 related Anti-DoS measures.
We split these out into a separate upfront commit so that we only
change the struct size one time.  Implementations using them will
follow.

PR:		157410
Reviewed by:	melifaro
MFC after:	2 weeks
X-MFC:		cannot really MFC this without breaking netstat
Sponsored by:	Netflix (initially)
Differential Revision:	https://reviews.freebsd.org/D22711
2020-03-04 16:20:59 +00:00
Conrad Meyer
fd1efedc79 Add extremely useful calendar(1) application to FreeBSD
It does extremely useful things like execute sendmail and spew dubiously
accurate factoids.

From the feedback, it seems like it is an essential utility in a modern unix
and not at all a useless bikeshed.  How do those Linux people live without it?
Reverts r358561.
2020-03-03 00:20:08 +00:00
Conrad Meyer
3c565de33f Fix typo in r278616
FreeBSD isn't an encyclopedia.
2020-03-02 23:37:47 +00:00
John Baldwin
fdf929ff91 Add support for the TFTP windowsize option described in RFC 7440.
The windowsize option permits multiple blocks to be transmitted
before the receiver sends an ACK improving throughput for larger
files.

Reviewed by:	asomers
MFC after:	2 weeks
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D23836
2020-03-02 22:19:30 +00:00
Kyle Evans
8a9f144c9e hexdump: tests: take into account byte order
Hexdump test was failling on big endian systems when testing decimal, octal
and hexa outputs as the tests were designed on a little endian system. This
revision adds the two distinct flavors of output expected and determines at
runtime which to compare against.

Submitted by:	Renato Riolino <renato.riolino_eldorado.org.br>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D23191
2020-03-02 18:40:34 +00:00
Ed Maste
ba6d70a065 elfctl: tiny style(9) cleanup, use bool where appropriate 2020-03-02 14:34:26 +00:00
Kyle Evans
fdafb99d81 elfctl: initialize features
GCC points out a couple levels down in convert_to_features that this may be
used uninitialized. Indeed, this is true- initialize it to NULL so that we
at least deref a null pointer.
2020-03-02 04:22:38 +00:00
Ed Maste
79bfb05b07 Move ELF feature note tool to usr.bin/elfctl
elfctl is a tool for modifying the NT_FREEBSD_FEATURE_CTL ELF note,
which contains a set of flags for enabling or disabling vulnerability
mitigations and other features.

Reviewed by:	csjp, kib
MFC after:	2 weeks
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D23910
2020-03-02 02:36:41 +00:00
Greg Lehey
017ca0de63 Remove comment about Blackthorn winds, apparently imported from 4.4BSD
Lite.  Nowadays it's trivial to find the explanation, such as at
https://www.deseret.com/2000/2/27/19493013/blackthorn-winds-make-bushes-bud.
It doesn't seem appropriate to replace it with an explanation.
2020-03-01 22:10:37 +00:00
Ed Maste
134b378392 retire in-tree GPL dtc devicetree compiler
Now that we no longer have GCC 4.2.1 in the tree and can assume FreeBSD
is being built with a C++11 compiler available, we can use BSDL dtc
unconditionally and retire the GPL dtc.

GPL dtc now has FreeBSD CI support via Cirrus-CI to help ensure it
continues to build/work on FreeBSD and is available in the ports tree
if needed.

The copy of (copyfree licensed) libfdt that we actually use is in
sys/contrib/libfdt so the extra copy under contrib/dtc/libfdt can be
removed along with the rest of the GPL dtc.

Reviewed by:	kevans, ian, imp, manu, theraven
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D23192
2020-02-29 17:10:54 +00:00
Dimitry Andric
91019ea7d4 Merge ^/head r358400 through r358465. 2020-02-29 15:08:14 +00:00
Ed Maste
57f804675e remove GCC 4.2.1 build infrastructure
As described in Warner's email message[1] to the FreeBSD-arch mailing
list we have reached GCC 4.2.1's retirement date.  At this time all
supported architectures either use in-tree Clang, or rely on external
toolchain (i.e., a contemporary GCC version from ports).

GCC 4.2.1 was released July 18, 2007 and was imported into FreeBSD later
that year, in r171825.  GCC has served us well, but version 4.2.1 is
obsolete and not used by default on any architecture in FreeBSD.  It
does not support modern C and does not support arm64 or RISC-V.

Thanks to everyone responsible for maintaining, updating, and testing
GCC in the FreeBSD base system over the years.

So long, and thanks for all the fish.

[1] https://lists.freebsd.org/pipermail/freebsd-arch/2020-January/019823.html

PR:		228919
Reviewed by:	brooks, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D23124
2020-02-29 03:25:51 +00:00
Dimitry Andric
24a22d1d9c Merge r358179 through r358238.
PR:		244251
2020-02-22 09:58:11 +00:00
Rebecca Cran
1631f21745 dtc: remove unknown option printf, since getopt will print it
Since we don't set opterr to 0, getopt prints a message when it
encounters an unknown/invalid option. We therefore don't need to
print our own message in the default handler.

Reviewed by:	kevans, theraven
Differential Revision:	https://reviews.freebsd.org/D23662
2020-02-20 21:29:59 +00:00
Dimitry Andric
6c140a7281 Merge ^/head r358131 through r358178. 2020-02-20 19:07:29 +00:00
Mateusz Guzik
0573d0a9b8 vfs: add realpathat syscall
realpath(3) is used a lot e.g., by clang and is a major source of getcwd
and fstatat calls. This can be done more efficiently in the kernel.

This works by performing a regular lookup while saving the name and found
parent directory. If the terminal vnode is a directory we can resolve it using
usual means. Otherwise we can use the name saved by lookup and resolve the
parent.

See the review for sample syscall counts.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D23574
2020-02-20 16:58:19 +00:00
Dimitry Andric
43c7dd6b59 Merge ^/head r358075 through r358130. 2020-02-19 21:03:06 +00:00
Kyle Evans
733ba7eff6 truss: fix shm_open2 oversight (BinString -> Name)
BinString assumes a length in the next argument; Name is more appropriate
for the final argument.
2020-02-19 15:12:01 +00:00
Kyle Evans
c1b0c84747 kdump: decode shm_open2
This is the kdump counterpart of the truss support added in r358116, and
also a part of D23733. shm_open2 is the successor to shm_open.

Reviewed by:	kaktus
2020-02-19 14:55:59 +00:00
Kyle Evans
bcca34259c truss: decode shm_open2
shm_open2 is similar to shm_open, except it also takes shmflags and optional
name to label the anonymous region for, e.g., debugging purposes.

The appropriate support for decoding shmflags was added to libsysdecode in
r358115.

This is a part of D23733.

Reviewed by:	kaktus
2020-02-19 14:54:33 +00:00
Ed Maste
09d7d4ad9a whereis: remove gnu/libexec from source search paths
The last subdirectory of gnu/libexec was removed in r85742.
2020-02-19 14:40:53 +00:00
Kyle Evans
550bec4fde kdump: decode SHM_ANON as first arg to legacy shm_open(2)
The first argument to shm_open(2) as well as shm_open2(2) may be a path or
SHM_ANON. Decode SHM_ANON, at least- paths will show up as namei results in
kdump output, which may be sufficient; in those cases, we'll have printed an
address.

Future commits will add support for shm_open2() to libsysdecode/truss/kdump.

Reported by:	kaktus
MFC after:	3 days
2020-02-19 14:32:55 +00:00
Dimitry Andric
b33a8b3822 Merge ^/head r357966 through r357999. 2020-02-16 13:23:54 +00:00
Conrad Meyer
06257a71aa random(6): Re-add undocumented support for floating point denominators
And document it in the manual page.

PR:		244139
Submitted by:	Keith White <kwhite AT site.uottawa.ca> (earlier version)
2020-02-15 19:13:37 +00:00
Dimitry Andric
ef1c128c05 Merge ^/head r357921 through r357930. 2020-02-14 19:33:48 +00:00
Dimitry Andric
74dc6beb30 Merge ^/head r357855 through r357920. 2020-02-14 19:32:58 +00:00
Kyle Evans
d16c90f51c dtc: re-apply r353961, r354115
I missed in final review of r357923's diff that these ones hadn't yet been
sent upstream and inadvertently reverted them. =-( Re-apply now.
2020-02-14 18:50:03 +00:00
Kyle Evans
aac4229aac Pull in latest fixes from dtc, up to 0060471
This includes a small battery of /memreserve/ fixes to make sure dtc is
properly writing these regions into the output file and reading them back
out.

As of this update, dtc will now also assume common defaults for -I/-O if
only one is specified; namely, dts for one implies dtb for the other and
vice versa (Requested by: jhibbits, preserves GPL dtc behavior too).

MFC after:	1 week
2020-02-14 18:46:34 +00:00
Kyle Evans
43fbd65451 diff: fix segfault with --tabsize and no/malformed argument
--tabsize was previously listed as optional_argument, but didn't account for
the optionality of it in the argument handling. This is irrelevant -- the
manpage doesn't indicate that the argument is optional, and indeed there's
no clear interpretation of omitting the argument because there's no other
side effect of --tabsize.

The "malformed" argument part of the header on this message is simply
referring to usage like this:

% diff --tabsize 4 A B

With an optional_argument, the argument must be attached to the parameter
directly (e.g. --tabsize=4), so the argument is effectively NULL with the
above invocation as if no argument had been passed.

PR:		243974
Submitted by:	fehmi noyan isi <fnoyanisi yahoo com> (diff.c portion)
MFC after:	3 days
2020-02-13 20:23:55 +00:00
Dimitry Andric
44e86fbdcf Merge ^/head r357662 through r357854. 2020-02-13 12:52:24 +00:00
Mateusz Piotrowski
469635f600 diff.1: Fix style & document -y as extension to POSIX
- Long options must be stylized with the Fl macro as well.

Reviewed by:	bapt
Approved by:	bcr (mentor)
Differential Revision:	https://reviews.freebsd.org/D23642
2020-02-12 20:06:41 +00:00
Martin Matuska
f976241773 MFV r357783:
Update libarchive to 3.4.2

Relevant vendor changes:
  PR #1289: atomic extraction support (bsdtar -x --safe-writes)
  PR #1308: big endian fix for UTF16 support in LHA reader
  PR #1326: reject RAR5 files that declare invalid header flags
  Issue #987: fix support 7z archive entries with Delta filter
  Issue #1317: fix compression output buffer handling in XAR writer
  Issue #1319: fix uname or gname longer than 32 characters in pax writer
  Issue #1325: fix use after free when archiving hardlinks in ISO9660 or XAR
  Use localtime_r() and gmtime_r() instead of localtime() and gmtime()

X-MFC-With:	r356212,r356365,r356416
MFC after:	1 week
2020-02-12 00:16:56 +00:00
Kyle Evans
020419b665 login.conf(5): update commented-out standard, too
MAIL now has a mail capability, instead, as of r357560.
2020-02-09 22:35:49 +00:00
Konstantin Belousov
24d57fa83e Add procstat(1) sigfastblock command to show process sigfastblock word address.
Tested by:	pho
Disscussed with:	cem, emaste, jilles
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D12773
2020-02-09 12:30:50 +00:00
Konstantin Belousov
944cf37bb5 Add AT_BSDFLAGS auxv entry.
The intent is to provide bsd-specific flags relevant to interpreter
and C runtime.  I did not want to reuse AT_FLAGS which is common ELF
auxv entry.

Use bsdflags to report kernel support for sigfastblock(2).  This
allows rtld and libthr to safely infer the syscall presence without
SIGSYS.  The tunable kern.elf{32,64}.sigfastblock blocks reporting.

Tested by:	pho
Disscussed with:	cem, emaste, jilles
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D12773
2020-02-09 12:10:37 +00:00
Ed Maste
5aa0576b33 Miscellaneous typo fixes
Submitted by:	Gordon Bergling <gbergling_gmail.com>
Differential Revision:	https://reviews.freebsd.org/D23453
2020-02-07 19:53:07 +00:00
Dimitry Andric
bc02c18c48 Merge ^/head r357408 through r357661. 2020-02-07 19:08:37 +00:00
Baptiste Daroussin
79208b1025 Fix most of the style warnings 2020-02-07 12:26:38 +00:00
Baptiste Daroussin
89fd163c4e Update diff(1) TODO removing what has been implemented 2020-02-07 10:18:01 +00:00
Baptiste Daroussin
64793e748c diff: implement -y (--side-by-side) along with -W and --suppress-common-lines
PR:		219933
Submitted by:	fehmi noyan isi <fnoyanisi@yahoo.com>
MFC after:	3 weeks
2020-02-07 10:17:13 +00:00
Warner Losh
dd99ab06f3 Remove elf2aout
Remove the long obsolete elf2aout utility. Should any ports need to
know when this left the tree, use 1300077 as the revision so we
avoid multiple bumps for the sparc64 removal.

Reviewed by: brooks@, emaste@
Differential Revision: https://reviews.freebsd.org/D23527
2020-02-06 17:52:16 +00:00
Warner Losh
d6cc6be78c Mark elf2aout as deprecated.
Only sparc64 used this, so we will be removing it from FreeBSD 13. Add
the usual deprecation notice in a MFC-able way.

Reviewed by: emaste, rgrimes
Differential Revision: https://reviews.freebsd.org/D23526
2020-02-06 17:52:11 +00:00
Warner Losh
6a027eda92 No need to have a special sparc64 list here.
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D23525
2020-02-06 17:52:07 +00:00
Kyle Evans
fbdf47586e wc(1): account for possibility of file == NULL
file could reasonably be NULL here if we we're using stdin. Albeit less
likely in normal usage, one could actually hit either of these warnings on
stdin.

ubmitted by:	sigsys@gmail.com
MFC after:	3 days
2020-02-05 14:00:27 +00:00
Kyle Evans
85c8521e67 env(1): grow -L user/class and -U user/class options
This allows one to set the environment of the specified user either from
login.conf alone (-L) or both login.conf and ~/.login_conf if present (-U).

This is a supporting feature to allow service(8) to pull in the environment
of the "daemon" class before invoking the rc script.

This is a part of D21481.

Submitted by:	Andrew Gierth < andrew_tao173.riddles.org.uk>
2020-02-05 04:29:55 +00:00
Kyle Evans
ed6f64ff8a login.conf(5): set a default PATH for the daemon class
This is a sensible default used by, e.g., cron(8), and useful if one wanted
to honor it.

This is a part of D21481.

Submitted by:	Andrew Gierth <andrew_tao173.riddles.org.uk>
2020-02-05 04:27:08 +00:00
Kyle Evans
acf2957e49 login.conf(5): split MAIL env var out into a "mail" capability
This allows it to be easily suppressed in, e.g., the "daemon" class where it
will not be properly expanded.

This is a part of D21481.

Submitted by:	Andrew Gierth <andrew_tao173.riddles.org.uk>
2020-02-05 04:17:14 +00:00
Poul-Henning Kamp
446d49d762 Minor cleanups to allow handing vast datasets.
Submitted by: dds
2020-02-03 20:46:31 +00:00
Mateusz Piotrowski
4a3b87e295 units(1): Refactor the manual page and update usage information
Changes to units.1:

- Change the description to a more descriptive "conversion calculator".
- Sort options.
- Split the description into sections to make it easier to navigate the
  manual page.
- Improve the description of various options.
- Document the default value of the output format.
- Use more mdoc macros for better readability.
- Document the behavior of the PATH environmental variable.
- Improve examples.
- Add sections: EXIT STATUS, DIAGNOSTICS, and HISTORY.
- Document that units(1) cannot convert negative values and it handles long
  unit lists poorly.
- Update the documentation of the -V flag to match the implementation.
  units(1) prints its version and the units data file instead of its
  version and usage information.

Changes to units.c:

- Update usage information.
- Sort longopts elements.

This commit does not attempts to change the current behavior of units(1).
What's left to do is probably defining a better versioning (at the moment
units(1) always reports "FreeBSD units" as its version) and changing the
behavior of the -V flag to only print version.

Reviewed by:	allanjude (earlier version), bcr
Approved by:	bcr (mentor)
Differential Revision:	https://reviews.freebsd.org/D18977
2020-02-03 15:22:46 +00:00
Dimitry Andric
05273b1faa Merge r357345 from the clang1000-import branch:
Disable new clang 10.0.0 warnings about misleading indentation in flex.

As this is contributed code with very messy indentation, which will
almost certainly never be upgraded, just disable the warning.

MFC after:	3 days
2020-01-31 19:06:49 +00:00
Dimitry Andric
533a4a6296 Disable new clang 10.0.0 warnings about misleading indentation in flex.
As this is contributed code with very messy indentation, which will
almost certainly never be upgraded, just disable the warning.

MFC after:	3 days
2020-01-31 19:02:53 +00:00
Dimitry Andric
bb1d0df511 Merge ^/head r357179 through r357269. 2020-01-29 21:09:36 +00:00
Dimitry Andric
ec573c57bd Merge r357267 from the clang1000-import branch:
Fix the following -Werror warning from clang 10.0.0 in tip:

usr.bin/tip/tip/tip.c:428:4: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
                        if (gch == EOF)
                        ^
usr.bin/tip/tip/tip.c:426:5: note: previous statement is here
                } else if (!cumode && gch == character(value(FORCE)))
                  ^

The intent was to have the EOF check grouped with the getchar() call
just above it.  This was accidentally introduced in r354624.

MFC after:	3 days
2020-01-29 21:07:46 +00:00
Dimitry Andric
d405040f05 Merge r357260 from the clang1000-import branch:
Fix the following -Werror warning from clang 10.0.0 in procstat:

usr.bin/procstat/procstat_sigs.c:79:3: error: misleading indentation; statement is not part of the previous 'else' [-Werror,-Wmisleading-indentation]
                xo_close_container(name);
                ^
usr.bin/procstat/procstat_sigs.c:77:4: note: previous statement is here
        } else
          ^

The intent was to group the xo_close_container() call to the previous
snprintf() call.

MFC after:	3 days
2020-01-29 21:06:22 +00:00
Dimitry Andric
f5c072fb4c Fix the following -Werror warning from clang 10.0.0 in tip:
usr.bin/tip/tip/tip.c:428:4: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
                        if (gch == EOF)
                        ^
usr.bin/tip/tip/tip.c:426:5: note: previous statement is here
                } else if (!cumode && gch == character(value(FORCE)))
                  ^

The intent was to have the EOF check grouped with the getchar() call
just above it.  This was accidentally introduced in r354624.

MFC after:	3 days
2020-01-29 20:56:31 +00:00
Alfredo Dal'Ava Junior
d8a85b4237 Add myself (alfredo) to committers-src.dot and calendar.freebsd
Approved by:	jhibbits (mentor)
2020-01-29 17:39:38 +00:00
Dimitry Andric
7bf1ff65fc Fix the following -Werror warning from clang 10.0.0 in procstat:
usr.bin/procstat/procstat_sigs.c:79:3: error: misleading indentation; statement is not part of the previous 'else' [-Werror,-Wmisleading-indentation]
                xo_close_container(name);
                ^
usr.bin/procstat/procstat_sigs.c:77:4: note: previous statement is here
        } else
          ^

The intent was to group the xo_close_container() call to the previous
snprintf() call.

MFC after:	3 days
2020-01-29 17:01:02 +00:00
Dimitry Andric
773bec0868 Merge ^/head r357119 through r357178. 2020-01-27 20:47:18 +00:00
Dimitry Andric
f46f1d2836 Update build glue for lldb (MK_LLDB=yes). Also update lldb's generated
Config.h, disable a few more parts in the code we don't use, and add a
pre-generated man page.
2020-01-27 16:52:44 +00:00
Dimitry Andric
56e766af41 Update build glue for lld (MK_LLD=yes). Also update invocation of
elf::link() in lld.cpp.
2020-01-26 21:55:17 +00:00
Dimitry Andric
b1ae91026f Update build glue for extra clang/llvm tools (MK_CLANG_EXTRAS=yes). 2020-01-26 20:57:29 +00:00
Phil Shafer
5c5819b2b6 Import libxo-1.4.0:
- Two changes to encoder options:
        encoder options may use plus or colon, but only one
        encoder names can be specified as "@name"
        This results in the syntax:

        df --libxo @csv:no-header:leafs=name.available-blocks /

    - If xo_set_program is called before xo_parse_args, honor the requested value
    - add xo_errorn* function; repair newline-adding-on-xo_error bug
    - test programs now use fixed name, since linux libtool prefixs "lt-"
    - Fix "horse butt" comment in source code
    - update test cases

PR:		242686
2020-01-25 21:16:45 +00:00
Dimitry Andric
38b6f45657 Adjust libllvmminimal and tblgen Makefiles so all the tblgen executables
build.
2020-01-25 16:46:39 +00:00
Conrad Meyer
92f7ba208c random(6): Fix off-by-one
After r355693, random(6) -f sometimes fail to output all the lines of the
input file.  This is because the range from which random indices are chosen
is too big, so occasionally the random selection doesn't correspond to any
line and nothing gets printed.

(Ed. note: Mea culpa.  Working on r355693, I was confused by the sometime
use of 1-indexing, sometimes 0-indexing in randomize_fd().)

Submitted by:	Ryan Moeller <ryan AT freqlabs.com>
X-MFC-With:	r355693
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D23199
2020-01-16 21:38:44 +00:00
Alex Richardson
a963845304 Allow bootstrapping mkimg on macOS/Linux
On these systems the (u)int64_t typedefs will not be implicitly defined by the
previous includes, so include <stdint.h> in the header that uses uint64_t.

Reviewed By:	brooks
Differential Revision: https://reviews.freebsd.org/D23202
2020-01-16 14:14:55 +00:00
Mark Johnston
7dddaa0979 Do not skip line-by-line comparison if -q and -I are specified.
This fixes a regression from r356695.

Submitted by:	kevans
Reported by:	Jenkins via lwhsu
MFC after:	6 days
2020-01-14 15:35:03 +00:00
Baptiste Daroussin
12d9c0dc55 When system calls indicate an error they return -1, not some arbitrary
value < 0.  errno is only updated in this case.

Obtained from:	OpenBSD
MFC after:	3 days
2020-01-14 08:22:28 +00:00
Baptiste Daroussin
f9eac42577 asprintf returns -1, not an arbitrary value < 0. Also upon error the
(very sloppy specification) leaves an undefined value in *ret, so it is
wrong to inspect it, the error condition is enough.

Obtained from:	OpenBSD
MFC after:	3 days
2020-01-14 08:18:04 +00:00
Baptiste Daroussin
a3337141a4 mkstemp returns -1
Obtained from:	OpenBSD
MFC after:	3 days
2020-01-14 08:16:15 +00:00
Mark Johnston
5248d3b1b2 Optimize diff -q.
Once we know whether the files differ, we don't need to do any further
work.

PR:		242828
Submitted by:	fehmi noyan isi <fnoyanisi@yahoo.com> (original version)
Reviewed by:	bapt, kevans
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D23152
2020-01-13 18:29:47 +00:00
Kristof Provost
467d94844e gprof: Enable riscv
Add a missing riscv.h header file, and fix the check for riscv (must test
MACHINE_CPUARCH, not MACHINE_ARCH, if we want to use 'riscv').

Sponsored by:	Axiado
2020-01-13 16:52:26 +00:00
Cy Schubert
5452c16c21 Sync with r356645. desiredvnodes is now maxvnodes. 2020-01-13 06:55:38 +00:00
Cy Schubert
a4b840be50 As of r356642 desiredvnodes is u_long. 2020-01-13 06:55:35 +00:00
Garance A Drosehn
526473251e Fix the way 'factor' behaves when using OpenSSL to match the description
of how it works when not compiled with OpenSSL.

Also, allow users to specify a hexadecimal number by using a prefix of
'0x'.  Before this, users could only specify a hexadecimal value if that
value included a hex digit ('a'-'f') in the value.

PR:		243136
Submitted by:	Steve Kargl
Reviewed by:	gad
MFC after:	3 weeks
2020-01-12 20:25:11 +00:00
Rick Macklem
80a1b8c5e3 Update the man page to reflect that "-M" and "-N" are deprecated and ignored.
r356242 updated nfsstat.c to report that the "-M" and "-N" options were
being ignored. These options have never had any meaning for the new NFS
code (which is now the only NFS code).
This patch updates the man page to reflect this.

This is a content change.
2019-12-31 22:25:06 +00:00
Rick Macklem
28a04da3d7 Get rid of old nfsstat options no longer used.
The "-M" and "-N" options for nfsstat were used by the old NFS code and
have never done anything for the new NFS code.
This patch replaces code that assigns values to variables that are never
used with printf()s noting the options are ignored.
This has the side effect that it gets rid of warnings w.r.t. these
variables being assigned but never used, that occur for some builds.

Noticed during integration of the NFSv4.2 code.
2019-12-31 22:19:33 +00:00
Rick Macklem
29001a810a Replace .h files included from old NFS directories with the new NFS ones.
Prior to this patch, nfsstat.c includes files from sys/nfs, sys/nfsclient
and sys/nfsserver. These .h files (particularily the ones in sys/nfsclient
and sys/nfsserver) are from the old NFS code and should eventually be
deprecated/removed.
This patch changes nfsstat.c to include files from the new/current NFS
code instead of the old ones in preparation for eventual removal.
2019-12-31 00:07:10 +00:00
Martin Matuska
79085fd3b9 MFV r356163,r356197:
Update libarchive to 3.4.1

Relevant vendor changes since last update:
  Issue #351: Refactor and implement private state logic for write filters
  PR #1252: RAR5 reader - verify window size for solid files (OSS-Fuzz 15482)
  PR #1255: zip writer - don't append unused NUL for directories
  PR #1260: Fix sparse file offset overflow on 32-bit systems
  PR #1263: UNICODE filename support for reading lha/lzh format
  Issue #1276: Bugfix and optimize archive_wstring_append_from_mbs()
  PR #1288: Add the "xattrhdr" option to pax write options
  PR #1295: 7z reader - fix reading archives with digests in PackInfo
  PR #1296: RAR5 reader - verify window size for multivolume archives
  PR #1297: ZIP reader - support LZMA_STREAM_END marker in 'lzma alone' files
  Issue #1298: Fix a heap-buffer-overflow in archive_string_append_from_wcs()
  OSS-Fuzz 19360, 19362: LHA reader - plug two memory leaks on error
  Fix possible off-by-one when dealing with readlink(2)

MFC after:	2 weeks
2019-12-31 00:05:06 +00:00
Edward Tomasz Napierala
dc04811c2c Move type casts into a single place. No functional changes.
MFC after:	2 weeks
2019-12-29 12:24:41 +00:00
Rick Macklem
e68a89359a Update the nfsstat man page to reflect r355992.
r355992 added listing of NFSv4.2 procedure and operation counts.
This patch updates the nfsstat.1 man page to reflect that change.

This is a content change.
2019-12-22 00:36:22 +00:00
Rick Macklem
309c8f7673 Update nfsstat to list the NFSv4.2 procedures and operations.
r355677 added NFSv4.2 support to the NFS client and server. It also updated
the nfsstats structure to keep counts for the new procedures (client) and
operations (server) added for NFSv4.2.
This patch updates the "-E" option of nfsstat so that it lists counts for
these new procedures and operations.
2019-12-22 00:12:22 +00:00
Philip Paeps
fc8ae86a8f top: display battery capacity remaining
Submitted by: Antranig Vartanian <antranigv@freebsd.am>
Reviewed by:  imp, philip
Differential Revision:        https://reviews.freebsd.org/D22871
2019-12-21 05:03:21 +00:00
Dimitry Andric
0b57cec536 Move all sources from the llvm project into contrib/llvm-project.
This uses the new layout of the upstream repository, which was recently
migrated to GitHub, and converted into a "monorepo".  That is, most of
the earlier separate sub-projects with their own branches and tags were
consolidated into one top-level directory, and are now branched and
tagged together.

Updating the vendor area to match this layout is next.
2019-12-20 19:53:05 +00:00
Baptiste Daroussin
94678ee678 Replace homemade getline(3) by actual getline(3) 2019-12-17 11:03:32 +00:00
Baptiste Daroussin
9520071f7e Use strtoimax.
Use existing strtoimax instead of reinventing it
2019-12-17 09:13:48 +00:00
Gleb Smirnoff
185c3d2b93 Convert routing statistics to VNET_PCPUSTAT.
Submitted by:	ocochard
Reviewed by:	melifaro, glebius
Differential Revision:	https://reviews.freebsd.org/D22834
2019-12-17 02:02:26 +00:00
Phil Shafer
2db46b45f4 Allow proper builds of libxo's CSV encoder:
- Move libxo.a build to subdirectory (lib/libxo/libxo/Makefile)
- Add .WAIT target to delay encoder build til after libxo
- Use FILES to install encoder library as csv.enc
- Update import script to put xo_config.h in new location
2019-12-16 22:05:03 +00:00
Ian Lepore
d937171727 Support --all-repeats in uniq(1) for compatibility with gnu coreutils.
This adds a new -D/--all-repeats option to uniq(1), which outputs each copy
of any repeated lines (as opposed to a single copy of a repeated line). You
can specify a separator option to output a blank line before or after each
group of repeated lines. This adds compatibility with the GNU coreutils
version of uniq(1).

This change also re-groups the -c, -d, -D, -u options in the usage display
and man page to indicate that they are mutally exclusive of each other. This
matches the posix/opengroup definition of uniq(1) command line args. Note
that this change does NOT actually enforce the mutual exclusion in the code,
for now, it simply documents that the arguments should be considered
exclusive with each other.

Differential Revision:	https://reviews.freebsd.org/D22262
2019-12-15 18:05:18 +00:00
Edward Tomasz Napierala
1e62ecedf2 Add -M option to nc(1), which makes it print the TCP connection
statistics obtained with stats(3) in JSON format to standard error.

Reviewed by:	allanjude, thj, cem (earlier version)
Tested by:	thj
MFC after:	2 weeks
Relnotes:	yes
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D21324
2019-12-14 10:53:52 +00:00
Conrad Meyer
c7b8411cc9 random(6): produce random results
This program is trash and there's no reason to keep it in base.  But as long as
we're shipping a silly program named 'random', let's actually make it random.
2019-12-13 04:37:39 +00:00
Eitan Adler
a88611b67b [showmount] implement long options
add long options support to showmount. Where mappings exist use the GNU
names for said options.

Differential Revision:	https://reviews.freebsd.org/D22543
Reviewed by:		kevans (earlier version)
2019-12-12 05:11:53 +00:00
Simon J. Gerraty
2c9a9dfc18 Update Makefile.depend files
Update a bunch of Makefile.depend files as
a result of adding Makefile.depend.options files

Reviewed by:	 bdrewery
MFC after:	1 week
Sponsored by:   Juniper Networks
Differential Revision:  https://reviews.freebsd.org/D22494
2019-12-11 17:37:53 +00:00
Simon J. Gerraty
5ab1c5846f Add Makefile.depend.options
Leaf directories that have dependencies impacted
by options need a Makefile.depend.options file
to avoid churn in Makefile.depend

DIRDEPS for cases such as OPENSSL, TCP_WRAPPERS etc
can be set in local.dirdeps-options.mk
which can add to those set in Makefile.depend.options

See share/mk/dirdeps-options.mk

Reviewed by:	 bdrewery
MFC after:	1 week
Sponsored by:   Juniper Networks
Differential Revision:  https://reviews.freebsd.org/D22469
2019-12-11 17:37:37 +00:00
Kyle Evans
6e816d8711 sed: process \r, \n, and \t
This is both reasonable and a common GNUism that a lot of ported software
expects.

Universally process \r, \n, and \t into carriage return, newline, and tab
respectively. Newline still doesn't function in contexts where it can't
(e.g. BRE), but we process it anyways rather than passing
UB \n (escaped ordinary) through to the underlying regex engine.

Adding a --posix flag to disable these was considered, but sed.1 already
declares this version of sed a super-set of POSIX specification and this
behavior is the most likely expected when one attempts to use one of these
escape sequences in pattern space.

This differs from pre-r197362 behavior in that we now honor the three
arguably most common escape sequences used with sed(1) and we do so outside
of character classes, too.

Other escape sequences, like \s and \S, will come later when GNU extensions
are added to libregex; sed will likely link against libregex by default,
since the GNU extensions tend to be fairly un-intrusive.

PR:		229925
Reviewed by:	bapt, emaste, pfg
Differential Revision:	https://reviews.freebsd.org/D22750
2019-12-10 19:16:00 +00:00
Baptiste Daroussin
2ccdd4b39d Fix: netstat -rs
Routing statistics requires somes symbols that are only loaded when not running
live. Load them only in that specific case

PR:		242423
Submitted by:	olivier
MFC after:	3 days
2019-12-09 10:21:24 +00:00
Mark Johnston
eae3ca5a06 gcore: Avoid using vm_map_entry_t.
Use an internally defined structure instead, to avoid relying on kernel
structure details.  No functional change intended.

MFC after:	1 week
2019-12-07 20:01:55 +00:00
Mark Johnston
eee07d30a0 Fix tail -f in capability mode.
We were not adding CAP_EVENT to input file capabilities, so kevent()
always failed with ENOTCAPABLE.  tail implements a fallback mode to
poll the file in this case, so the failure was not apparent.

Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D22709
2019-12-06 23:39:38 +00:00
Greg Lehey
1952e2855a Correct date and time of George Harrison's death.
Source: https://www.beatlesbible.com/2001/11/29/george-harrison-dies/
2019-11-29 23:04:45 +00:00
Greg Lehey
52e50ad353 Clarify name of Pau Casals (it's Catalonian)
Get correct birthday (from Wikipedia).
2019-11-28 21:22:04 +00:00
Conrad Meyer
61287be181 Re-apply fixed r354847
unifdef(1): Improve worst-case bound on symbol resolution

Use RB_TREE to make some algorithms O(lg N) and O(N lg N) instead of O(N)
and O(N^2).

While here, remove arbitrarily limit on number of macros understood.

Reverts r354877 and r354878, which disabled the (correct) test.

PR:		242095
Reported by:	lwhsu
2019-11-20 19:43:34 +00:00
Conrad Meyer
0877992e6b Revert r354847 for now
It was broken.

PR:		242095
Reported by:	lwhsu
2019-11-20 19:07:22 +00:00
Alex Richardson
52918a7b1b Allow boostrapping xinstall on Linux
Linux does not have st_flags so we have to avoid using it there.

Reviewed By:	emaste, imp
Differential Revision: https://reviews.freebsd.org/D22446
2019-11-20 17:24:49 +00:00
Conrad Meyer
82e14014a3 unifdef(1): Improve worst-case bound on symbol resolution
Use RB_TREE to make some algorithms O(lg N) and O(N lg N) instead of O(N)
and O(N^2).  Because N is typically small and the former linear array also has
great constant factors (as a property of CPU caching), this doesn't provide
material benefit most or all of the time.

While here, remove arbitrarily limit on number of macros understood.
2019-11-19 04:30:23 +00:00
Conrad Meyer
3cbfa41a57 unifdef(1): Kill totally useless header
No functional change.
2019-11-19 03:15:06 +00:00
Mark Johnston
738b2d5ceb Add a "B" suffix to memory quantities in top(1) output.
Otherwise small quantities look nonsensical.  For instance, when
swapping in a single page we would print "4096 In".

Fix code indentation while here.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2019-11-18 20:55:01 +00:00
Conrad Meyer
470182bb6e Link in NetBSD's unifdef(1) tests
Skip one, is it currently fails.
2019-11-18 04:03:11 +00:00
Justin Hibbits
6a51741fc7 gcore: Don't add VSX notes on powerpcspe
powerpcspe does not support VSX at all, but gets the 'VMX' notes for free,
providing the SPE registers.
2019-11-16 18:24:28 +00:00
Brooks Davis
051ed84f28 libcompat: Correct rtld MLINKS
Don't install duplicate ld-elf.so.1.1 and ld.so.1 links in rtld-elf32.
Do install lib-elf32.so.1.1 and ldd32.1 links.

Reported by:	madpilot
2019-11-12 22:31:59 +00:00
Bjoern A. Zeeb
4df8c94283 netstat: igmp stats, error on unexpected information, not only warn
The igmp stats tend to print two lines of warning for an unexpected
version and length.  Despite an invalid version and struct size it
continues to try to do something with the data.  Do not try to parse
the remainder of the struct and error on warning.

Note the underlying issue of the data not being available properly
is still there and needs to be fixed seperately.

Reported by:	test cases, lwhsu
MFC after:	3 weeks
2019-11-12 13:57:17 +00:00
Mike Karels
7483fbadf4 Fix netstat -gs with ip_mroute module and/or vnet
The code for "netstat -gs -f inet" failed if the kernel namelist did not
include the _mrtstat symbol. However, that symbol is not in a standard
kernel even with the ip_mroute module loaded, where the functionality is
available. It is also not in a kernel with MROUTING but also VIMAGE, as
there can be multiple sets of stats. However, when running the command
on a live system, the symbol is not used; a sysctl is used. Go ahead
and try the sysctl in any case, and complain that IPv4 MROUTING is not
present only if the sysctl fails with ENOENT. Also fail if _mrtstat is
not defined when running on a core file; netstat doesn't know about vnets,
so can only work if MROUTING was included, and VIMAGE was not.

Reviewed by:	bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D22311
2019-11-12 01:03:08 +00:00
Eric van Gyzen
552117964a tip/cu: check for EOF on input on the local side
If cu reads an EOF on the input side, it goes into a tight loop
sending a garbage byte to the remote.  With this change, it exits
gracefully, along with its child.

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2019-11-11 17:41:52 +00:00
Edward Tomasz Napierala
75ad2fd059 Humanize more columns in the vmstat(8) output and adjust widths.
The few columns that are not humanized are usually 0.  This makes
the output mostly aligned.

Reviewed by:	allanjude
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D22185
2019-11-08 11:09:50 +00:00
Brooks Davis
a4330302f2 libcompat: build 32-bit rtld and ldd as part of "everything"
Alter bsd.compat.mk to set MACHINE and MACHINE_ARCH when included
directly so MD paths in Makefiles work. In the process centralize
setting them in LIBCOMPATWMAKEENV.

Alter .PATH and CFLAGS settings in work when the Makefile is included.

While here only support LIB32 on supported platforms rather than always
enabling it and requiring users of MK_LIB32 to filter based
TARGET/MACHINE_ARCH.

The net effect of this change is to make Makefile.libcompat only build
compatability libraries.

Changes relative to r354449:

Correct detection of the compiler type when bsd.compat.mk is used
outside Makefile.libcompat.  Previously it always matched the clang
case.

Set LDFLAGS including the linker emulation for mips where -m32 seems to
be insufficent.

Reviewed by:	imp, kib (origional version in r354449)
Obtained from:	CheriBSD (conceptually)
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D22251
2019-11-07 22:58:10 +00:00
Brooks Davis
ccad77fe1e Revert r354449: libcompat: build 32-bit rtld and ldd as part of "everything"
Additional testing is required..
2019-11-07 19:22:51 +00:00
Phil Shafer
67322d1642 Import libxo-1.3.1:
- handle argv[0] without '/'
- add test case for argv[0] without '/'
2019-11-07 18:06:44 +00:00
Joseph Mingrone
5e5ceb11cb Add -0 option to ENV(1)
With the -0 option added to ENV(1), some ports will no longer require genv
from sysutils/coreutils.

Reviewed by:	kevans (prior version), swills
Approved by:	bcr (manpages), imp
Differential Revision:	https://reviews.freebsd.org/D22230
2019-11-07 17:14:59 +00:00
Brooks Davis
36712a9497 libcompat: build 32-bit rtld and ldd as part of "everything"
Alter bsd.compat.mk to set MACHINE and MACHINE_ARCH when included
directly so MD paths in Makefiles work. In the process centralize
setting them in LIBCOMPATWMAKEENV.

Alter .PATH and CFLAGS settings in work when the Makefile is included.

While here only support LIB32 on supported platforms rather than always
enabling it and requiring users of MK_LIB32 to filter based
TARGET/MACHINE_ARCH.

The net effect of this change is to make Makefile.libcompat only build
compatability libraries.

Reviewed by:	imp, kib
Obtained from:	CheriBSD (conceptually)
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D22251
2019-11-07 17:10:33 +00:00
Phil Shafer
76afb20c58 Import libxo-1.3.0:
- move from "oxtradoc" to RST/Sphinx documentation
- new "csv" encoder, which allows path and leaf lists
- address warnings from PVS-Stdio tool
- add "xolint" detected errors to the documentation
2019-11-07 03:57:04 +00:00
Mark Johnston
7ef518c05a fileargs_init() sets errno on failure.
Sponsored by:	The FreeBSD Foundation
2019-11-06 01:42:30 +00:00
Kyle Evans
50dacbf6c2 patch(1): give /dev/null patches special treatment
We have a bad habit of duplicating contents of files that are sourced from
/dev/null and applied more than once... take the more sane (in most ways)
GNU route and complain if the file exists and offer reversal options.

This still falls short a little bit as selecting "don't reverse, apply
anyway" will still give you duplicated file contents. There's probably other
issues as well, but awareness is the first step to happiness.

MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D21535
2019-11-04 03:07:01 +00:00
Brooks Davis
cc86d14a47 truss: centralize pointer-constructing casts.
In nearly all cases, the caller has a uintptr_t compatible argument so
this eliminates a large number of casts.

Add a print_pointer function to centralize printing pointers.

Reviewed by:	jhb
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D22212
2019-10-31 22:29:13 +00:00
Edward Tomasz Napierala
5a84f74f5b Fix column title alignment.
MFC after:	2 weeks
2019-10-29 20:28:02 +00:00
Jeremie Le Hen
6f42902de3 Grammar fix.
Reported by:	imp
Differential Revision:	https://reviews.freebsd.org/D21880
2019-10-28 21:48:20 +00:00
Emmanuel Vadot
c571e05c2c dtc: Allow multiple dts-v1 tag
Some dts are including dtsi that also contain a /dts-v1/ tag at the
top. GNU DTC doesn't seems to have a problem with that so fix our
dtc to behave the same.

Reviewed by:	kevans
MFC after:	1 week
2019-10-26 17:10:27 +00:00
Warner Losh
dd376a963c exit requires stdlib.h to be included to use.
FreeBSD 10.3 requires this, and dtc is a bootstrap tool so it needs to compile
there.
2019-10-23 19:23:31 +00:00
Greg Lehey
67fd12c006 Correct spelling, apply appropriate respect. 2019-10-23 01:11:25 +00:00
Jeremie Le Hen
91ad311be0 Add the fstat -s option to display socket information.
Reviewed by:	jilles
MFC after:	1 week
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D21880
2019-10-19 19:52:19 +00:00
Jeremie Le Hen
ce0372d7e1 Remove IS_INADDR_ANY().
Requested by rgrimes@ in
https://lists.freebsd.org/pipermail/svn-src-head/2019-October/129784.html
2019-10-19 19:38:53 +00:00
Poul-Henning Kamp
9febfb7904 Improve the way we calculate variance to reduce the rounding errors
when variance is small relative to data points.

Now [0, 1, 2] shows same standard deviation as [10000000000000, ...1, ...2]

Also:  Various nitpickery from my own tree.
2019-10-18 07:55:01 +00:00
Dimitry Andric
fd9d16bddb Ensure lld respects the WITH/WITHOUT_SHARED_TOOLCHAIN option
Traditionally, toolchain components such as cc, as, and ld have been
built as static executables.  The WITH_SHARED_TOOLCHAIN option from
src.conf(5) is meant to link these as regular executables, e.g. using
shared libraries.

The build of ld.lld did not yet check this option.  Fix the Makefile so
it will do so now.

Reported by:	Mike Cui <cuicui@gmail.com>
PR:		241257
MFC after:	3 days
2019-10-16 17:11:18 +00:00
Brooks Davis
7c8b268a12 rpcgen: make compiler arglist allocation dynamic
Limit argmax to an absurdly large value prevent overflow (no overflow
possible on FreeBSD due to ARG_MAX).

In CheriBSD we exceed the 19 non-NULL arguments in the static array.  Add
a simple size doubling allocator and increase the default to 32.

GC remnants of support for fixed arguments.

Reviewed by:	archardson (prior version), James Clarke (prior version)
MFC after:	1 week
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D21971
2019-10-15 16:05:17 +00:00
Oleksii Samorukov
861e74ac19 Add myself (samm) to calendar.freebsd
Approved by:    araujo (mentor), krion (mentor)
Differential Revision:  https://reviews.freebsd.org/D21985
2019-10-13 18:03:23 +00:00
Justin Hibbits
942aefd567 gcore: Add powerpc64 32-bit gcore support
Summary: Add the necessary bits for taking 32-bit gcore coredumps on powerpc64.

Reviewed by:	luporl
Differential Revision:	https://reviews.freebsd.org/D21954
2019-10-11 14:17:31 +00:00
Justin Hibbits
26517dcf60 gcore: Add aarch64 32-bit core support
Summary: Add trivial 32-bit arm cores on aarch64 support for gcore.  This
doesn't handle fpregs.

Reviewed by:	#arm, andrew
Sponsored by:	Juniper Networks, Inc
Differential Revision:	https://reviews.freebsd.org/D21947
2019-10-11 14:15:50 +00:00
Jeremie Le Hen
eadfb49fe1 Add a missing macro for the previous commit (IS_INADDR_ANY()). 2019-10-09 20:05:14 +00:00
Jeremie Le Hen
b9eabd15fd Use inet_ntop(3) instead of inet_ntoa(3) for AF_INET socket details.
This also makes the code closer to the one used for AF_INET6.
2019-10-09 20:01:23 +00:00
Dimitry Andric
9122aeeaa6 Merge ^/head r353316 through r353350. 2019-10-09 16:40:22 +00:00
Brooks Davis
f189761366 Fix various -Wpointer-compare warnings
This warning (comparing a pointer against a zero character literal
rather than NULL) has existed since GCC 7.1.0, and was recently added to
Clang trunk.

Almost all of these are harmless, except for fwcontrol's str2node, which
needs to both guard against dereferencing a NULL pointer (though in
practice it appears none of the callers will ever pass one in), as well
as ensure it doesn't parse the empty string as node 0 due to strtol's
awkward interface.

Submitted by:	James Clarke <jtrc27@jrtc27.com>
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D21914
2019-10-08 21:14:09 +00:00
Dimitry Andric
8b3bc70a2b Merge ^/head r352764 through r353315. 2019-10-08 18:17:02 +00:00
Alan Somers
123d18b5c7 tftp: fix two minor Coverity CIDs
Reported by:	Coverity
CID 1394842: file descriptor leak in an error path
CID 1007603: single byte array overflow
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D21695
2019-10-03 20:22:25 +00:00
John Baldwin
fbf0f3106c Restore description of packets dropped due to full reassembly queue.
r265408 renamed tcps_rcvmemdrop to tcps_rcvreassfull and gave it a more
specific description.  r279122 (libxo-ification) reverted that change.
This commit brings it back, but with a small tweak to the description.

MFC after:	2 weeks
2019-10-03 18:24:41 +00:00
John Baldwin
214b76700c Fix a typo in a comment. 2019-10-03 18:12:34 +00:00
Kyle Evans
4f68b172e1 clang: use -mxgot for 32-bit mips
Various bits in usr.bin/clang/* will fail to compile without -mxgot due to
truncated relocations. -mxgot entails a speed penalty, but I suspect we
don't care as much about compiler performance in 32-bit mips land.

Reviewed by:	arichardson
Differential Revision:	https://reviews.freebsd.org/D21698
2019-10-02 17:15:38 +00:00
Alexander Kabaev
bcd34af473 Revert r352953: Convert pnmatch to single element array in regexec calls
Requested by: cem
2019-10-02 16:08:01 +00:00
Alexander Kabaev
c5672dd7b9 Convert pnmatch to single element array in regexec calls
The regexec function is declared as taking an array of regmatch_t
elements, and passing in the pointer to singleton element, while
correct, triggers a Coverity warning. Convert the singleton into
an array of one to silence the warning.

Reported by:	Coverity
Coverity CID:	1009732, 1009733
MFC after:	2 weeks
2019-10-02 06:15:30 +00:00
Mark Johnston
052ad61b7e Capsicumize nm(1).
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21107
2019-09-30 17:27:59 +00:00
Dimitry Andric
fc4ac32fa7 Allow entering fractional delays in top(1) interactive mode.
This uses the same logic as with the -s option, first validating the
entered value, then storing the result in a struct timeval.

MFC after:	3 days
X-MFC-With:	r352818
2019-09-27 20:53:31 +00:00
Dimitry Andric
a6f721ece8 Make fractional delays for top(1) work for interactive mode.
In r334906, the -s option was changed to allow fractional times, but
this only functioned correctly for batch mode.  In interactive mode, any
delay below 1.0 would get floored to zero.  This would put top(1) into a
tight loop, which could be difficult to interrupt.

Fix this by storing the -s option value (after validation) into a struct
timeval, and using that struct consistently for delaying with select(2).

Next up is to allow interactive entry of a fractional delay value.

MFC after:	3 days
2019-09-27 20:20:21 +00:00
Dimitry Andric
1a444441d8 Correct the final argument name in the top(1) manpage.
The description talks about 'number', while the final argument was
'count'.  Since 'count' is already used for the count of displays,
change the final argument name to 'number'.

MFC after:	3 days
2019-09-27 17:11:21 +00:00
Dimitry Andric
668ee10168 Merge ^/head r352587 through r352763. 2019-09-26 18:25:54 +00:00
David Bright
9afb12bab4 Add an shm_rename syscall
Add an atomic shm rename operation, similar in spirit to a file
rename. Atomically unlink an shm from a source path and link it to a
destination path. If an existing shm is linked at the destination
path, unlink it as part of the same atomic operation. The caller needs
the same permissions as shm_unlink to the shm being renamed, and the
same permissions for the shm at the destination which is being
unlinked, if it exists. If those fail, EACCES is returned, as with the
other shm_* syscalls.

truss support is included; audit support will come later.

This commit includes only the implementation; the sysent-generated
bits will come in a follow-on commit.

Submitted by:	Matthew Bryan <matthew.bryan@isilon.com>
Reviewed by:	jilles (earlier revision)
Reviewed by:	brueffer (manpages, earlier revision)
Relnotes:	yes
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D21423
2019-09-26 15:32:28 +00:00
Ed Maste
20bd59416d bspatch: add integer overflow checks
Introduce a new add_off_t static function that exits with an error
message if there's an overflow, otherwise returns their sum.  Use this
when adding values obtained from the input patch.

Reviewed by:	delphij, allanjude (earlier)
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7897
2019-09-26 13:27:25 +00:00
Kyle Evans
a9ac5e1424 sysent: regenerate after r352705
This also implements it, fixes kdump, and removes no longer needed bits from
lib/libc/sys/shm_open.c for the interim.
2019-09-25 18:09:19 +00:00
Kyle Evans
38325e2ab8 bsdgrep(1): various fixes of empty pattern/exit code/-c behavior
When an empty pattern is encountered in the pattern list, I had previously
broken bsdgrep to count that as a "match all" and ignore any other patterns
in the list. This commit rectifies that mistake, among others:

- The -v flag semantics were not quite right; lines matched should have been
  counted differently based on whether the -v flag was set or not. procline
  now definitively returns whether it's matched or not, and interpreting
  that result has been kicked up a level.
- Empty patterns with the -x flag was broken similarly to empty patterns
  with the -w flag. The former is a whole-line match and should be more
  strict, only matching blank lines. No -x and no -w will will match the
  empty string at the beginning of each line.
- The exit code with -L was broken, w.r.t. modern grep. Modern grap will
  exit(0) if any file that didn't match was output, so our interpretation
  was simply backwards. The new interpretation makes sense to me.

Tests updated and added to try and catch some of this.

This misbehavior was found by autoconf while fixing ports found in PR 229925
expecting either a more sane or a more GNU-like sed.

MFC after:	1 week
2019-09-25 17:14:43 +00:00
Dimitry Andric
f05b9584fa Merge ^/head r352537 through r352586. 2019-09-21 21:02:57 +00:00
Mateusz Piotrowski
a811237df2 jot.1: Explain default argument values more precisely
The way jot(1) defaults missing arguments doesn't match the behaviour
described in the manpage, which states that with fewer than 3 arguments
missing values are supplied from left to right.

In fact, with one or two arguments, the last (s which is step size or seed)
defaults to 1 (or -1 if begin and end specify a descending range), and then
omitted arguments are set to default starting with the leftmost until three
arguments are available.

This is why `jot 2 1000` prints 1000 and 1001 instead of 1000 and 100.

PR:		135475
Submitted by:	Jonathan McKeown <j.mckeown@ru.ac.za>
Approved by:	doc (bcr)
Differential Revision:	https://reviews.freebsd.org/D21736
Event:		EuroBSDcon 2019
2019-09-21 15:01:11 +00:00
Hiroki Sato
ecc2b89f96 Impove wording and move descriptions about
locale to LC_CTYPE in the ENVIRONMENT section.
2019-09-21 00:44:37 +00:00
Hiroki Sato
740a5434e9 Add a workaround for servers which respond RPC_PROGNOTREGISTERED
to a clnt_create() call even when it is actually a program
version mismatch.

Normally the server is supposed to return RPC_PROGVERSMISMATCH
when it supports the specified program but not support
the specified version.  Some filers return RPC_PROGNOTREGISTERED
to RQUOTA v2 calls and FreeBSD does not retry with the old
v1 calls.  This change fixes this failure scenario.

Submitted by:	Jian-Bo Liao
PR:		236179
2019-09-21 00:17:40 +00:00
Daichi GOTO
b1de37fadd top(1): support multibyte characters in command names (ARGV array)
depending on locale.

 - add setlocale()
 - remove printable() function
 - add VIS_OCTAL and VIS_SAFE to the flag of strvisx() to display
   non-printable characters that do not use C-style backslash sequences
   in three digit octal sequence, or remove it

This change allows multibyte characters to be displayed according to
locale. If it is recognized as a non-display character according to the
locale, it is displayed in three digit octal sequence.

Reference:
https://www.mail-archive.com/svn-src-all@freebsd.org/msg165751.html
https://www.mail-archive.com/svn-src-all@freebsd.org/msg165766.html
https://www.mail-archive.com/svn-src-all@freebsd.org/msg165833.html
https://www.mail-archive.com/svn-src-all@freebsd.org/msg165846.html
https://www.mail-archive.com/svn-src-all@freebsd.org/msg165891.html

Submitted by: hrs
Differential Revision: https://reviews.freebsd.org/D16204
2019-09-20 17:37:23 +00:00
Dimitry Andric
0f80acb965 Merge ^/head r352436 through r352536. 2019-09-19 19:26:12 +00:00
Konstantin Belousov
43ce0d902c truss: decode sysctl names.
Submitted by:	Pawel Biernacki
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D21688
2019-09-18 16:15:05 +00:00
Dimitry Andric
419f843fff Merge ^/head r352319 through r352435. 2019-09-17 06:08:15 +00:00
Dmitri Goutnik
26a9d16680 Add myself (dmgk) to calendar.freebsd
Approved by:	tz (mentor)
Differential Revision:	https://reviews.freebsd.org/D21675
2019-09-16 20:43:20 +00:00
Dimitry Andric
61c1328eb0 Merge ^/head r352105 through r352307. 2019-09-13 21:15:01 +00:00
Baptiste Daroussin
17f3442729 Remove remnant from the pre LIBADD era 2019-09-13 14:51:00 +00:00
Yuri Pankov
eb6dbc2271 locale: initialize variables to make gcc happy
Reported by:	jenkins
2019-09-11 16:00:03 +00:00
Yuri Pankov
de96322b74 locale: more output fixes
- make abday, day, abmon, mon, am_pm output quoting match linux
- workaround localeconv() issue for mon_grouping and grouping (PR172215)
- for other values not available in default locale, output -1 instead of
  127 (CHAR_MAX) as returned by localeconv()

With these changes, output of `locale` and `locale -k` for all keywords
specified by POSIX exactly matches the linux one.

PR:		237752
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D21599
2019-09-11 15:39:28 +00:00
Yuri Pankov
42249ef234 locale: handle day, abday, mon, abmon, am_pm keywords
All of these are defined as mandatory by POSIX.

While here, mark all non-standard ones as FreeBSD-only as
other systems (at least, GNU/Linux and illumos) do not handle
them, so we should not encourage their use.

PR:		237752
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D21490
2019-09-10 15:09:46 +00:00
Baptiste Daroussin
c844ab6717 Remove mklocale(1) and colldef(1) which are deprecated since FreeBSD 11
In FreeBSD 11 along with the rework on the collation, mklocale(1) and colldef(1)
has been replaced by localedef(1) (a note has been added to the manpage to state
it).
mklocale(1) and colldef(1) has been kept around to be able to build older
versions of FreeBSD. None of the version requiring those tools are supported
anymore so it is time to remove them from base
2019-09-10 07:54:49 +00:00
Gleb Smirnoff
e67975d331 Fix 'calendar -a' in several ways.
o Do not run any iconv() processing in -a. The locale of root user is not
  what is desired by most of the users who receive their calendar mail.
  Just assume that users store their calendars in a format that is readable
  to them. This fixes regression from r344340.
o fork() and setusercontext(LOGIN_SETALL) for every user. This makes LANG
  set inside a calendar file mostly excessive, as we will pick up user's
  login class LANG.
o This also executes complex function cal() that parses user owned files
  with appropriate user privileges.
  Previously it was run with privileges dropped only temporary for execution
  of cal(), and fully dropped only before invoking sendmail (see r22473).

Reviewed by:	bapt (older version of patch)
2019-09-10 04:21:48 +00:00
Gleb Smirnoff
1e01d2dcac Remove pointless playing with LC_TIME, which should have been done in r205821. 2019-09-10 04:01:41 +00:00
Dimitry Andric
f993ed2fbd Merge ^/head r351732 through r352104. 2019-09-09 19:58:46 +00:00
Baptiste Daroussin
c57596e1ae m4: import from OpenBSD
By deraadt@

mkstemp() returns -1 on failure

Obtained from:	OpenBSD
2019-09-09 15:37:40 +00:00
Baptiste Daroussin
db531a5d18 m4: import from OpenBSD
patch by espie@

replace sloppy parsing of numeric values with strtonum (incr, decr, divert)

still use integers, so use the natural bounds for these.

POSIX says m4 should error when these use non numeric values, and now they
do.

okay millert@

Obtained from:	OpenBSD
2019-09-09 15:35:34 +00:00
Baptiste Daroussin
e0f4e0415e m4: import patch from OpenBSD
by espie@
ifelse is special, fix argv parsing to avoid segfault

problem noticed by Matthew Green (netbsd), slightly different fix
so that argc counting makes more sense.

we might want to warn on wrong number of parameters later, but this is
somewhat inconsistent depending on the builtin right now.

okay millert@

Obtained from:	OpenBSD
2019-09-09 15:28:22 +00:00
Baptiste Daroussin
fdb905e20f m4: import patch from OpenBSD
Use waitpid()/EINTR idiom for the specific pid, rather than generic wait()

Patch by: deraadt@

Obtained from:	OpenBSD
2019-09-09 15:24:48 +00:00
Baptiste Daroussin
d031bd192e Import from OpenBSD a patch which eliminates the link with -ly or -ly
patch by ibara@

Obtained from:	OpenBSD
2019-09-09 15:20:19 +00:00
Baptiste Daroussin
c560b67c5c Import from OpenBSD: -E flag
Add -E flag (make warnings fatal), following the behavior of GNU m4 1.4.9+

Help and direction millert@ espie@ anton@ deraadt@

ok espie@

Obtained from:	OpenBSD
2019-09-09 15:18:04 +00:00
Kyle Evans
89b5571e0b patch(1): fix the file removal test, strengthen it a bit
To remain compatible with GNU patch, we should ensure that once we're
removing empty files after a reversed /dev/null patch we don't remove files
that have been modified. GNU patch leaves these intact and just reverses the
hunk that created the file, effectively implying --remove-empty-files for
reversed /dev/null patches.
2019-09-05 15:35:57 +00:00
Emmanuel Vadot
a7b5a3d486 pkgbase: Put a lot of binaries and lib in FreeBSD-runtime
All of them are needed to be able to boot to single user and be able
to repair a existing FreeBSD installation so put them directly into
FreeBSD-runtime.

Reviewed by:    bapt, gjb
Differential Revision:  https://reviews.freebsd.org/D21503
2019-09-05 14:13:08 +00:00
Kyle Evans
b27524973c patch(1): add some basic tests
Summary:
- basic: test application of patches created by diff -u at the
  beginning/middle/end of file, which have differing amounts of context
  before and after chunks being added
- limited_ctx: stems from PR 74127 in which a rogue line was getting added
  when the patch should have been rejected. Similar behavior was
  reproducible with larger contexts near the beginning/end of a file. See
  r326084 for details
- file_creation: patch sourced from /dev/null should create the file
- file_nodupe: said patch sourced from /dev/null shouldn't dupe the contents
  when re-applied (personal vendetta, WIP, see comment)
- file_removal: this follows from nodupe; the reverse of a patch sourced
  from /dev/null is most naturally deleting the file, as is expected based
  on GNU patch behavior (WIP)
2019-09-05 03:16:14 +00:00
Jilles Tjoelker
ddc0daea20 procstat/tests: Fix flakiness by waiting for program to start
Some of the procstat tests start a program "while1" and examine the process
using procstat, but did not wait properly for it to start (kill -0 will
succeed immediately after the child process has been created).

Instead, have "while1" write something when it starts, and use a fifo to
wait for that.

PR:		233587, 233588
Reviewed by:	ngie
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D21519
2019-09-04 16:25:41 +00:00
Sevan Janiyan
08509077b3 Adjust history, info source from v1's manuals
https://www.bell-labs.com/usr/dmr/www/1stEdman.html

MFC after:	5 days
2019-09-04 13:44:46 +00:00
Konstantin Belousov
c22994e3ad Add stackgap control mode to proccontrol(1).
PR:	239894
Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D21352
2019-09-03 18:58:48 +00:00
Kyle Evans
aef64c62c2 bsdgrep(1): add some basic tests for some GNU Extension support
These will be expanded later as I come up with good test cases; for now,
these seem to be enough to trigger bugs in base gnugrep and expose missing
features in bsdgrep.
2019-09-03 18:32:29 +00:00
Dimitry Andric
c5c3ba6b43 Merge ^/head r351317 through r351731. 2019-09-03 05:58:43 +00:00
Mark Johnston
c993b95329 Fix an off-by-one bug in the CPU and domain ID parser.
The "size" parameter is the size of the corresponding bit set, so the
maximum CPU or domain index is size - 1.

MFC after:	1 week
2019-09-01 21:20:31 +00:00
Ed Maste
597d9b4008 ar: use more correct size_t type for loop index
Submitted by:	cem
MFC after:	1 week
2019-09-01 16:51:25 +00:00
Jason Helfman
7d5b071384 - address missing whitespace for indent
PR:		239727
Submitted by:	gbergling@gmail.com
Reviewed by:	0mp@
MFC after:	1 week
2019-08-29 23:23:12 +00:00
Mike Karels
ae3353515b Fix address annotation in xml output from w
The libxo xml feature of adding an annotation with the "original"
address from the utmpx file if it is different than the final "from"
field was broken by r351379. This was pointed out by the gcc error
that save_p might be used uninitialized. Save the original address
as needed in each entry, don't just use the last one from the previous
loop.

Reviewed by:	marcel@
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D21390
2019-08-29 02:44:18 +00:00
Mark Johnston
69ac7c7671 Install all bzip2.1 MLINKs from the same place.
Reported by:	antoine
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2019-08-28 21:01:51 +00:00
Dimitry Andric
a32f82c2c1 Update build glue for a build of clang plus lldb (enabled via MK_LLDB). 2019-08-26 21:00:14 +00:00
Dimitry Andric
560bf0c7df Add lldb-tblgen tool. 2019-08-26 20:57:45 +00:00