Commit Graph

13117 Commits

Author SHA1 Message Date
Warner Losh
8207f12d6a Decode FreeBSD 11 compat stat, fstat and lstat calls. 2017-06-23 18:06:46 +00:00
Maxim Sobolev
e978052623 Don't leak file descriptor in some cases.
Reported by:	cem
MFC after:	6 weeks
2017-06-23 17:39:00 +00:00
Conrad Meyer
3452510890 join(1): Fix field ordering for -v output
Per POSIX, join(1) (in modes other than -o) is a concatenation of selected
character fields.  The joined field is first, followed by fields in the
order they occurred in the input files.

Our join(1) utility previously handled this correctly for lines with a match
in the other file.  But it failed to order output fields correctly for
unmatched lines, printed in -a and -v modes.

A simple test case is:

$ touch a
$ echo "2 1" > b
$ join -v2 -2 2 a b
1 2

PR:		217711
Reported by:	alt.j2-4o4s2yon at yopmail.com
Sponsored by:	Dell EMC Isilon
2017-06-22 02:19:39 +00:00
Emmanuel Vadot
8b4debd261 dtc: Update to upstream 917526
- Add missing "typename" in divmod's  "using" of binary_operator_base::result.
2017-06-20 18:29:01 +00:00
Bryan Drewery
c99b67a794 Utilize SYSROOT from r320119 in places where DESTDIR may be wanting WORLDTMP.
Since buildenv exports SYSROOT all of these uses will now look in
WORLDTMP by default.

sys/boot/efi/loader/Makefile
        A LIBSTAND hack is no longer required for buildenv.

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-06-19 20:47:24 +00:00
Maxim Sobolev
bc3b2c5545 o Move logic that determines size of the input image into its own
file. That logic has grown quite significantly now;

o add a special handling for the snapshot images. Those have some
  extra headers at the end of the image and we don't need those
  in the output image really.

MFC after:	6 weeks
2017-06-17 02:58:31 +00:00
Konstantin Belousov
2b34e84335 Add abstime kqueue(2) timers and expand struct kevent members.
This change implements NOTE_ABSTIME flag for EVFILT_TIMER, which
specifies that the data field contains absolute time to fire the
event.

To make this useful, data member of the struct kevent must be extended
to 64bit.  Using the opportunity, I also added ext members.  This
changes struct kevent almost to Apple struct kevent64, except I did
not changed type of ident and udata, the later would cause serious API
incompatibilities.

The type of ident was kept uintptr_t since EVFILT_AIO returns a
pointer in this field, and e.g. CHERI is sensitive to the type
(discussed with brooks, jhb).

Unlike Apple kevent64, symbol versioning allows us to claim ABI
compatibility and still name the new syscall kevent(2).  Compat shims
are provided for both host native and compat32.

Requested by:	bapt
Reviewed by:	bapt, brooks, ngie (previous version)
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D11025
2017-06-17 00:57:26 +00:00
John Baldwin
a4110f9ffa Decode arguments to sched_* family of system calls.
This includes decoding both scheduler policy constants and the sched_param
structure for sched_get_priority_max(), sched_get_priority_min(),
sched_getparam(), sched_getscheduler(), sched_rr_get_interval(),
sched_setparam(), and sched_setscheduler().
2017-06-16 20:03:09 +00:00
Phil Shafer
264104f268 Merge libxo-0.8.2:
- xohtml: Add "-w" option to pull support files from gh_pages
- Add "upload-xohtml-files" target to publish support files in gh_pages/
- add HISTORY/AUTHORS section to man pages
- xohtml: Add div.units as standard CSS text
- Don't treat values as format strings; they are not
- add "-p" to "mkdir -p build" in setup.sh
- add test case for {U:%%} (from df.c)
- detect end-of-string in '%' and '' escaping
- make xo_simple_field, for common simple cases
- xohtml: nuke "n" in "echo" commands
- rename "format" to "fmt" for consistency; same for "str" to "value"
- update test cases

Submitted by:	phil
2017-06-16 06:29:21 +00:00
Olivier Houchard
f3360c54b1 style(9) fixes.
Reported by:	cem
2017-06-13 16:19:32 +00:00
Stephen J. Kiernan
ee27b3cd98 The variable nargv is allocated but never freed, so free it when the it
is no longer used.

Submitted by:	Thomas Rix <trix@juniper.net>
Reviewed by:	ed
Approved by:	sjg (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D9652
2017-06-13 15:50:16 +00:00
Pietro Cerutti
e9dd5a0c73 Handle partial writes
Reported by:	ed
Reviewed by:	cognet
Approved by:	cognet
2017-06-13 13:26:50 +00:00
Pietro Cerutti
dadfd1ed33 Improve yes' throughput
On my system, this brings up the throughput from ~20 to ~600 MiB/s.

Inspired by: https://www.reddit.com/r/unix/comments/6gxduc/how_is_gnu_yes_so_fast/

Reviewed by:	cognet
Approved by:	cognet
2017-06-13 12:35:01 +00:00
Ed Maste
e47ea033a1 hexdump: actually enter capability mode on last file
Reviewed by:	cem, Kyle Evans
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D10897
2017-06-13 01:05:55 +00:00
Allan Jude
2fcfba285e top: Missing man page update for r319866
MFC after:	3 days
2017-06-12 19:54:42 +00:00
Allan Jude
d9a7232865 top: Change the way the ZFS ARC compression ratio is calculated
Based on feedback from OpenZFS developers Matt Ahrens and George Wilson,
the calculation of the ratio no longer takes in to account overhead.

The old formula could result in reporting a negative compression ratio

This could confuse the user or give a false impression that there would be
an advantage to disabling the compressed ARC feature.

The new formula will more closely match an average of the on-disk
compression ratio, as reported by the ZFS property 'compressratio'

MFC after:	3 days
Sponsored by:	ScaleEngine Inc.
2017-06-12 19:51:57 +00:00
Enji Cooper
74c9a5910c Add some initial basic tests for du(1)
Tests that exercise the following flags are added in this commit:
- -A
- -H
- -I
- -g
- -h
- -k
- -m

Additional tests will be added soon.

MFC after:	1 month
2017-06-12 07:43:58 +00:00
Enji Cooper
29d65f1cb4 Add some testcases for diff --side-by-side support
These are were created proactively, in anticipation of the support being
fully implemented sometime in the future.

The tests currently fail on ^/head@r319845, however. Expect them to fail.

PR:		219933
Tested with:	gdiff
2017-06-12 05:11:43 +00:00
Enji Cooper
9bd154b8e6 du(1): trivial whitespace cleanup
MFC after:	1 month
2017-06-12 02:42:39 +00:00
Enji Cooper
64a82bcd4e Add initial tests for stat(1)
Testcases for -H, -L, and -f haven't been implemented yet, in part due
to additional complexity needed to validate the features:
* -H and -f will require an external "helper" program to display/modify
  the state/permissions for a given path.
* -L is being covered partially via the -n testcase today.

MFC after:	1 month
2017-06-12 00:21:55 +00:00
Enji Cooper
39aed6d61a stat(1): sort flags in the DESCRIPTION section
-x's description should come after -t's description.

MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2017-06-11 21:23:54 +00:00
Enji Cooper
21860bf938 Write up some basic tests for readlink(1)
The tests exercise -f (f_flag), -n (n_flag), and no arguments (basic).

MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2017-06-11 21:13:12 +00:00
Andriy Gapon
40ea8d27de fstat: catch up with r318997 and use 64 bits to store fsid
Discussed with:	kib
2017-06-10 20:38:52 +00:00
John Baldwin
3cd40bc360 Decode arguments to rtprio() and rtprio_thread(). 2017-06-10 01:32:35 +00:00
John Baldwin
66ba8943a1 Decode arguments to rtprio_thread() (same as rtprio()). 2017-06-10 01:32:18 +00:00
John Baldwin
4152441f44 Decode the 'howto' argument to reboot(). 2017-06-10 01:22:40 +00:00
John Baldwin
dd0c462cf5 Decode the arguments to quotactl(). 2017-06-10 00:53:00 +00:00
John Baldwin
5ac1c7ac34 Decode the arguments to ptrace().
This does not decode structures returned by ptrace().
2017-06-10 00:45:07 +00:00
John Baldwin
ad419d3377 Decode arguments to getpriority() and setpriority(). 2017-06-10 00:37:02 +00:00
John Baldwin
9483ab16d4 Fix decoding of setpriority() arguments.
The PRIO_* 'which' value is stored in the first argument to setpriority(2),
not the last.  While here, decode the arguments to getpriority(2).
2017-06-10 00:35:45 +00:00
Gleb Smirnoff
779f106aa1 Listening sockets improvements.
o Separate fields of struct socket that belong to listening from
  fields that belong to normal dataflow, and unionize them.  This
  shrinks the structure a bit.
  - Take out selinfo's from the socket buffers into the socket. The
    first reason is to support braindamaged scenario when a socket is
    added to kevent(2) and then listen(2) is cast on it. The second
    reason is that there is future plan to make socket buffers pluggable,
    so that for a dataflow socket a socket buffer can be changed, and
    in this case we also want to keep same selinfos through the lifetime
    of a socket.
  - Remove struct struct so_accf. Since now listening stuff no longer
    affects struct socket size, just move its fields into listening part
    of the union.
  - Provide sol_upcall field and enforce that so_upcall_set() may be called
    only on a dataflow socket, which has buffers, and for listening sockets
    provide solisten_upcall_set().

o Remove ACCEPT_LOCK() global.
  - Add a mutex to socket, to be used instead of socket buffer lock to lock
    fields of struct socket that don't belong to a socket buffer.
  - Allow to acquire two socket locks, but the first one must belong to a
    listening socket.
  - Make soref()/sorele() to use atomic(9).  This allows in some situations
    to do soref() without owning socket lock.  There is place for improvement
    here, it is possible to make sorele() also to lock optionally.
  - Most protocols aren't touched by this change, except UNIX local sockets.
    See below for more information.

o Reduce copy-and-paste in kernel modules that accept connections from
  listening sockets: provide function solisten_dequeue(), and use it in
  the following modules: ctl(4), iscsi(4), ng_btsocket(4), ng_ksocket(4),
  infiniband, rpc.

o UNIX local sockets.
  - Removal of ACCEPT_LOCK() global uncovered several races in the UNIX
    local sockets.  Most races exist around spawning a new socket, when we
    are connecting to a local listening socket.  To cover them, we need to
    hold locks on both PCBs when spawning a third one.  This means holding
    them across sonewconn().  This creates a LOR between pcb locks and
    unp_list_lock.
  - To fix the new LOR, abandon the global unp_list_lock in favor of global
    unp_link_lock.  Indeed, separating these two locks didn't provide us any
    extra parralelism in the UNIX sockets.
  - Now call into uipc_attach() may happen with unp_link_lock hold if, we
    are accepting, or without unp_link_lock in case if we are just creating
    a socket.
  - Another problem in UNIX sockets is that uipc_close() basicly did nothing
    for a listening socket.  The vnode remained opened for connections.  This
    is fixed by removing vnode in uipc_close().  Maybe the right way would be
    to do it for all sockets (not only listening), simply move the vnode
    teardown from uipc_detach() to uipc_close()?

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D9770
2017-06-08 21:30:34 +00:00
Baptiste Daroussin
45c2cf11d2 Import mandoc snapshot 2017-06-08
It implements missing man(7) macros used in base by kerberos/ntp and makes them
supported by mandoc.

This import should have been done before the removal of groff.

Reported by:	gordon
2017-06-08 19:40:00 +00:00
John Baldwin
114aeee03b Decode arguments passed to msync(). 2017-06-08 08:10:57 +00:00
John Baldwin
8acc8e78ea Decode flags passed to mount(), nmount(), and unmount(). 2017-06-08 08:07:51 +00:00
John Baldwin
94bde7556c Decode arguments to mlock(), mlockall(), and munlock(). 2017-06-08 04:50:50 +00:00
John Baldwin
2d9c998859 Decode arguments to minherit(). 2017-06-08 04:45:13 +00:00
John Baldwin
26606dcaa7 Decode arguments passed to extended attribute related system calls.
The cmd argument passed to extattrctl() is not decoded as a string constant
but is just printed in hex.  The value is filesystem-specific but in
practice is only used with UFS1 filesystems.
2017-06-08 04:31:15 +00:00
John Baldwin
7ce44f08f5 Decode arguments to ACL related system calls.
This only decodes the raw arguments but not the contents of the struct acl
objects.
2017-06-08 03:51:17 +00:00
Pedro F. Giffuni
12300d3aa0 patch: if reading fails, do not go into infinite loop asking for a filename.
This can happen if no tty is available.

Obtained from:	OpenBSD (CVS rev 1.54)
MFC after:	5 days
2017-06-08 03:15:08 +00:00
Richard Gallamore
d4a698487c Add myself (ultima) as a new port committer.
Reviewed by:	matthew (mentor), lifanov (mentor)
Approved by:	matthew (mentor), lifanov (mentor)
Differential Revision:	https://reviews.freebsd.org/D11089
2017-06-08 01:42:32 +00:00
Baptiste Daroussin
8609431e84 Remove leftovers from groff removal
Reported by:	rpokala
2017-06-07 23:41:33 +00:00
Baptiste Daroussin
738919c039 Remove groff from base
All manpages in base are now compatible with mandoc(1), all roff documentation
will be relocated in the doc tree. man(1) can now use groff from the ports tree
if it needs.

Also remove checknr(1) and colcrt(1) which are only useful with groff.

Approved by:	(no objections on the mailing lists)
2017-06-07 23:00:34 +00:00
Stephen J. Kiernan
366dbfa5c0 The memory assigned to the local variable 'copy' needs to be freed.
Found using clang's static analyzer - scan-build

Submitted by:	Thomas Rix <trix@juniper.net>
Reviewed by:	ed
Approved by:	sjg (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D9663
2017-06-06 21:40:35 +00:00
John Baldwin
b60a095b93 Decode arguments to dup, dup2, getdirentries, pread, and pwrite.
- dup and dup2 print fd arguments in decimal.
- pread and pwrite are similar to read and write with the addition of the
  file offset.
- getdirentries displays the output entries as a string for now and also
  prints the value returned in *basep.  Eventually the buffer for
  getdirentries should perhaps be decoded as an array of dirent
  structures.

PR:		214885
Submitted by:	Jonathan de Boyne Pollard <J.deBoynePollard-newsgroups@NTLWorld.COM>
2017-06-05 05:25:50 +00:00
Colin Percival
0bf051f957 Delete obsolete paragraph; primes(6) is now able to list primes for the
full range up to 2^64 - 1.

MFC after:	1 week
2017-06-04 02:45:18 +00:00
Colin Percival
ade8bcee50 Using results from
J. Sorenson and J. Webster, Strong pseudoprimes to twelve prime
    bases, Math. Comp. 86(304):985-1003, 2017.
teach primes(6) to enumerate primes up to 2^64 - 1.  Until Sorenson
and Webster's paper, we did not know how many strong speudoprime tests
were required when testing alleged primes between 3825123056546413051
and 2^64 - 1.

Reported by:	Luiz Henrique de Figueiredo
Relnotes:	primes(6) now enumerates primes beyond 3825123056546413050,
		up to a new limit of 2^64 - 1.
MFC After:	1 week
2017-06-04 02:36:37 +00:00
John Baldwin
ee8aa41dca Decode the 'who' argument passed to getrusage().
Add a new sysdecode_getrusage_who() which decodes the RUSAGE_* constant
passed as the first argument to getrusage().  Use this function in both
kdump and truss to decode the first argument to getrusage().

PR:		215448
Submitted by:	Anton Yuzhaninov <citrin+pr@citrin.ru>
MFC after:	1 month
2017-06-03 14:22:15 +00:00
John Baldwin
ebb2cc40d1 Decode the argument passed to cap_getmode().
The returned integer value is output.
2017-06-02 22:35:18 +00:00
Stephen J. Kiernan
e2005cef7f Fix a memory leak with last
free memory allocated to 'buf'

Submitted by:	Thomas Rix <trix@juniper.net>
Reviewed by:	ed
Approved by:	sjg (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D9850
2017-06-02 20:25:25 +00:00
John Baldwin
7136a1d97a Decode the arguments passed to __cap_rights_get() and cap_rights_limit().
Submitted by:	tobik
2017-06-02 13:33:50 +00:00