Commit Graph

13514 Commits

Author SHA1 Message Date
wiz
acc8606ccd Fix xref. 2017-08-27 20:38:39 +00:00
kre
9f2931ceb6 Get rid of the arg sorting - it doesn't work properly, and makes it
impossible to support component names containing embedded \n's (the
similar embedded space problem would have been trivial to fix.)
Deleting the sorting makes those issues moot, the args are no longer
processed, hence can be anything.

An alternative would be to sort the results - but that would separate
the -v output from the real output (-v stuff is not rationally sortable)
and also makes it much more difficult to get the error code for an
unknown component (like one containing an embedded \n !) as the pipe
to strt that would be used would cause the while loop to run in a sub-shell
(effectively.)
2017-08-24 01:43:42 +00:00
agc
da4a8c85c5 Move back to a simple version string for sys_info. The way of using
CVS's $ Date $ expansion to calculate the date, whilst being more
accurate, runs into issues with reproducible builds, and alternate
repository software. Simplicity wins here.

Add yacc to the list of utilities to report on
2017-08-23 21:18:57 +00:00
kre
fa98c4d014 Add a \ -- allows sys_info -v pkg_install to tell us who the version info
is obtained, rather than just how we go about printing the result.
2017-08-23 19:18:38 +00:00
agc
dc6cab8695 add pkg_install to the list of programs reported
don't throw a warning if tcsh is not found in the path
2017-08-23 18:15:53 +00:00
christos
13a9a3bb6f now that we are processing SIGINFO write can be interrupted and return
partial results (well, it could before too but it was harder to trigger);
provide write_fully like we have read_fully already.
2017-08-23 13:04:17 +00:00
kre
e5c13d3e3e Put back getopts - it is easier to get correct than hand rolled code.
Add -L and -P flags to allow the library/cmd search paths to be set.
Add support for getting vers info from sh, dhcpcd, and userland (/etc/release).
Stop abusing "sh -x" to support -v - do it properly.  Get rid of the duplicate
list of components used when there are no args, instead make better use of sh
capabilities to just process everything.  Better use of what sh can do for us
other places too.   Add a (more or less random) set of libraries to include
in output when no args are given.

OK agc (well, earlier version...)
2017-08-23 01:17:46 +00:00
agc
3e7391255c also add tzdata versioning information 2017-08-21 19:51:32 +00:00
agc
82610a7d71 restore martin's change for tcsh versioning which got lost in the last update 2017-08-21 19:36:57 +00:00
agc
8df5d7616d Changes to sys_info (20170821)
+ get rid of -a argument, which was superfluous since no arguments
means provide information on everything known

+ add the shell function to check for the path of a program. Taken
from pkgsrc bootstrap script, modified for return values, and "not
found" action

+ use this shell function for tcsh and unbound, both of which may not
exist on systems

+ go back to using standard shell construct for parsing options now,
since there is only 1 option with no optargs

+ from a suggestion from Paul Goyette, run the provided arguments
through sort | uniq

+ add sys_info itself to the list of programs to report
2017-08-21 19:22:31 +00:00
martin
090bfffa53 Use tcsh --version instead of an echo $version -- the old way did not
work for me (not quite sure why not).
2017-08-20 10:17:55 +00:00
agc
65b09bb66d Parse the arguments to sys_info(1) a bit differently, using getopts(1)
Thanks to Paul Goyette for the nudge
2017-08-19 18:36:31 +00:00
agc
f2db8c00aa + don't assume that tcsh is always installed, pointed out by jmcneill - thanks!
+ a "sys_info" invocation without any args is now the equivalent of sys_info -a,
just like pkg_info
2017-08-19 03:06:50 +00:00
ginsbach
6361925b16 Remove spurious error(1) inserted compiler error message comments. 2017-08-11 20:32:34 +00:00
sjg
f20013011f Avoid full path meta file names for subdir of .OBJDIR 2017-08-10 21:07:48 +00:00
mrg
5e22a92ec6 add SIGINFO support. 2017-08-04 07:27:08 +00:00
cheusov
ea1a131a00 Compare return value of fputs(3) with EOF instead of 0.
This is POSIX-ly correct and fixes csplit(1) on non-NetBSD systems.
2017-07-30 23:02:53 +00:00
dholland
8a66658e44 The proper way to validate a condition that's expected to be true is
to assert it, not to bolt it into the program logic in a way that will
cause strange behavior if it accidentally isn't true at some point.
2017-07-30 20:37:35 +00:00
riastradh
76d4b81251 Clarify compile-time and run-time arithmetic safety assertions.
This is an experiment with a handful of macros for writing the
checks, most of which are compile-time:

MUL_OK(t, a, b)         Does a*b avoid overflow in type t?
ADD_OK(t, a, b)         Does a + b avoid overflow in type t?
TOOMANY(t, x, b, m)     Are there more than m b-element blocks in x in type t?
                        (I.e., does ceiling(x/b) > m?)

Addenda that might make sense but are not needed here:

MUL(t, a, b, &p)        Set p = a*b and return 0, or return ERANGE if overflow.
ADD(t, a, b, &s)        Set s = a+b and return 0, or return ERANGE if overflow.

Example:

	uint32_t a = ..., b = ..., y = ..., z = ..., x, w;

        /* input validation */
        error = MUL(size_t, a, b, &x);
        if (error)
                fail;
        if (TOOMANY(uint32_t, x, BLKSIZ, MAX_NBLK))
                fail;
        y = HOWMANY(x, BLKSIZ);
        if (z > Z_MAX)
                fail;
        ...
        /* internal computation */
        __CTASSERT(MUL_OK(uint32_t, Z_MAX, MAX_NBLK));
        w = z*y;

Obvious shortcomings:

1. Nothing checks your ctassert matches your subsequent arithmetic.
   (Maybe we could have BOUNDED_MUL(t, x, xmax, y, ymax) with a
   ctassert inside.)

2. Nothing flows the bounds needed by the arithmetic you use back
   into candidate definitions of X_MAX/Y_MAX.

But at least the reviewer's job is only to make sure that (a) the
MUL_OK matches the *, and (b) the bounds in the assertion match the
bounds on the inputs -- in particular, the reviewer need not derive
the bounds from the context, only confirm they are supported by the
paths to it.

This is not meant to be a general-purpose proof assistant, or even a
special-purpose one like gfverif <http://gfverif.cryptojedi.org/>.
Rather, it is an experiment in adding a modicum of compile-time
verification with a simple C API change.

This also is not intended to serve as trapping arithmetic on
overflow.  The goal here is to enable writing the program with
explicit checks on input and compile-time annotations on computation
to gain confident that overflow won't happen in the computation.
2017-07-29 21:04:07 +00:00
sjg
a5cccb4af8 Make compat.c handle SIGINT etc more like job.c
If there is a running child, pass the signal on, and
wait for it to exit before we self-terminate.

Reviewed by: christos
2017-07-20 19:29:54 +00:00
wiz
1c4feb4ef6 Simplify. 2017-07-15 14:40:36 +00:00
christos
59fa4f31ea Allow the user to specify the output format on the command line. 2017-07-15 14:34:08 +00:00
wiz
edd62e729c Remove unnecessary macros. Use standard headers. 2017-07-15 12:10:31 +00:00
jmcneill
c3934401dc Add support for "kernel_noload" image types. This type is the same as the
"kernel" type, except it can run from any load address.
2017-07-15 11:13:08 +00:00
mlelstv
9368f38e90 Use I/O timestamps to compute disk statistics for better precisison. 2017-07-15 08:22:23 +00:00
wiz
6595bf8f10 Sort sections. Fix macro usage. 2017-07-13 10:59:53 +00:00
maxv
138795e97b Update. 2017-07-12 17:38:15 +00:00
maxv
25d629d753 Properly handle overflows, and take them into account in userland. 2017-07-12 17:33:29 +00:00
maxv
e0e9462ba4 Build the pmc tool on amd64. 2017-07-12 17:10:09 +00:00
sjg
3dd087f31b Ensure that command output is always followed by newline,
even when filemon is not being used.

Tweak MAKE_META_IGNORE_PATTERNS matching to avoid using path name
with :L as it does not handle ':' in path names.

fgetLine: an extra check to avoid shrinking the buffer.
2017-07-09 04:54:00 +00:00
jmcneill
dfe9578fbd Load address is not required for "ramdisk" images. 2017-07-05 01:09:17 +00:00
mlelstv
245a1a4599 Use I/O timestamps to compute disk statistics for better precision.
Disk statistics are collected in a fixed size array, that got corrupted
when a disk was detached. Adapt by skipping entries of detached disks
and detect reused disknames at the array end.
2017-07-04 21:19:33 +00:00
wiz
6f62608235 Use more macros. 2017-07-04 07:07:23 +00:00
wiz
40396b53cb Add EXIT STATUS section. Use Ex. 2017-07-04 07:01:07 +00:00
wiz
0aaaa77458 Add EXIT STATUS section. Use Ex. Remove duplicate RCS Id. 2017-07-04 07:00:30 +00:00
wiz
39aca47cc7 Add EXIT STATUS section. Use Ex. 2017-07-04 06:59:34 +00:00
wiz
99a393ce51 Add EXIT STATUS section. Use Ex. New sentence, new line. 2017-07-04 06:58:55 +00:00
wiz
01869ca4d2 Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
jnemeth
fd16d76322 Only 35 years late. 2017-07-02 08:25:52 +00:00
ozaki-r
5bd67db98a Tweak outputs of netstat -s for IPsec
- Get rid of "Fast"
- Use ipsec and ipsec6 for titles to clarify protocol
- Indent outputs of sub protocols

Original outputs were organized like this:

(Fast) IPsec:
IPsec ah:
IPsec esp:
IPsec ipip:
IPsec ipcomp:
(Fast) IPsec:
IPsec ah:
IPsec esp:
IPsec ipip:
IPsec ipcomp:

New outputs are organized like this:

ipsec:
	ah:
	esp:
	ipip:
	ipcomp:
ipsec6:
	ah:
	esp:
	ipip:
	ipcomp:
2017-06-29 07:15:27 +00:00
dholland
8d1c7950e6 Improve description of -V. Can probably be improved further. 2017-06-22 13:42:09 +00:00
wiz
a726a39b89 Whitespace fixes. 2017-06-22 13:34:13 +00:00
dholland
af10ba7a81 Document what the magic variable .MAKE.EXPAND_VARIABLES actually does. 2017-06-22 13:21:21 +00:00
abhinav
95487f06f5 Fix typo 2017-06-20 15:50:04 +00:00
christos
6b4650c2c5 Add -v variable that always expands variables; restore -V the way it was. 2017-06-19 19:58:24 +00:00
christos
5c6ef1cc66 make the code look like to 1.266 2017-06-19 15:49:21 +00:00
christos
0d284700aa Remove previous variable expansion code; sjg had already added the code to
do it. Note that the manual page already documents this behavior and does
not need to change:

	-dV -V VAR:	prints the raw variable
	-V VAR:		prints the expanded variable
2017-06-19 14:59:06 +00:00
christos
a8ded88f7a a variable that starts with \\ is not expanded. 2017-06-17 19:59:28 +00:00
christos
72acc73554 simplify 2017-06-17 16:34:07 +00:00
christos
bd56310bf6 -V: try to expand the variable again if the value contains a variable. 2017-06-17 15:49:56 +00:00