Commit Graph

13990 Commits

Author SHA1 Message Date
John Hixson
d7aabdd96c Add jhixson to committers-ports.dot and calendar.freebsd
Approved by:	miwi (mentor), kmoore (mentor), araujo (mentor)
Differential Revision:	https://reviews.freebsd.org/D16424
2018-07-24 18:33:26 +00:00
Alan Somers
ca2d3691c3 Fix several Coverity warnings in tftp
Some of the changes are in the libexec/tftpd directory, but to functions that
are only used by tftp(1) (they share some code).

* strcpy => strlcpy (1006793, 1006794, 1006796, 1006741)
* Unchecked return value and TOCTTOU (1009314)
* NULL pointer dereference (1018035, 1018036)

Reported by:	Coverity
CID:		1006793, 1006794, 1006796, 1006741, 1009314, 1018035
CID:		1018036
MFC after:	2 weeks
2018-07-22 17:10:12 +00:00
Konstantin Belousov
abbe7d5acd Move mostly useless examples binaries from OFED, as well as the Subnet
Manager, under the new option WITH_OFED_EXTRA, disabled by default.

Reviewed by:	bdrewery, hselasky (previous version)
Sponsored by:	Mellanox Technologies
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D16230
2018-07-20 23:52:11 +00:00
Zach Leslie
3d718b884f Add myself (zleslie) to calendar.freebsd
PR:		D15896
Approved by:	swills(mentor)
2018-07-19 04:31:41 +00:00
Piotr Pawel Stefaniak
01c66110e1 indent(1): rewrite the integer/floating constant scanning part of lexi.c
Remove procedural code that did the scanning, which was faulty and didn't
support complex constants such as 0x1p-61. Replace it with a finite state
machine expressed as a transition table. The table was rewritten by hand
from lx's output, given parts of grammar expressed as regular expressions.

lx is Katherine Flavel's lexer generator, currently available at
https://github.com/katef/libfsm and the parts of grammar were taken from
http://quut.com/c/ANSI-C-grammar-l-2011.html and extended to support binary
integer constants which are a popular GCC extension.

Reported by:	bde
2018-07-16 05:46:50 +00:00
Piotr Pawel Stefaniak
89463812e3 indent(1): move case_indent from parser state to the options struct
This was missed in r334927.
2018-07-15 21:04:21 +00:00
Konstantin Belousov
b3042426d0 Remove bits of the old NUMA.
Remove numactl(1), edit numa(4) to bring it some closer to reality,
provide libc ABI shims for old NUMA syscalls.

Noted and reviewed by:	brooks (previous version)
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D16142
2018-07-10 22:00:20 +00:00
Mark Johnston
04354d577d Fix thread state summary line display after r334918. 2018-07-10 17:20:27 +00:00
Brooks Davis
3a20f06a1c Use uintptr_t alone when assigning to kvaddr_t variables.
Suggested by:	jhb
2018-07-10 13:03:06 +00:00
Daichi GOTO
7452122499 top(1): rollback r335836
Encoding-specific processing introduced in r335836 is not recommended.
And doing getenv("LANG") and assuming an encoding based on it is a
very bad practice to internationalize software.

Submitted by:	hrs
Differential Revision:	https://reviews.freebsd.org/D16203
2018-07-10 03:49:48 +00:00
Xin LI
34e314e794 Use endian.h le32dec() instead of rolling our own.
Suggested by:	phk
Reviewed by:	imp, pfg
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D16192
2018-07-10 01:42:28 +00:00
Daichi GOTO
5c48c1ee57 top(1): Fix the prompt bug and core dump problem in o / p mode that occurred by r336028
Reviewed by:	cy
Approved by:	gnn (mentor)
Differential Revision:	https://reviews.freebsd.org/D16174
2018-07-10 00:19:52 +00:00
Pedro F. Giffuni
add14e43f8 localedef(1): remove duplicated includes.
Hinted by:	DragonFlyBSD
2018-07-09 20:38:47 +00:00
Pedro F. Giffuni
51a8f735f8 sed(1): Suppress implicit-fallthrough.
Apparently some tools are not able to determine if all the cases of a
switch are covered. Make use of the attribute for cases like this.

Hinted by:	DragonFlyBSD GGC8 (but fixed differently)

CID:	976552
2018-07-09 20:27:31 +00:00
Emmanuel Vadot
1017327049 truncate: Add support for -s % and /
% round up to the multiple size and / round down
This is compatible with gnu truncate.
Add tests and document in the man page.
2018-07-09 19:03:30 +00:00
Emmanuel Vadot
dde27dbc9b truncate: style(9) some parts 2018-07-09 19:02:05 +00:00
Conrad Meyer
e76247cd60 gzip(1): Don't shadow global 'err'
Unbreak work build on ppc due to -Werror=shadow.  Introduced in r336121.

X-MFC-With:		r336121
2018-07-09 08:37:55 +00:00
Xin LI
b393a8ace6 Don't delete outfile unconditionally.
MFC after:	1 month
2018-07-09 06:19:33 +00:00
Pedro F. Giffuni
3fcbc83d04 gzip: fix for undefined behavior.
Unportable left shift reported with MKSANITIZER=yes
USE_SANITIZER=undefined:

# progress -zf ./games.tgz  tar -xp -C "./" -f -
/public/src.git/usr.bin/gzip/gzip.c:2126:33: runtime error: left shift of
251 by 24 places cannot be represented in type 'int'
100%
|****************************************************************************************************************|
44500 KiB  119.69 MiB/s    00:00 ETA

Refactor the following code into something that is more clear
and fix signed integer shift, by casting all buf[] elements to
(unsigned int):

unsigned char buf[8];
uint32_t usize;
[...]
else {
    usize = buf[4] | buf[5] << 8 |
            buf[6] << 16 | buf[7] << 24;
[...]

New version:

    usize = buf[4];
    usize |= (unsigned int)buf[5] << 8;
    usize |= (unsigned int)buf[6] << 16;
    usize |= (unsigned int)buf[7] << 24;

Only the "<< 24" part needs explicit cast, but for consistency make the
integer promotion explicit and clear to a code reader.

Sponsored by <The NetBSD Foundation>

Obtained from:	NetBSD (CVS rev. 1.113)
MFC after:	1 week
2018-07-08 22:39:33 +00:00
Jamie Gritton
8169574768 Missed a bit of doc change from r335921.
PR:		229266
2018-07-06 16:23:30 +00:00
Ben Widawsky
29e44344da Adding myself to committers-src.dot and calendar.freebsd
Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D16154
2018-07-06 16:22:26 +00:00
Sean Bruno
9d5352cb63 r336028 changed next_msg to a char * from char [] of fixed size. Change
2nd argument of vsnprintf() to get the strlen of next_msg so that the
appropriate size is used.

Found with gcc.

/usr.bin/top/display.c: In function 'new_message':
/usr.bin/top/display.c:963:31: error:
argument to 'sizeof' in 'vsnprintf' call is the same expression as the
destination; did you mean to provide an explicit length?
[-Werror=sizeof-pointer-memaccess]
     vsnprintf(next_msg, sizeof(next_msg), msgfmt, args);

Reviewed by:	daichi
2018-07-06 13:22:44 +00:00
Daichi GOTO
0a59db87e3 Changed to eliminate the upper limit of command length displayed
by "-a" and expand to match terminal width

Reviewed by:	eadler
Approved by:	gnn (mentor)
Differential Revision:	https://reviews.freebsd.org/D16083
2018-07-06 12:07:06 +00:00
Sean Eric Fagan
aad5531e71 This exposes ZFS user and group quotas via the normal
quatactl(2) mechanism.  (Read-only at this point, however.)
In particular, this is to allow rpc.rquotad query quotas
for NFS mounts, allowing users to see their quotas on the
hosts using the datasets.

The changes specifically:

* Add new RPC entry points for querying quotas.
* Changes the library routines to allow non-UFS quotas.
* Changes rquotad to check for quotas on mounted filesystems,
rather than being limited to entries in /etc/fstab
* Lastly, adds a VFS entry-point for ZFS to query quotas.

Note that this makes one unavoidable behavioural change: if quotas
are enabled, then they can be queried, as opposed to the current
method of checking for quotas being specified in fstab.  (With
ZFS, if there are user or group quotas, they're used, always.)

Reviewed by:	delphij, mav
Approved by:	mav
Sponsored by:	iXsystems Inc
Differential Revision:	https://reviews.freebsd.org/D15886
2018-07-05 22:56:13 +00:00
Brooks Davis
f6293d7296 Work around lame warnings in ancient gcc on 32-bit platforms.
Fixes r335979.
2018-07-05 17:02:10 +00:00
Brooks Davis
f38b68ae8a Make struct xinpcb and friends word-size independent.
Replace size_t members with ksize_t (uint64_t) and pointer members
(never used as pointers in userspace, but instead as unique
idenitifiers) with kvaddr_t (uint64_t). This makes the structs
identical between 32-bit and 64-bit ABIs.

On 64-bit bit systems, the ABI is maintained. On 32-bit systems,
this is an ABI breaking change. The ABI of most of these structs
was previously broken in r315662.  This also imposes a small API
change on userspace consumers who must handle kernel pointers
becoming virtual addresses.

PR:		228301 (exp-run by antoine)
Reviewed by:	jtl, kib, rwatson (various versions)
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D15386
2018-07-05 13:13:48 +00:00
Konstantin Belousov
f87a5f036b top: do not fall to the thread name if kernel cache of the process
args is empty.

Instead, use kvm_getargv() unconditionally to obtain the process
arguments.  It means that one additional sysctl(2) is performed there.

Submitted by:	Thomas Munro
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D16111
2018-07-04 13:28:16 +00:00
Jamie Gritton
de68a3200a Allow jail names (not just IDs) to be specified for: cpuset(1), ipfw(8),
sockstat(1), ugidfw(8)
These are the last of the jail-aware userland utilities that didn't work
 with names.

PR:		229266
MFC after:	3 days
Differential Revision:	D16047
2018-07-03 23:47:20 +00:00
Jilles Tjoelker
8f8092f8e7 rup: Fix -Wcast-align warnings
Fix possible strict aliasing issue (if time_t is the same size as int but
not int but for example long) which also resulted in a false positive
warning on systems with 64-bit time_t. Pointer casts are bad; we can just
copy the time_t.

Elsewhere, avoid casting char * to int * by using memcpy().

Reviewed by:	eadler
Differential Revision:	https://reviews.freebsd.org/D16075
2018-07-03 19:09:46 +00:00
Ruslan Bukin
c6dc704e84 Fix build: utf8strvisx() does signed data comparisons, but 'char' type
is unsigned in riscv GCC, so use guaranted signed char type.

Sponsored by:	DARPA, AFRL
2018-07-03 14:32:15 +00:00
Cy Schubert
4ee90e6e20 When toggling the display using the "m" command to toggle from 'cpu'
mode to 'io' mode, an artifact remains because the buffer is not
"finished" with a NULL terminator using sbuf_finish().

An example of this is, when the "m" command is entered, the title line
will contain COMMANDND instead of COMMAND. This commit fixes this.
2018-07-03 02:54:32 +00:00
Eitan Adler
9fe7e0020a find(1): use correct type for readlink 2018-07-01 20:09:56 +00:00
Eitan Adler
b422540a99 find(1): deLINTify 2018-07-01 20:09:52 +00:00
Eitan Adler
39d2eb75fc top(1): permit infinite length for command
There isn't any need to limit the size of the screen. Utilities like
'less -S' don't have a (meaningful) limit anyways.  This also makes the
way to dynamically changing the column widths based on the screen width.
2018-07-01 19:44:29 +00:00
Eitan Adler
06668f7f65 find(1): remove portability ifdefs
This code isn't designed to be particularly portable outside of FreeBSD.
To be more specific it doesn't make much sense to support compiling
find(1) on VMS.
2018-07-01 19:44:26 +00:00
Daichi GOTO
4417ed2dbf top(1) - support UTF-8 display
Reviewed by:	eadler
Approved by:	gnn (mentor)
Differential Revision:	https://reviews.freebsd.org/D16006
2018-07-01 05:32:03 +00:00
Brad Davis
f59e535254 Simplify using bsd.endian.mk and have it provide CAP_MKDB_ENDIAN, since it is
the most common usage.

Approved by:	bapt (mentor)
2018-06-28 13:48:59 +00:00
Bryan Drewery
96a0acc4ce Don't use CCACHE for linking.
MFC after:	2 weeks
Sponsored by:	Dell EMC
2018-06-27 19:29:15 +00:00
Daichi GOTO
612e0030b6 top(1): increased the maximum length of command shown by "-a"
Reviewed by:	eadler
Approved by:	gnn (mentor)
Differential Revision:	https://reviews.freebsd.org/D16006
2018-06-27 02:55:30 +00:00
Eitan Adler
b1ba4c4472 rusers: modernize a bit 2018-06-25 11:44:56 +00:00
Eitan Adler
7f08b09a0e rup: compile with WARNS=6 2018-06-25 11:44:53 +00:00
Eitan Adler
bec6dc30e1 users(1): Use capsicum helpers for users
In doing so also fix the libcasper.h header to work in C++.
2018-06-25 11:44:41 +00:00
Eitan Adler
8d3f65e767 top(1): increase field with width for W/CPU column
This allows 3 digit CPU columns to look nice

Reported by:	feld
2018-06-24 13:14:04 +00:00
Eitan Adler
aa571745a6 Makefiles: remove outdated comments 2018-06-24 09:39:40 +00:00
Eitan Adler
db36566345 top(1): Restructure printing of process states
This avoids the need to have separate buffers and calls to sprintf for
various calls.
2018-06-23 22:45:22 +00:00
Eitan Adler
0515b88e77 top(1): Convert process listing to sbuf too
This also fixes -mio with 'T' set (thread-id instead of process-id).

This can go further by removing the existing sprintf, and using sbuf
directly. This will be done in a followup commit.
2018-06-23 22:45:20 +00:00
Eitan Adler
ac8f40ea78 top(1): Use basename instead of a homegrown alternative 2018-06-23 22:45:18 +00:00
Eitan Adler
becfb1625c top(1): show CPU state breakdown on first run
There is no documented reason for this not to be shown on the first run.
I can't find any good reason, and it breaks batch mode.

PR:		218889
Submitted by:	"Jeremy C. Reed" <reed@reedmedia.net>
2018-06-23 03:17:11 +00:00
Eitan Adler
00abcb6acd top(1): increase warnings
top(1) now builds without cast-qual warnings, so remove the exemption
for that.

Tested with clang, gcc7, gcc9
2018-06-22 10:20:21 +00:00
Eitan Adler
8caf462ef6 top(1): garbage collect
- remove a now-unused function
- remove needless indirection of handle type
2018-06-22 10:17:12 +00:00
Eitan Adler
d9cf8a13ca top(1): increase size of 'C' column
On machines with more than 99 CPUs make room to display the entire
number.

Requested by:	cperciva
2018-06-22 10:17:10 +00:00
Eitan Adler
5c66dcc072 top(1): remove special handling of load > 5
When the load is "high" (an arbitrary value) top(1) previously moved the
cursor to the top-left of the screen as an acknowledgment. In practice,
on modern machines, even relatively slow ones, it looked more like a
glitch. Remove the logic.
2018-06-22 09:45:18 +00:00
Eitan Adler
51c834c490 top(1): reimplement header formatting as sbuf
The current header formatting is a giant format string that changes
global state during the format process.

Make the following changes:
- use sbuf to build up the header rather than use the above
pseudo-dynamic one
- Change name length to 10
- Reduce size of RES and SIZE by making humanize more aggressive
- Restore a version number line to the copyright. This may be required
by the copyright (and may not be; its unclear)

This is also a pre-req to implementing TOPCOLOR from newer versions of
top(1)

Discussed with:	allanjude, rpolka, danfe, rgrimes
Differential Revision: https://reviews.freebsd.org/D15801
2018-06-22 09:21:01 +00:00
Eitan Adler
520c8e1852 su(1): build with WARNS=6
Tested with full make universe
2018-06-22 09:10:50 +00:00
Eitan Adler
57ad79afd6 top(1): behave as documented for -t
Show top itself by default, unless -t is specified.
2018-06-22 00:02:36 +00:00
Ed Maste
9b844631a6 Rename usr.bin/elfcopy to usr.bin/objcopy
We always install ELF Tool Chain's elfcopy as objcopy, so to avoid
confusion rename the src directory containing our reach-over Makefile
to match.

Requested by:	jhb
Sponsored by:	The FreeBSD Foundation
2018-06-21 14:28:20 +00:00
Xin LI
80cb4b11eb Don't leak tmpstr.
MFC after:	2 weeks
2018-06-21 07:42:28 +00:00
Ed Maste
be72428e54 usr.bin/ar: use standard 2-Clause FreeBSD license
Many licenses on ar files contained small variations from the standard
FreeBSD license text. To avoid license proliferation switch to the usual
2-clause FreeBSD license after obtaining permission from all copyright
holders.

Approved by:	jkoshy, kaiw, kientzle
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D14561
2018-06-20 18:43:17 +00:00
Bryan Drewery
d74021d65b Rework how the ld link is handled in WORLDTMP from r322811.
LLD_BOOTSTRAP (build) is independent of LLD_IS_LD (installed) so they
should not be based on each other.

This is related to upcoming WITH_SYSTEM_LINKER work.

Reviewed by:	emaste
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D15836
2018-06-20 16:10:02 +00:00
Kyle Evans
7137597e15 sort(1): Fix -m when only implicit stdin is used for input
Observe:

printf "a\nb\nc\n" > /tmp/foo
# Next command results in no output
cat /tmp/foo | sort -m
# Next command results in proper output
cat /tmp/foo | sort -m -
# Also works:
sort -m /tmp/foo

Some const'ification was done to simplify the actual solution of adding "-"
explicitly to the file list if we didn't have any file arguments left over.

PR:		190099
MFC after:	1 week
2018-06-20 03:31:19 +00:00
Kyle Evans
36180cd53d sort(1): Add bits to allow easy checking against NetBSD tests
I'm looking at sort(1) failures, for better or worse.
2018-06-20 03:10:49 +00:00
Mariusz Zaborski
a3552326dc Use capsicum helpers to cache NLS data. 2018-06-20 00:13:09 +00:00
Mariusz Zaborski
7672a0148f Convert cap_enter() < 0 && errno != ENOSYS to caph_enter() < 0.
No functional change intended.
2018-06-19 23:43:14 +00:00
Eitan Adler
3edda95c9d top(1): fix top -mio 2018-06-19 23:30:55 +00:00
Alan Somers
aa9d9bfa90 top(1): Fix Coverity warning
Don't call strerror on negative errnos

Reported by:	Coverity
CID:		976708
Reviewed by:	eadler
Differential Revision:	https://reviews.freebsd.org/D15909
2018-06-19 18:32:06 +00:00
Ed Maste
9befbe457c usr.bin/ar: remove incorrect SPDX tags
Three ar files have a non-standard variation of the BSD license, so
remove their SPDX tags.

Sponsored by:	The FreeBSD Foundation
2018-06-19 17:30:11 +00:00
Ed Maste
25f82d56c7 usr.bin/ar: use standard 2-Clause FreeBSD license
Many licenses on ar files contained small variations from the standard
FreeBSD license text. To avoid license proliferation switch to the usual
standard 2-clause FreeBSD license for those files where I have obtained
permission from all of the listed copyright holders.

Approved by:	jkoshy, kaiw
Differential Revision:	https://reviews.freebsd.org/D14561
2018-06-19 17:28:05 +00:00
Eitan Adler
cc11473037 top(1): correct assertion 2018-06-19 05:01:07 +00:00
Eitan Adler
e59ba74961 top(1): correct header in UP mode
Fix an oversight from r334869 which made the same change, but only for
SMP systems. This avoids a segfault while D15801 is being reviewed.

Reviewed by:	kevans
2018-06-19 04:18:23 +00:00
Eitan Adler
31b998816c dc: make use of caph_enter
We already use caph library so this makes sense.
2018-06-18 04:54:09 +00:00
Eitan Adler
6bb0d5cf77 top(1): use more modern signal code
Rather than manually build signal masks use functions designed for that
reason. Also use sigprocmask instead of sigblock.
2018-06-18 02:06:16 +00:00
Eitan Adler
943a127c89 units: fix some nits
- prefer braces to abusing the `,` operator
- mark dead function as dead
- remove dead break
2018-06-16 21:07:46 +00:00
Konstantin Belousov
f39bffc62c Rework ofed build.
Aligns the build with the FreeBSD traditional approach to not build in
contrib/, and to track inter-dependencies between libraries.

With help from:	bdrewery
Reviewed by:	bdrewery, hselasky
Sponsored by:	Mellanox Technologies
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D15648
2018-06-16 15:05:05 +00:00
Ed Maste
fd897a5340 ldd: reference readelf instead of objdump in warning message
We have an obsolete GNU objdump 2.17.50 in the base system, which will
be removed in the future.  Suggest readelf(1) for examining ELF files
instead; for most use cases it is the preferred tool anyhow.

PR:		229046
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2018-06-15 16:28:50 +00:00
Kyle Evans
031f92f512 bsdgrep(1): Remove redundant initialization; unconditionally assigned later 2018-06-15 03:31:30 +00:00
Eitan Adler
ef8dcce3c2 top(1): remove myself from top.1
I wrote some, but not enough for the man page.
2018-06-14 12:14:51 +00:00
Allan Jude
21e289d49b Fix top(1) support for displaying ZFS Compressed ARC statistics
Broken in r334514

sysctlbyname("vfs.zfs.compressed_arc_enabled", ...) would return ENOMEM
while trying to read the sysctl (a boolean_t) into a bool, which is too small.

Reviewed by:	jhb (on irc)
Sponsored by:	Klara Systems
2018-06-14 00:10:16 +00:00
Eitan Adler
f764243341 top(1): remove unneeded logic
- remove __pure annotations I added earlier for some functions. One
writes to the the arguments as "out" pointers. The
other reads from an array, which while const within the function might
be mutated externally.
- total_change is modified to be at 1, if previously 0, so no if check
is needed.
2018-06-13 11:12:52 +00:00
Eitan Adler
1de6384221 top(1): style(9)
- split return type from function name
- Sprinkle a __pure where possible.
2018-06-13 08:52:22 +00:00
Eitan Adler
d18626664a top(1): add myself to authors
At this point I've mucked enough with top(1) that all bugs should be
blamed on me rather than William LeFebvre.
2018-06-13 08:52:19 +00:00
Eitan Adler
c655e639c2 top(1): shift from atoi to non-deprecated function 2018-06-13 08:52:14 +00:00
Eitan Adler
704daa9b87 top(1): replace homegrown itoa with sprintf
Much of this should be inlined to the callsite, but leave it here for
now to make it easier to make it easier bisect later.
2018-06-13 08:52:12 +00:00
Eitan Adler
8e4b205ea5 top(1): format_time, format_k, etc.
- Use humanize_number for format_k and format_k2
- Fix some style nits in format_time
2018-06-13 08:52:09 +00:00
Eitan Adler
e7cb1c0776 top(1): format help more nicely
For entries that are duplicates present them nicely rather than showing
two identical help entries. For ' ' present it as SPC
2018-06-13 08:52:06 +00:00
Eitan Adler
baab2cf821 vmstat(1): various nits
Continue my parade on introspection tools by fixing:
- failed to check for null after reallocf
- avoid the comma operator
- mark usage as dead
- correct size of len
2018-06-13 08:52:04 +00:00
Eitan Adler
59c50d8277 top(1): several small bugfixes and nits
- initialize all maybe uninitialized vars with bogus values. This shuts
up the compiler, and causes crashes if it changes later.
- mark noreturn as noreturn
- removed unused macro
- handle x_procstate as runtime rather than pre-processor
- avoid using void functions in condtionals

Tested with clang, gcc 7, gcc 9
2018-06-13 00:45:38 +00:00
Baptiste Daroussin
43d7b1c097 Fix memory leak
CID:		1393352
2018-06-12 16:42:11 +00:00
Baptiste Daroussin
5a43dca273 Correctly test return value of pipe(2)
CID:		1393351
2018-06-12 16:40:22 +00:00
Eitan Adler
0ff79d817c top(1): remove trailing whitespace 2018-06-12 07:31:59 +00:00
Eitan Adler
ccf22059e0 top(1): style and related
- style(9)
- remove now-defunct comments
- remove getuid check for low delay
- expand range of format_k
2018-06-12 07:14:12 +00:00
Eitan Adler
c8aa5e526f top(1): move command mapping to commands.c
This eliminates the difficult to follow mapping of a string list. It
moves numbers from "#define" into (more) debuggable enums. More
generally, it follows the trend of moving more data into a more central
mechanism.

The help output is a little worse: " " is not rendered well, and there
are duplicate entries, but that will be fixed in a followup.
2018-06-12 06:53:31 +00:00
Piotr Pawel Stefaniak
bb92a28b2f indent(1): rename -nsac/-sac ("space after cast") to -ncs/-cs
Also update tests and the manpage.

GNU indent had the option earlier as -cs, let's not diverge unnecessarily.
2018-06-11 05:35:57 +00:00
Eitan Adler
fb7b896cd8 top(1): handle 0 in "digits" functions 2018-06-11 05:05:20 +00:00
Piotr Pawel Stefaniak
7e53aaedd3 indent(1): group global option variables into an options structure
It's clearer now when a variable represents a toggable command line option.

Many options were stored in the parser's state structure, so fix also that.
2018-06-10 16:44:18 +00:00
Eitan Adler
a01160996b top(1): use modern interfaces for nice and related
- attempt and fail, rather than check for permission.
- use macro rather than explicit "-20"
2018-06-10 09:15:13 +00:00
Eitan Adler
1a8f56dd3a top(1): add command aliases; correct dumb support 2018-06-10 09:04:56 +00:00
Eitan Adler
561b0720cf top(1): use sys_signame instead of hard coding signals
This enables the removal of the signal.h awk script. Shamelessly stolen
from kill(1).
2018-06-10 09:00:01 +00:00
Eitan Adler
b26cf3d06c top(1): bring some structure to commands
Right now this is only used for help text but it'll eventually be used
to build up long options array, dispatch commands, etc.
2018-06-10 08:59:57 +00:00
Eitan Adler
4eef480b46 top(1): use correct word when displaying threads
PR:		182204
Reported by:	"Brodey Dover" <doverosx@gmail.com>
2018-06-10 06:33:49 +00:00
Eitan Adler
b4aadfd27e top(1): filter fewer warnings; clean up
- remove WARNS?=6. It is default
- we no longer have cast-qual problems
- remove unused macros
- remove unneeded casts
- add include guard for loadavg.h
2018-06-10 06:21:51 +00:00
Eitan Adler
da446b10ed top(1): permit sending signal with any case 2018-06-10 06:21:45 +00:00
Michael Dexter
c1192502cb Add myself to calendar.freebsd
Approved by:	bcr (mentor)
2018-06-10 05:48:03 +00:00
Eitan Adler
468910cd7a top(1): permit sub-second delay times
This removes the getuid check for delay==0. It didn't prevent users from
writing similar programs in the general case. In theory, if top(1) is
among one of the few restricted programs you're allowed to run, it may
have helped a little, but there are better ways of handling that case.
2018-06-10 00:02:56 +00:00
Eitan Adler
6e0632db3d top(1): correctly reset per-cpu counters
I had changed this from a for loop to a memset during an earlier
cleanup. This change was incorrect so revert it.

While here, clean up

Reported by:	flo
2018-06-09 23:24:08 +00:00
Eitan Adler
ef436ca6a6 top(1): handle specific pids better
When told to watch a specific pid, don't filter idle, system, or self
processes. The summary at the top will still flip correctly though.
2018-06-09 23:08:02 +00:00
Eitan Adler
d73bfd43b2 top(1): implement additional missing long options 2018-06-09 22:30:10 +00:00
Eitan Adler
9d6cce02a7 top(1): initial pass to freebsdize the man page
The previous man page used many conventions not typical in FreeBSD.
Since we've forked top completely, convert the man page too.
2018-06-09 21:40:33 +00:00
Eitan Adler
c388909b8d top(1): Implement long options
This also documents some reserved or differing options from top's
original upstream.
2018-06-09 21:40:24 +00:00
Baptiste Daroussin
e620f7fb56 diff: Import fixes from OpenBSD
original commit log by miller@OpenBSD  r1.46:
Fix exit value when diffing directories with missing files and the -N
or -P options are not used.  From Ibrahim Khalifa
2018-06-09 21:09:24 +00:00
Guangyuan Yang
2b77102934 Add myself to the calendar
Requested by:	mckusick
Reviewed by:	emaste
2018-06-09 21:05:25 +00:00
Baptiste Daroussin
6fa5bf0832 Isolate the pr(1) related code in its own source files
This keeps diffreg.c closer to what it is supposed to do:
diffing regular files.

It also allows my code to get a proper license
2018-06-09 20:24:17 +00:00
Eitan Adler
dd0bdd6b45 top(1): allow starting with -T flag 2018-06-09 20:06:06 +00:00
Kyle Evans
be13c0f967 bsdgrep(1): Some more int -> bool conversions and name changes
Again motivated by upcoming work to rewrite a bunch of this- single-letter
variable names and slightly misleading variable names ("lastmatches" to
indicate that the last matched) are not helpful.
2018-06-09 18:11:46 +00:00
Eitan Adler
7fe961ff48 ncal: correct history section
originally reported Todd C. Miller[0]
Additional data see [1][2].

While here, pet igor.

Closes #152 (github pr)
Sbmitted by:	Raf Czlonka

[0]
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/cal/cal.1?rev=1.28&content-type=text/x-cvsweb-markup
[1] https://www.bell-labs.com/usr/dmr/www/1stEdman.html
[2] https://www.bell-labs.com/usr/dmr/www/man61.pdf
2018-06-09 04:40:17 +00:00
Eitan Adler
e3225dcf12 top(1): correct header, align it.
THR is always 6 digits or longer. Now that the PID/THR change is
separated, use correct headers.

PR:		228823
Reported by:	Trond.Endrestol@ximalas.info
2018-06-09 02:47:02 +00:00
Eitan Adler
4e08f2f53c top(1): actually make change for tid vs pid 2018-06-09 02:18:15 +00:00
Eitan Adler
fc36f5a7cb top(1): use a different command to toggle tid vs pid
- By popular demand, implement a different switch ("T") for toggling
between thread id and process id.
- Add an assert that the size of command chars is as expected.
- Also clean up some messiness I found when implementing this.
- Further document the new flag.

Requested by:	flo, ronald-lists@klop.ws, bapt
PR:		139389 (for the record)
X-MFC-With:	r334474
2018-06-09 02:14:33 +00:00
Kyle Evans
d1a920b48f bsdgrep(1): Evict character sequence that moved in
Reported by:	trasz
2018-06-08 12:58:55 +00:00
Eitan Adler
4fb80c7008 top(1): remove some unneeded indirection 2018-06-08 02:03:51 +00:00
Eitan Adler
d408c8f742 top(1): fix several style & const related issues
- use parens for return
- put function names on newline
- sprinkle const where possible
2018-06-08 01:55:47 +00:00
Kyle Evans
bd60b9b499 bsdgrep(1): Slooowly peel away the chunky onion
(or peel off the band-aid, whatever floats your boat)

This addresses two separate issues:

1.) Nothing within bsdgrep actually knew whether it cared about line numbers
  or not.

2.) The file layer knew nothing about the context in which it was being
  called.

#1 is only important when we're *not* processing line-by-line. #2 is
debatably a good idea; the parsing context is only handy because that's
where we store current offset information and, as of this commit, whether or
not it needs to be line-aware.
2018-06-08 01:25:07 +00:00
Kyle Evans
66f780aee0 bsdgrep(1): Don't initialize fts_flags twice
Admittedly, this is a clang-scan complaint... but it wasn't wrong. fts_flags
is initialized by all cases in the switch(), which should be fairly obvious.
Annotate this anyways.
2018-06-07 18:38:48 +00:00
Kyle Evans
40f0e0b100 bsdgrep(1): whoops, garbage collect the now write-only variable 2018-06-07 18:36:12 +00:00
Kyle Evans
cbfff13fa2 bsdgrep(1): Do some less dirty things with return types
Neither procfile nor grep_tree return anything meaningful to their callers.
None of the callers actually care about how many lines were matched in all
of the files they processed; it's all about "did anything match?"

This is generally just a light refactoring to remind me of what actually
matters as I'm rewriting these bits to care less about 'stuff'.
2018-06-07 18:27:58 +00:00
Baptiste Daroussin
30dc95029e Remove NLS support from BSD grep
GNU grep as in actually in base does not have any translations support
compiled in, so no functionnality loss.

We do support 193 locales in base, we will never catch up on that number of
translation with bsd grep.

Removing NLS support make bsd grep consistent with the other binaries in base
which are not translated, and also reduce a little bit the code.

Reviewed by:	kevans
Approved by:	kevans
Discussed with:	kevans @BSDCan
Differential Revision:	https://reviews.freebsd.org/D15682
2018-06-06 23:12:35 +00:00
Eitan Adler
59c8d5dc27 top(1): fix err again
I am amazed at my ability to get a one-line error reporting line wrong
thrice.
2018-06-06 07:13:27 +00:00
Eitan Adler
bca1b45bb1 top(1): make error message happy
We don't use a "size" variable, so just don't report it.

Reported by:	bapt
2018-06-06 06:42:12 +00:00
Piotr Pawel Stefaniak
0929b3d971 indent(1): fix buildworld after r334632
Fix
error: comparison of integers of different signs: 'int' and 'unsigned long'
by casting nitems() to int.

Reported by:	mjg
2018-06-04 21:21:55 +00:00
Piotr Pawel Stefaniak
d0f86f663f indent(1): add --version option
There exist multi-platform programs that check indent's version in order to
know what they can expect from it. GNU indent provides that via --version,
so implement the same option here.
2018-06-04 21:05:56 +00:00
Piotr Pawel Stefaniak
88b24a62d1 indent(1): remove the STACKSIZE macro and all of its use
It conflicts with a system-provided macro of the same name on another OS.
2018-06-04 20:39:58 +00:00
Piotr Pawel Stefaniak
4d0c622816 indent(1): remove static const char copyright[]
It repeats what is already said in the heading comment and it's optimized out
so serves no purpose.
2018-06-04 20:24:31 +00:00
Piotr Pawel Stefaniak
03e6aeef3a indent(1): replace BSD bcopy() with C memmove() 2018-06-04 19:47:24 +00:00
Eitan Adler
cda7a5d5ed top(1): some nitpicks
- prefer fully spelled names to "u_long"
- fix speeling
2018-06-04 05:27:00 +00:00
Eitan Adler
8d0d26767b top(1): include what you use
- Change headers to more closely match what we use
- use more standard functions instead of bzero, bcmp, bcopy
- Add myself to authors.

Tested with: base clang (amd64), gcc 9 (amd64), base clang (i386), base
gcc (mips)
2018-06-04 04:59:32 +00:00
Eitan Adler
5dc98aeeaa top(1): Prefer memcpy over bcopy 2018-06-04 04:59:24 +00:00
Eitan Adler
a9a99372d9 top(1): Use strsep instead of homegrown alternative
This replaces some complex, and not quite correct logic, with a more
common strsep pattern.

Reviewed by:	mmacy (older version)
2018-06-04 03:16:24 +00:00
Eitan Adler
eae589f1ce top(1): another pass of cleanup
- avoid the need to call a function to get size of known array. I'll
likely re-arrange some of the indirect in a later to avoid the magic
constants.
- use correct type
- add const
- replace caddr_t with void*. This corrects an alignment warning.
- remove duplicated include from immediately prior commit

Under base clang we're now down to:
- 3 warning in top.c, 1 warning in mahcine.c,  4 warning in display.c,
- 1 warning in utils.c

Tested with base clang, gcc7, gcc9, base gcc (mips)
2018-06-03 23:40:54 +00:00
Eitan Adler
9f8096e339 top(1): top warnings and cleanup
- Add const where helpful
- add missing 'static' for file-local functions
- use nitems where possible
- convert manual abort() to assert
- use strndup instead of homegrown version

Tested with clang, gcc7, and gcc9
2018-06-03 22:42:54 +00:00
Piotr Pawel Stefaniak
aac30b753f indent(1): new option -lpl
With -lpl, code surrounded by parentheses in continuation lines is lined up
even if it would extend past the right margin.

With -nlpl (the default), such a line that would extend past the right
margin is moved left to keep it within the margin, if that does not require
placing it to the left of the prevailing indentation level.

These switches have no effect if -nlp is selected.

Submitted by:	Tom Lane
2018-06-03 21:40:38 +00:00
Piotr Pawel Stefaniak
50a2976094 indent(1): revert introduction of -lpl
That was committed with the wrong message. Will be re-added.
2018-06-03 21:34:29 +00:00
Piotr Pawel Stefaniak
971e1c47ec indent(1): new option -lpl (always line up to parenthesis)
With -lp, if a line has an opening paren which is not closed on that line,
then continuation lines will be lined up to start at the character position
just after the opening paren.

Submitted by:	Tom Lane
2018-06-03 20:59:59 +00:00
Piotr Pawel Stefaniak
5834814ee8 indent(1): manual page corretions
Add missing options, synchronize syntax summary with the actual option list,
and other fixes.

Submitted by:	Tom Lane
2018-06-03 20:48:58 +00:00
Piotr Pawel Stefaniak
2364d1a74e indent(1): if an identifier can be either a typedef name or as a struct
member, it is taken as the latter
2018-06-03 19:05:20 +00:00
Piotr Pawel Stefaniak
01a206e63c indent(1): if the token is a "[" then neither of the blocks is relevant 2018-06-03 18:38:03 +00:00
Piotr Pawel Stefaniak
fa7ea0c961 indent(1): don't add a space after a label
It's not needed and it fools pr_comment().
2018-06-03 18:34:36 +00:00
Piotr Pawel Stefaniak
9963ad6fdf indent(1): ignore null characters from input 2018-06-03 18:32:11 +00:00
Piotr Pawel Stefaniak
370d0cf9be indent(1): don't overflow di_stack[] 2018-06-03 18:29:20 +00:00
Piotr Pawel Stefaniak
9de29bfb5a indent(1): improve CHECK_SIZE_ macros
Rewrite the macros so that they take a parameter. Consumers use it to signal
how much room in the buffer they need; this lets them do that once when
required space is known instead of doing the check once every loop step.

Also take the parameter value into consideration when resizing the buffer;
the requested space may be larger than the constant 400 bytes that the
previous version used - now it's the sum of those two values.

On the consumer side, don't copy strings byte by byte - use memcpy().

Deduplicate code that copied base 2, base 8 and base 16 literals.

Don't advance the e_token pointer once the token has been copied into
s_token. This allows easy calculation of the token's length.
2018-06-03 18:19:41 +00:00
Piotr Pawel Stefaniak
1479f36d8e indent(1): remove troff output support
The troff output in indent was invented at Sun and the online documentation
for some post-SunOS operating system includes this:
The usual way to  get  a  troffed listing is with the command
                       indent -troff program.c | troff -mindent

The indent manual page in FreeBSD 1.0 already lacks that information and
troff -mindent complains about not being able to find the macro file.
It seems that the file did exist on SunOS and was supposed to be imported
into 4.3BSD together with the feature, but that has never happened.

Removal of troff output support simplifies a lot of indent's code.

vgrind(1) seems to be a promising replacement.
2018-06-03 17:55:50 +00:00
Piotr Pawel Stefaniak
7c5f6031fe indent(1): avoid resetting last_bl to a bogus value when reallocating
underlying buffer
2018-06-03 17:11:01 +00:00
Piotr Pawel Stefaniak
bef613ff2f indent(1): the check for buffer overflow has to be done before copy 2018-06-03 17:07:56 +00:00
Piotr Pawel Stefaniak
33c2464207 indent(1): use errx() instead of abort() 2018-06-03 17:05:55 +00:00
Piotr Pawel Stefaniak
e1baf57e4b indent(1): limit character classification functions' input to unsigned char 2018-06-03 17:03:55 +00:00
Piotr Pawel Stefaniak
95b813e501 indent(1): recognize more type names
Most are from C99.
2018-06-03 16:52:30 +00:00
Piotr Pawel Stefaniak
9522d0b0d2 indent(1): don't format function declarations as variables 2018-06-03 16:42:58 +00:00
Piotr Pawel Stefaniak
e95d1e3c93 indent(1): remove is_procname.
It was a shorthand for checking if ps.procname is a non-empty string; the
same can be done with ps.procname[0] which avoids the need for updating
is_procname after every call to lexi().
2018-06-03 16:27:40 +00:00
Piotr Pawel Stefaniak
f9287a9d85 indent(1): disjoint parser state from lexi()
The function is sometimes used as a look-ahead, so ideally it should bear
no information about parser state.
2018-06-03 16:21:15 +00:00
Piotr Pawel Stefaniak
3c51c3cf5f indent(1): improve handling of boxed comments indentation
The trick is to copy everything from the start of the line into the buffer
that stores newlines and comments until indent finds a brace or an else.
pr_comment() will use that information to calculate the original indentation
of the boxed comment.

This requires storing two pieces of information: the real start of the
buffer (sc_buf) and the start of the comment (save_com).
2018-06-03 15:28:55 +00:00
Piotr Pawel Stefaniak
63c3f22696 indent(1): improve predictability of lexi()
lexi() reads the input stream and categorizes the next token. indent will
sometimes buffer up a sequence of tokens in order rearrange them. That is
needed for properly cuddling else or placing braces correctly according to
the chosen style (KNF vs Allman) when comments are around. The loop that
buffers tokens up uses lexi() to decide if it's time to stop buffering. Then
the temporary buffer is used to feed lexi() the same tokens again, this time
for normal processing.

The problem is that lexi() apart from recognizing the token, can change
a lot of information about the current state, for example ps.last_nl,
ps.keyword, buf_ptr. It also abandons leading whitespace, which is needed
mainly for comment-related considerations. So the call to lexi() while
tokens are buffered up and categorized can change the state before they're
read again for normal processing which may easily result in changing
interpretation of the current state and lead to incorrect output.

To work around the problems:
1) copy the whitespace into the save_com buffer so that it will be read
again when processed
2) trick lexi() into modifying a temporary copy of the parser state instead
of the original.
2018-06-03 14:13:11 +00:00
Piotr Pawel Stefaniak
ec5ac89ecd indent(1): improve handling of comments and newlines between "if (...)" or
"while (...)" and "else" or "{"

* Don't flush newlines - there can be multiple of them and they can happen
before a token that isn't else or {. Instead, always store them in save_com.
* Don't dump the buffer's contents on newline assuming that there is only
one comment before else or {.
* Avoid producing surplus newlines, especially before else when -ce is on.
* When -bl is on, don't treat { as a comment (was implemented by falling
through "case lbrace:" to "case comment:").

This commit fixes the above, but exposes another bug and thus breaks several
other tests. Another commit will make them pass again.
2018-06-03 14:03:20 +00:00
Eitan Adler
a2cda47ac3 top(1): restore size for kern.cp_times
Restore last minute change that broke top(1).
2018-06-03 13:41:23 +00:00
Piotr Pawel Stefaniak
5bdd850968 indent(1): remove undocumented and rather useless option (-ps)
It's used to treat the "->" access operator as a binary operator and put
space characters around it.
2018-06-03 13:40:58 +00:00
Eitan Adler
c5484668f1 top(1): Only use NO_WERROR for base gcc
This is what was intended. If statements are hard.
2018-06-03 06:02:31 +00:00
Eitan Adler
01a55f006a top(1): partial revert of r334517
In fixing issues with uid > INT_MAX, I broke the uid without username
case. The latter is more important so return the old state.

Discussed with:	allanjude
2018-06-03 05:20:11 +00:00
Eitan Adler
b7128a09ce top(1): remove chdir to /
While this came out of a conversation in IRC, it turn out that some
people don't like it. Since this was a courtesy feature, just remove it.
2018-06-03 05:07:46 +00:00
Eitan Adler
1d5b01e66e top(1): use greater warnings
One of the downsides of using numeric WARNS is that if we only have a
single type of issue we get no protection from other changes.  For
example, we got no warning for missing variable declaration, due to
the issues with "const".

For this utility, explicitly list out the warnings which are failing.
They should still be fixed, so only reduce them to warning instead of
error.

Tested with: clang base (amd64, i386), gcc6, gcc7, gcc9, gcc base (mips)
2018-06-03 05:07:39 +00:00
Eitan Adler
d0bb69dc07 top(1): misc minor improvements
- use bool instead of int [0]
- use calloc correctly [0]
	(this also caught an incorrect sizeof argument) [1]
- use size_t over int [2]
- correct style

Reported by:	pfg [0], scan-build [1], gcc [2]
2018-06-03 02:58:53 +00:00
Eitan Adler
c51e28f46f top(1): Fix two speeling errors I introduced 2018-06-02 22:12:57 +00:00
Eitan Adler
f32efe0205 top(1): chdir to / as init; remove unneeded comment
- chdir to / to allow unmounting of wd
- remove warning about running top(1) as setuid. If this is a concern we
should just drop privs instead.
2018-06-02 22:06:27 +00:00
Eitan Adler
4fedcd4983 top(1): cleanup memory allocation and warnings
- Prefer calloc over malloc. This is more predicable and we're not in a
performance sensitive context. [1]
- Remove bogus comment (obsolete from prior commit). [2]
- Remove void casts and type casts of NULL
- Remove redundant declaration of 'quit'
- Add additional const

Reported by:	kib [1], vangyzen [2]
2018-06-02 21:40:45 +00:00
Justin Hibbits
5167f178ab Included VSX registers in powerpc core dumps
Summary: Included VSX registers in powerpc core dumps (both kernel and gcore)

Submitted by:	Luis Pires
Differential Revision: https://reviews.freebsd.org/D15512
2018-06-02 20:28:58 +00:00
Roman Bogorodskiy
51b29cb7b3 top: add -p option and p command to only show a single process
Allow to show only a single process specified by PID. This could
be done either by running top like 'top -p PID' or using the 'p' command
inside top.

Reviewed by:	eadler
Approved by:	eadler
Obtained from:	OpenBSD
Differential Revision:	https://reviews.freebsd.org/D15501
2018-06-02 15:52:18 +00:00
Eitan Adler
b274c68a20 Use stpcpy instead of home grown solution 2018-06-02 08:46:09 +00:00
Eitan Adler
2c1fdbac13 top(1): remove wrapper around putchar
This appears to have been written for portability which we no longer
need.
2018-06-02 07:44:53 +00:00
Eitan Adler
960a7f3960 top(1): const poison part 2
Further reduce the number of warnings emitted by gcc.
2018-06-02 07:44:50 +00:00
Eitan Adler
66b3f031f0 top(1): const poison
top(1) has a number of issues with writing to const strings. Begin
helping this along by marking easy cases as const.
2018-06-02 04:37:37 +00:00
Eitan Adler
0059e7102f top(1): clean up a bit
- remove unused defines
- use standard defines for STDOUT
- don't cast for memset
- avoid using (void) cast
2018-06-02 04:20:42 +00:00
Eitan Adler
cffee2bc5b top(1): help scan-build along a bit
Teach scan-build that some arrays are larger than zero, and thus not to
warn.
2018-06-02 04:08:52 +00:00
Eitan Adler
1978939544 top(1): Use uid_t for uid rather than 'int'
Remove unneeded define while here.
2018-06-02 03:54:50 +00:00
Eitan Adler
f4d9a8de00 top(1): Remove now-invalid NOTE 2018-06-02 03:33:02 +00:00
Eitan Adler
3798694c01 top(1): avoid casting malloc 2018-06-02 03:31:14 +00:00
Eitan Adler
0b2f6ed144 top(1): Use standard boolean rather than homegrown alternative 2018-06-02 03:25:15 +00:00
Eitan Adler
220e4623aa top(1): remove two unneeded headers 2018-06-02 00:02:27 +00:00
Eitan Adler
f6234b51bf top(1): ansify, style(9). and nits
- Prefer using ansi prototypes rather than C prototypes
- Keep type on separate line from name of function
- Try to keep things const where possible. This will help get to WARNS=6
- switch to "bool" where it makes sense
2018-06-02 00:02:15 +00:00
Conrad Meyer
452bb88a9c at.man: Bump .Dd missed in r334502
Sponsored by:	Dell EMC Isilon
2018-06-01 22:57:19 +00:00
Conrad Meyer
3181398b92 Update other man pages to match leap second reality
Missed these in r334501; see justification there:

https://svnweb.freebsd.org/base?view=revision&revision=334501

Sponsored by:	Dell EMC Isilon
2018-06-01 22:37:59 +00:00
Conrad Meyer
2a1fb74048 touch.1: Update to conform to POSIX 2004
POSIX borrowed the "double leap second" bug from C89.  Double leap seconds can
never happen.  This mistake was present in at least POSIX 1997 and fixed by
POSIX 2004.  I can't find a copy of 2001 online to determine if the bug was
present in that revision.

While here, remove duplicate language between -d and -t.  A few other minor
enhancements and an igor (lint) bugfix.

Further reading:

2018 POSIX (documents -d):
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/touch.html

2004 POSIX (documents SS from 0-60):
http://pubs.opengroup.org/onlinepubs/009695399/utilities/touch.html

1997 POSIX/SUSv2 (historical interest, 0-61):
http://pubs.opengroup.org/onlinepubs/007908799/xcu/touch.html

More on this subject (start at "Unix system time and the POSIX standard")
https://www.ucolick.org/~sla/leapsecs/onlinebib.html

And: https://marc.info/?l=openbsd-tech&m=92682843416159&w=2

Reported by:	Vishal Sahu <vsahu AT isilon.com>
Sponsored by:	Dell EMC Isilon
2018-06-01 22:34:59 +00:00
Piotr Pawel Stefaniak
0de58b3f46 indent(1): improve an error message
When producing a "[...] requires a parameter" error, provide the recognized
name of the option instead of argument provided.
2018-06-01 20:45:35 +00:00
Piotr Pawel Stefaniak
1d01804309 indent(1): restore working -pcs
My previous indent(1) commit accidentally broke the -pcs option (which adds
space between function name and opening parenthesis in function calls) by
copying all but one of a few conditions in an if clause. Reinstate the
condition.

Add a regression test to lower the chances of breaking it again.

Correct a comment with description of what the option does.
2018-06-01 19:56:41 +00:00
Piotr Pawel Stefaniak
b06c2eb7b1 indent(1): don't add unneeded space to function pointer declarations
If the current token is an opening parenthesis, it's either a function call
(or sizeof or offsetof) or a declaration. The former doesn't need a space
before the parenthesis.
2018-06-01 09:58:44 +00:00
Piotr Pawel Stefaniak
3bbaa755f3 indent(1): don't indent typedef declarations as object declarations 2018-06-01 09:41:15 +00:00
Piotr Pawel Stefaniak
5f35ea69af indent(1): consider tab characters when forcing a newline after a comma 2018-06-01 09:32:42 +00:00
Piotr Pawel Stefaniak
9d4264fbdd indent(1): identifiers inside parentheses are not declarations
Also make lparen position calculation consider tab stops.

This improves function pointer typedef formatting.
2018-06-01 08:54:51 +00:00
Eitan Adler
937499dcb1 top(1): Display of TID when using 'H' flag
Some users prefer seeing the TID when viewing individual threads. This
makes sense as the PID will be the same for multiple entries. An attempt
was made to include both, but there is insufficient room. As such, using
the TID.

While here, rename the header variables to be more understandable.

Discussed with:	mmacy
Reported on:	2009-10-07
2018-06-01 05:51:40 +00:00
Ed Maste
f37e7f527b elfdump: chase ABI tag note name change from r232832
r232832 changed the ABI tag note name from .note.ABI-tag to .note.tag.
Follow suit in elfdump.

Elfdump's note parsing is very basic and should be significantly
reworked, but for now just restore the broken functionality.

PR:		228290
Submitted by:	martin at lispworks.com
MFC after:	1 week
2018-05-30 01:16:50 +00:00
Eric van Gyzen
488ee96b85 logger: fix memory leak and use-after-free
This one call to getaddrinfo() did not adhere to the common idiom
of storing the result into a second res0 variable, which is later freed.

Reported by:	Coverity
CID:		1368069 1368071
Sponsored by:	Dell EMC
2018-05-28 02:40:06 +00:00
Eitan Adler
bd67d6b2b1 rctl: correct use of "vmem" instead of "vmemoryuse"
Submitted by:	Jamie Landeg-Jones <jamie@catflap.org>
PR:		228482
MFC after:	1 month
2018-05-25 13:40:07 +00:00
Bryan Drewery
920a817c78 Fix exit code for mismatches after r333013.
The -c flag still does the wrong thing versus the older version due to
lack of pipefail support.

Reported by:	antoine
2018-05-24 22:15:47 +00:00
Leandro Lupori
e0d394d096 Adding myself to committers-src.dot and calendar.freebsd
Approved by:	jhibbits (mentor)
2018-05-23 19:17:17 +00:00
Brad Davis
e172d4c3f0 Switch calendar installs to use FILES and SYMLINKS instead of bare install(1)
Also explicitly list each file to install so we don't silently add or miss
some.

Approved by:	bapt (mentor)
2018-05-23 16:28:31 +00:00