Commit Graph

14271 Commits

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