Commit Graph

13501 Commits

Author SHA1 Message Date
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
christos
20a3c31620 move some code out of the gigantic main function; no functional change. 2017-06-17 15:26:50 +00:00
christos
c8eb41c615 un-c99 2017-06-16 02:01:10 +00:00
christos
8090156fb8 Bump for quoting makeoptions with multiple lines. 2017-06-16 00:10:09 +00:00
christos
f3bbdc592c Allow multiline makeoptions to work by quoting the newline.. 2017-06-15 23:52:15 +00:00
maxv
fb196e084a Check argc, and add a message. 2017-06-14 17:54:01 +00:00
christos
edba12e937 PR/52295: Anthony Mallet: find -delete: "relative path not safe" with absolute
paths ... Fix from OpenBSD
2017-06-13 13:10:32 +00:00
chs
ffdbc0ccea rearrange sys/mount.h so that all of the kernel-only parts are together
and not exposed to userland, except do expose struct mount if __EXPOSE_MOUNT
is defined.  define __EXPOSE_MOUNT in the kmem grovellers that want
the definition.  needed for ZFS.
2017-06-09 00:13:29 +00:00
abhinav
12e252e9b3 Fix typo: s/compatability/compatibility/ 2017-06-04 08:48:05 +00:00
mrg
e9aad8d696 avoid assert() and simply return errors. 2017-06-03 21:31:14 +00:00
mrg
99f85f4578 update copyright strings. 2017-06-03 21:28:48 +00:00
maya
f4f257830c Don't prefix include guards by _, suggested by riastradh 2017-05-31 22:02:06 +00:00
maya
42fe4e0ac7 The previous change might actually be less generic.
prepend by _MAKE, to be sure.
2017-05-31 21:15:47 +00:00
maya
0de6456123 Use less generic include guards 2017-05-31 21:07:03 +00:00