Commit Graph

12207 Commits

Author SHA1 Message Date
Hajimu UMEMOTO
6f53a03868 Revert previous workaround. This problem was fixed
by r290318.
2015-11-05 10:58:19 +00:00
Hajimu UMEMOTO
6ad5f7ca01 Since sa->sa_len doesn't match sizeof(struct sockaddr_dl),
getnameinfo() fails against sockaddr_dl.  This commit is workaround
for this problem.
2015-11-04 19:09:42 +00:00
Hajimu UMEMOTO
3e687cd867 Fix alignment of AF_LINK address. 2015-11-04 19:05:04 +00:00
Hajimu UMEMOTO
86a598950f Simplify r290367 using asterisk for a field width
and precision.
2015-11-04 16:59:12 +00:00
Hajimu UMEMOTO
38f16ca658 Unify AF_INET case and AF_INET6 case. 2015-11-04 15:05:15 +00:00
Hajimu UMEMOTO
bd4fcecaca Change to not truncate an interface name when -W option
is specified.
2015-11-04 14:57:46 +00:00
Hajimu UMEMOTO
38507af333 Mask an IPv6 network address. 2015-11-04 14:47:10 +00:00
Hajimu UMEMOTO
8e2d18a7c5 Restore an interface name field to left align. 2015-11-04 13:59:13 +00:00
Craig Rodrigues
a36eca08bb Rename libohash to libopenbsd.
libopenbsd is an internal library which
to bring in compatibility stuff from OpenBSD.
This will allow us to bring in more
OpenBSD utilities into the FreeBSD base system.

We similarly use libnetbsd for bringing in stuff from NetBSD.

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D4078
2015-11-04 07:20:55 +00:00
Andrey A. Chernov
0755c17500 Check for (old|new)size + 1 overflows off_t.
PR:     204230
MFC after:      1 week
2015-11-03 17:27:24 +00:00
Andrey A. Chernov
8f94ce2876 Use meaningful errno for ssize_t overflow in read().
Catch size_t overflow in malloc().

PR:     204230
MFC after:      1 week
2015-11-03 09:50:10 +00:00
Baptiste Daroussin
3c3feed41a Merge from head 2015-11-01 21:17:38 +00:00
Baptiste Daroussin
d79cdd21de libc: Fix (and improve) nl_langinfo (CODESET)
The output of "locale charmap" is identical to the result of
nl_langinfo (CODESET) for any given locale.  The logic for returning the
codeset was very simplistic.  It just returned portion of the locale name
after the period (e.g. en_FR.ISO8859-1 returned "ISO8859-1").

When softlinks were added to locales, this broke.  e.g.:
   en_US returned ""
   en_FR.UTF8 returned "UTF8"
   en_FR.UTF-8 returned "UTF-8"
   zh_Hant_HK.Big5HKSCS returned "Big5HKSCS"
   zh_Hant_TW.Big5 returned "Big5"
   es_ES@euro returned ""

In order to fix this properly, the named locale cannot be used to
determine the encoding.  This information was almost available in the
rune data.  Unfortunately, all the single byte encodings were listed
as "NONE" encoding.

So I adjusted localedef tool to provide more information about the
encoding.  For example, instead of "NONE", the LC_CTYPE used by
fr_FR.ISO8859-15 is now encoded as "NONE:ISO8859-15".  The locale
handlers now check if the first four characters of the encoding is
"NONE" and if so, treats it as a single-byte encoding.

The nl_langinfo handling of CODESET was adjusting accordingly.  Now the
following is returned:
   en_US returns "ISO8859-1"
   fr_FR.UTF8 returns "UTF-8"
   fr_FR.UTF-8 returns "UTF-8"
   zh_Hant_HK.Big5HKSCS returns "Big5"
   zh_Hant_TW.Big5 returns "Big5"
   es_ES@euro returns "ISO8859-15"

as before, "C" and "POSIX" locales return "US-ASCII".  This is a big
improvement.  The result of nl_langinfo can never be a zero-length
string and it will always exclusively one of the values of the
character maps of /usr/src/tools/tools/locale/etc/final-maps.

Submitted by:	marino
Obtained from:	DragonflyBSD
2015-11-01 12:00:55 +00:00
Ed Schouten
b0e787276b Make truss work for CloudABI processes on aarch64.
This change copies over amd64-cloudabi64.c to aarch64-cloudabi.c and
adjusts it to fetch the proper registers on aarch64. To reduce the
amount of shared code, the errno conversion function is moved into a
separate source file.

Reviewed by:	jhb, andrew
Differential Revision:	https://reviews.freebsd.org/D4023
2015-10-30 08:11:37 +00:00
Bryan Drewery
bd9302d862 Check archive_entry_new() result.
Coverity CID:	1331341
2015-10-29 19:28:21 +00:00
Bryan Drewery
7d8f797b72 Use more appropriate ${SHAREDIR} rather than /usr/share.
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-10-27 23:35:02 +00:00
Xin LI
199c446625 Update NetBSD RCS IDs to reflect the changes being upstreamed.
MFC after:	13 days
X-MFC-With:	r290024
2015-10-27 21:26:05 +00:00
Xin LI
354ed04257 In gunzip(1), treat trailing garbage as a warning and not an error. This
allows scripts to distinguish it between real fatal errors, for instance a
CRC mismatch.

Update manual page for the behavior change.

PR:		bin/203873
Submitted by:	Eugene Grosbein <eugen grosbein net>
MFC after:	2 weeks
2015-10-26 22:29:58 +00:00
David Chisnall
70d7ec6737 Update some obsolete information in the HACKING document.
Reported by:	bapt
2015-10-26 11:02:57 +00:00
David Chisnall
e713ba26f2 Ensure that dtc is built in C++11 mode.
Reported by:	George Abdelmalik
2015-10-26 10:37:17 +00:00
David Chisnall
a0706eb457 Lots of improvements to the BSD-licensed dtc
- Various fixes to includes (including recursive includes)
- Lots of testing that the output exactly matches GPL'd dtc
- Lots of bug fixes to merging
- Fix incorrect mmap usage
- Ad-hoc memory management replaced with C++11 unique_ptr and similar

Patrick Wildt has successfully run many (all?) of the GPL dtc test suite.
2015-10-25 14:52:16 +00:00
Baptiste Daroussin
44a94685f3 timeout(1): fix the acceptable range values for parse_signal()
Before both 0 and sys_nsig would be successfully returned by parse_signal()
although being invalid signal numbers.

PR:		Alexandre Perrin <alex@kaworu.ch>
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D3990
2015-10-24 13:47:03 +00:00
Baptiste Daroussin
902b9f79f7 Fix some mdoc(7) issues
Obtained from:	DragonflyBSD
2015-10-24 13:43:10 +00:00
Michael Tuexen
2a95561f19 Bump date. Missed in r289873.
MFC after:	1 week
X-MFC with:	r289873
2015-10-24 09:41:43 +00:00
Michael Tuexen
1eaa568237 Add support to systat to display SCTP statistics.
MFC after: 1 week
2015-10-24 09:34:40 +00:00
Bryan Drewery
a1a3d6f4c1 Replace gcc reference with 'cc' and document the default ${CC}.
MFC after:	1 week
2015-10-24 05:16:30 +00:00
Simon J. Gerraty
4c620fe5c4 Merge bmake 20151020 2015-10-23 17:38:01 +00:00
Bryan Drewery
58144364e9 dtc needs to be installed if MK_GPL_DTC is not set, which doesn't fit into the
SUBDIR.yes pattern well.

This fixes installation of the BSDL dtc after r288904.

Reported by:	jhibbits
Discussed with:	imp
Sponsored by:	EMC / Isilon Storage Division
2015-10-23 17:24:34 +00:00
Devin Teske
bf7a0eeb92 dpv(1) merged to stable/10 before release/10.2.0
MFC after:	3 days
X-MFC-to:	stable/10
2015-10-23 07:38:34 +00:00
Gabor Kovesdan
a7bc18929d -C and -c allow at most one input file. Ensure this is the case when the
input files are specified through --files0-from.

Submitted by:	tim@OpenBSD
Obtained from:	OpenBSD
MFC after:	1 week
2015-10-22 10:57:15 +00:00
Eitan Adler
463a577b27 Fix a ton of speelling errors
arc lint is helpful

Reviewed By: allanjude, wblock, #manpages, chris@bsdjunk.com
Differential Revision: https://reviews.freebsd.org/D3337
2015-10-21 05:37:09 +00:00
Baptiste Daroussin
4ec37af6c9 getconf(1): Fix typo. _POSIX_V6_LP64_OFFBIG -> _POSIX_V6_LPBIG_OFFBIG.
Submitted by:	Sascha Wildner <saw@online.de>
Obtained from:	DragonflyBSD
MFC after:	3 days
2015-10-19 21:06:30 +00:00
Baptiste Daroussin
71e8badedc Actually only T_ISDIGIT should be flagged as _E4 2015-10-19 14:48:31 +00:00
Baptiste Daroussin
227d35dac0 With regard to ctype, digits (e.g. 0 to 9) and xdigits (the 0 to 9 portion
of hexidecimal numbers) are all considered "numbers".  (Note that while
all digits are numbers, not all numbers are digits).

Enhance localedef to automatically set the "number" characteristic when
it encounters a digit or xdigit definition. This fixes malfunctionning
isalnum(3)

Obtained from:	DragonflyBSD
2015-10-19 14:30:28 +00:00
Baptiste Daroussin
031c294c1d Merge from head 2015-10-19 11:51:10 +00:00
Enji Cooper
550d2b80ec Make libxo depend on libutil because it uses humanize_number after r287111
Remove overlinking in lib/libxo/tests, sbin/savecore, and
usr.bin/{iscsictl,wc,xo}

PR: 203673
Sponsored by: EMC / Isilon Storage Division
2015-10-18 07:30:50 +00:00
Edward Tomasz Napierala
fd3996c90a Remove write-only variable.
Submitted by:	Dominic Marks
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-10-17 16:05:42 +00:00
Edward Tomasz Napierala
1dba27c1bf Add -w flag to iscsictl(8) utility, to make it wait for successfull
session establishment.  Scripting is kind of hard without it.

Reviewed by:	mav@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3872
2015-10-17 13:06:52 +00:00
Jung-uk Kim
a41dab8fc9 Add support for ARM EABI.
MFC after:	1 week
2015-10-16 17:50:36 +00:00
Ed Maste
a4c8dbbd87 mkimg: support fat16b partitions (MBR type 06h)
Reviewed by:	marcel
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3894
2015-10-15 01:09:14 +00:00
Baptiste Daroussin
7d710f0522 Merge from head 2015-10-13 20:57:37 +00:00
Baptiste Daroussin
8833f5e9c2 eliminate need for "print" definition
By having space automatically classified as "print" type, we can
eliminate the print section from ctype src files completely (they
are just "graph" plus "<space>".

Obtained from:	Dragonfly
2015-10-13 20:45:29 +00:00
Baptiste Daroussin
f5dde0166d Commit log from Dragonfly:
FreeBSD extended ctypes to include numbers (e.g. isnumber()) but never
actually implemented it.  The isnumber() function was equivalent to the
isdigit() function in every case.

Now that DragonFly's ctype source files have number definitions, the
number ctype can finally be implemented.  It's given a new flag _CTYPE_N.
The isalnum() and iswalnum() functions have been changed to use this
flag rather than the _CTYPE_D digit flag.

While isalnum(), isnumber(), and their wide equivalents now return
different values in locale cases, the ishexnumber() and iswhexnumber()
functions are unchanged.  They are still aliases for isxdigit() and
iswxdigit().

Also change ctype.h for isdigit and isxdigit to use sbistype like the
other functions.

Obtained from:	dragonfly
2015-10-13 20:43:49 +00:00
Baptiste Daroussin
becbad1f6e Merge from head 2015-10-13 19:44:36 +00:00
Bryan Drewery
8c444cbc45 Simplify syscall generation and ABI source file handling for the build.
This is to make the Makefile more easily extendable for new ABIs.

This also makes several other subtle changes:
  -  The build now is given a list of ABIs to use based on the MACHINE_ARCH or
     MACHINE_CPUARCH.  These ABIs have a related path in sys/ that is used
     to generate their syscalls.  For each ABI to build check for a
     ABI.c, MACHINE_ARCH-ABI.c, or a MACHINE_CPUARCH-ABI.c.  This matches
     the old behavior needed for archs such as powerpc* and mips*.
  -  The ABI source file selection allows for simpler assignment of common
     ABIs such as "fbsd32" from sys/compat/freebsd32, or cloudabi64.
  - Expand 'fbsd' to 'freebsd' everywhere for consistency.
  -  Split out the powerpc-fbsd.c file into a powerpc64-freebsd32.c to be more
     like the amd64-freebsd32.c file and to more easily allow the auto-generation
     of ABI handling to work.
  -  Rename 'syscalls.h' to 'fbsd_syscalls.h' to lessen the ambiguity and
     avoid confusion with syscall.h (such as in r288997).
  -  For non-native syscall header files, they are now renamed to be
     ABI_syscalls.h, where ABI is what ABI the Makefile is building.
  -  Remove all of the makesyscalls config files.  The "native" one being
     name i386.conf was a long outstanding bug.  They were all the same
     except for the data they generated, so now it is just auto-generated
     as a build artifact.
  -  The syscalls array is now fixed to be static in the syscalls header to
     remove the compiler warning about non-extern.  This was worked around
     in the aarch64-fbsd.c file but not the others.
  -  All syscall table names are now just 'syscallnames' since they don't
     need to be different as they are all static in their own ABI files.  The
     alternative is to name them ABI_syscallnames which does not seem
     necessary.

Reviewed by:	ed, jhb
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D3851
2015-10-13 18:23:51 +00:00
Enji Cooper
59e2ff550c Integrate the tests from lib/libarchive, usr.bin/cpio, and usr.bin/tar in to
the FreeBSD test suite

functional_test.sh was ported from bin/sh/tests/functional_test.sh, as a
small wrapper around libarchive_test, bsdcpio_test, and bsdtar_test provided
by upstream.

A handful of testcases in lib/libarchive/tests have been disabled as they
were failing when run with kyua test (see BROKEN_TESTS in
lib/libarchive/tests/Makefile)

As a sidenote: this removes the check/test targets from the Makefiles as they
don't match the pattern used in the rest of the FreeBSD test suite.

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
2015-10-12 18:31:21 +00:00
Peter Wemm
af80ed6add Update from svn-1.8.14 to 1.9.2.
Formal release notes are available:
  https://subversion.apache.org/docs/release-notes/1.9.html

Of particular note, the client checkout format has *not* changed so
upgrades should *not* be required.

When reading a repository (file:// or running as a local server), an
improved fsfs version 7 is available with significant performance
improvements.  An optional upgrade is possible to use the new features.
Without the upgrade, this is fully read/write compatible with the
version 6 fsfs as in svn-1.8.

Relnotes:	yes
2015-10-12 09:53:55 +00:00
Enji Cooper
b2d48be1bc Refactor the test/ Makefiles after recent changes to bsd.test.mk (r289158) and
netbsd-tests.test.mk (r289151)

- Eliminate explicit OBJTOP/SRCTOP setting
- Convert all ad hoc NetBSD test integration over to netbsd-tests.test.mk
- Remove unnecessary TESTSDIR setting
- Use SRCTOP where possible for clarity

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Divison
2015-10-12 08:16:03 +00:00
Bryan Drewery
7096af2e9e Let -c imply -S (hide signal output).
Without this, the signals are shown seemingly randomly in the output before
the final summary is shown.  This is especially noticeable when there is
not much output from the application being traced.

Discussed with:	jhb
Relnotes:	yes
2015-10-09 20:47:29 +00:00
Ed Schouten
808d980506 Properly format pointer size independent CloudABI system calls.
CloudABI has approximately 50 system calls that do not depend on the
pointer size of the system. As the ABI is pretty compact, it takes
little effort to each truss(8) the formatting rules for these system
calls. Start off by formatting pointer size independent system calls.

Changes:

- Make it possible to include the CloudABI system call definitions in
  FreeBSD userspace builds. Add ${root}/sys to the truss(8) Makefile so
  we can pull in <compat/cloudabi/cloudabi_syscalldefs.h>.
- Refactoring: patch up amd64-cloudabi64.c to use the CLOUDABI_*
  constants instead of rolling our own table.
- Add table entries for all of the system calls.
- Add new generic formatting types (UInt, IntArray) that we'll be using
  to format unsigned integers and arrays of integers.
- Add CloudABI specific formatting types.

Approved by:	jhb
Differential Revision:	https://reviews.freebsd.org/D3836
2015-10-08 05:27:45 +00:00
Bryan Drewery
04a97800bf Correct a comment. 2015-10-08 00:31:11 +00:00
Xin LI
65d3abd5e4 Remove support of ancient (pre-8.0R, 800041) FreeBSD releases.
MFC after:	2 weeks
2015-10-07 01:25:47 +00:00
Simon J. Gerraty
bd47c7ec11 Updated depends 2015-10-07 00:43:05 +00:00
Bryan Drewery
195aef9962 truss: Add support for utrace(2).
This uses the kdump(1) utrace support code directly until a common library
is created.

This allows malloc(3) tracing with MALLOC_CONF=utrace:true and rtld tracing
with LD_UTRACE=1.  Unknown utrace(2) data is just printed as hex.

PR:		43819 [inspired by]
Reviewed by:	jhb
MFC after:	2 weeks
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D3819
2015-10-06 21:58:38 +00:00
John Baldwin
f44fc79d0b Group the decoded system calls by ABI and sort the calls within each ABI.
Reviewed by:	bdrewery
Glanced at by:	kib
Differential Revision:	https://reviews.freebsd.org/D3823
2015-10-06 19:31:07 +00:00
Dimitry Andric
4f4bbad316 Upgrade our copies of clang, llvm, lldb, compiler-rt and libc++ to 3.7.0
release.

Please note that from 3.5.0 onwards, clang, llvm and lldb require C++11
support to build; see UPDATING for more information.

Release notes for llvm and clang can be found here:
<http://llvm.org/releases/3.7.0/docs/ReleaseNotes.html>
<http://llvm.org/releases/3.7.0/tools/clang/docs/ReleaseNotes.html>

Thanks to Ed Maste, Andrew Turner and Antoine Brodin for their help.

Exp-run:	antoine
Relnotes:	yes
2015-10-06 17:53:29 +00:00
Enji Cooper
4436b51dff Integrate the tests from libxo into the FreeBSD test suite
The functional_test.sh harness for each test subdir was inspired
by the version in bin/sh/tests/functional_test.sh

Some gymnastics were required to deal with implicit rules for
.c / .o -> .out as the suffix transformation rules were
incorrectly trying to create the test outputs from some of the
source files

Sponsored by: EMC / Isilon Storage Division
2015-10-06 16:58:47 +00:00
Dimitry Andric
88750be440 Merge ^/head r288836 through r288925. 2015-10-06 16:25:13 +00:00
Enji Cooper
7fd25aff6b Use LIBXOSRC instead of LIBXO when defining the path to contrib/libxo
The latter is already defined in bsd.libnames.mk, so avoid the conflict
in case someone copy-pastes make variables

While here, switch path to the top of the source tree with SRCTOP
2015-10-06 07:28:54 +00:00
Warner Losh
3a845236df Start using the fact that SUBDIR.yes is added to SUBDIR
and move from the pattern of:

.if ${MK_FOO} != "no"
SUBDIR+= bar
.endif

to

SUBDIR.${MK_FOO}+= bar

since we know that MK_FOO is always either yes or no and the latter
form is easier to follow and much shorter. Various exception to this
pattern dealt with on an ah-hoc basis.

Discussed on arch@ a while ago.
2015-10-05 21:41:55 +00:00
Bryan Drewery
94746562ff Fix crash if a process sends itself a SIGTRAP. Just forward it as expected.
MFC after:	2 weeks [needs rewrite]
Relnotes:	yes
2015-10-05 21:39:07 +00:00
Dimitry Andric
926b24f309 Merge ^/head r288831 through r288835. 2015-10-05 20:08:11 +00:00
Bryan Drewery
47ff1ba642 Add decoding for modfind(2) 2015-10-05 18:11:30 +00:00
Bryan Drewery
6c61b0f324 Fix tracking of unknown syscalls for 'truss -c'.
This is done by changing get_syscall() to either lookup the known syscall
or add it into the list with the default handlers for printing.

This also simplifies some code to not have to check if the syscall variable
is set or NULL.

Reviewed by:	jhb
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D3792
2015-10-05 18:08:35 +00:00
Dimitry Andric
c710e87b3b Merge ^/head r288457 through r288830. 2015-10-05 17:54:54 +00:00
Bryan Drewery
0a71c082d2 Style fix. 2015-10-03 19:08:36 +00:00
Bryan Drewery
a776866b44 Add decoding for struct statfs.
Reviewed by:	jhb (briefly)
2015-10-03 18:57:15 +00:00
Konstantin Belousov
5821213b4c Add aarch64 support to truss(1).
Reviewed by:	jhb
Discussed with:	emaste (license)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3750
2015-10-02 13:30:56 +00:00
Ed Schouten
2f9ebcc1a5 Make truss print CloudABI system call names.
This change adds the bits that are necessary to fetch system call
arguments and return values from trapframes for CloudABI. This allows us
to properly print system calls with the right name. We need to make sure
that we properly convert error numbers when system calls fail.

We still need to improve truss to pretty-print some of the system calls
that have flags.
2015-10-02 11:17:15 +00:00
Colin Percival
6ae1554a5d Final step of eliminating the "games" distribution: Merge src/games
(or what's left of it, at least) into src/usr.bin.

This change will not be MFCed.

Discussed at:   EuroBSDCon 2014
Committed from: EuroBSDCon 2015
2015-10-02 10:08:11 +00:00
Dimitry Andric
65dcb5bcb1 Merge ^/head r288197 through r288456. 2015-10-01 19:02:45 +00:00
John Baldwin
66917ca9d2 Rather than groveling around in a socket address structure for a socket
address's length (and then overriding it if it "looks wrong"), use the
next argument to the system call to determine the length.  This is more
reliable since this is what the kernel depends on anyway and is also
simpler.
2015-10-01 18:18:58 +00:00
John Baldwin
72df19e7ab The id_t type used to pass IDs to wait6(2) and procctl(6) is a 64-bit
integer.  Fix the argument decoding to treat this as a quad instead of an
int.  This includes using QUAD_ALIGN and QUAD_SLOTS as necessary.  To
continue printing IDs in decimal, add a new QuadHex argument type that
prints a 64-bit integer in hex, use QuadHex for the existing off_t arguments,
repurpose Quad to print a 64-bit integer in decimal, and use Quad for id_t
arguments.

This fixes the decoding of wait6(2) and procctl(2) on 32-bit platforms.
2015-10-01 17:50:41 +00:00
John Baldwin
df438f423d - Remove extra integer argument from truncate() and ftruncate(). This is
probably fallout from the removal of the extra padding argument before
  off_t in 7.  However, that padding still exists for 32-bit powerpc, so
  use QUAD_ALIGN.
- Fix QUAD_ALIGN to be zero for powerpc64.  It should only be set to 1
  for 32-bit platforms that add padding to align 64-bit arguments.
2015-10-01 17:28:07 +00:00
John Baldwin
2b75c8ad3d Several changes to truss.
- Refactor the interface between the ABI-independent code and the
  ABI-specific backends.  The backends now provide smaller hooks to
  fetch system call arguments and return values.  The rest of the
  system call entry and exit handling that was previously duplicated
  among all the backends has been moved to one place.
- Merge the loop when waiting for an event with the loop for handling stops.
  This also means not emulating a procfs-like interface on top of ptrace().
  Instead, use a single event loop that fetches process events via waitid().
  Among other things this allows us to report the full 32-bit exit value.
- Use PT_FOLLOW_FORK to follow new child processes instead of forking a new
  truss process for each new child.  This allows one truss process to monitor
  a tree of processes and truss -c should now display one total for the
  entire tree instead of separate summaries per process.
- Use the recently added fields to ptrace_lwpinfo to determine the current
  system call number and argument count.  The latter is especially useful
  and fixes a regression since the conversion from procfs.  truss now
  generally prints the correct number of arguments for most system calls
  rather than printing extra arguments for any call not listed in the
  table in syscalls.c.
- Actually check the new ABI when processes call exec.  The comments claimed
  that this happened but it was not being done (perhaps this was another
  regression in the conversion to ptrace()).  If the new ABI after exec
  is not supported, truss detaches from the process.  If truss does not
  support the ABI for a newly executed process the process is killed
  before it returns from exec.
- Along with the refactor, teach the various ABI-specific backends to
  fetch both return values, not just the first.  Use this to properly
  report the full 64-bit return value from lseek().  In addition, the
  handler for "pipe" now pulls the pair of descriptors out of the
  return values (which is the true kernel system call interface) but
  displays them as an argument (which matches the interface exported by
  libc).
- Each ABI handler adds entries to a linker set rather than requiring
  a statically defined table of handlers in main.c.
- The arm and mips system call fetching code was changed to follow the
  same pattern as amd64 (and the in-kernel handler) of fetching register
  arguments first and then reading any remaining arguments from the
  stack.  This should fix indirect system call arguments on at least
  arm.
- The mipsn32 and n64 ABIs will now look for arguments in A4 through A7.
- Use register %ebp for the 6th system call argument for Linux/i386 ABIs
  to match the in-kernel argument fetch code.
- For powerpc binaries on a powerpc64 system, fetch the extra arguments
  on the stack as 32-bit values that are then copied into the 64-bit
  argument array instead of reading the 32-bit values directly into the
  64-bit array.

Reviewed by:	kib (earlier version)
Tested on:	amd64 (FreeBSD/amd64 & i386), i386, arm (earlier version)
Tested on:	powerpc64 (FreeBSD/powerpc64 & powerpc)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D3575
2015-09-30 19:13:32 +00:00
John Baldwin
9e07e493b3 Trim trailing whitespace. 2015-09-30 00:08:24 +00:00
John Baldwin
a061e3c50f Decode recently added procctl(2) operations. 2015-09-29 23:54:26 +00:00
Xin LI
05212689bb Use _PATH_DEVNULL instead of direct hardcoding.
MFC after:	2 weeks
2015-09-28 18:19:22 +00:00
Hans Petter Selasky
b27480c68d Store PID after becoming a daemon() and not before to ensure the
correct PID gets written to the PID file.

Submitted by:	Maxime Soule <btik-fbsd@scoubidou.com>
PR:		203252
MFC after:	2 weeks
2015-09-28 07:23:05 +00:00
Michael Reifenberger
27aa47691e Add support to systat to display zfs arc cache status/info
PR:		195460
Submitted by:	ota
2015-09-27 09:15:54 +00:00
Conrad Meyer
0ceadbf05d Revert r288270 to fix the build
Submitted by:	bdrewery
Sponsored by:	EMC / Isilon Storage Division
2015-09-26 20:26:05 +00:00
Bryan Drewery
cfac01438a Hookup mkcsmapper_static and mkesdb_static for all but install.
These are only handled as 'build-tools' in Makefile.inc1.  This causes
'make clean' from the top of the tree to not clean the directories.  It also
effectively has kept them disconnected and risks them bitrotting.  The
buildworld process never cleans them either.

Connect them so they will always be built, cleaned, etc, but never installed.

Discussed with:	imp (briefly)
Sponsored by:	EMC / Isilon Storage Division
2015-09-26 14:28:04 +00:00
Bryan Drewery
595fe15108 Add more SUBDIR_PARALLEL.
MFC after:	3 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-09-26 14:13:51 +00:00
Ed Maste
209e744f89 xinstall: renumber UCB clauses to avoid skipping #3 2015-09-25 20:25:18 +00:00
Bryan Drewery
ec766071e3 META_MODE: Remove DEP_MACHINE from Makefile.depend files.
This has not been needed since r246865 in projects/bmake.

Sponsored by:	EMC / Isilon Storage Division
2015-09-25 19:44:01 +00:00
Bryan Drewery
54c7d75a06 META_MODE: Remove DEP_RELDIR from Makefile.depend files.
This has not been needed since r284171 in projects/bmake.

Sponsored by:	EMC / Isilon Storage Division
2015-09-25 19:26:08 +00:00
Bryan Drewery
660d1f65bb Add missing CLEANFILES.
MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2015-09-24 23:15:24 +00:00
Dimitry Andric
98e67009c0 Merge ^/head r288126 through r288196. 2015-09-24 21:48:04 +00:00
Ed Maste
453b09caf5 Rename ELFOSABI_SYSV to ELFOSABI_NONE to match current spec
Source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3731
2015-09-24 21:04:48 +00:00
Bryan Drewery
2254894222 Similar to r266147, don't define PROG in the test subdirs.
Magic things happen when including bsd.prog.mk in them.

Sponsored by:	EMC / Isilon Storage Division
2015-09-23 21:35:58 +00:00
Ed Maste
050747f2c3 elfdump: report MIPS ELF section type SHT_MIPS_REGINFO
Sponsored by:	The FreeBSD Foundation
2015-09-23 00:32:38 +00:00
Dimitry Andric
26e065d02e Merge ^/head r288035 through r288099. 2015-09-22 09:50:11 +00:00
Ed Maste
4db90148e1 elfdump: report MIPS-specific section type SHT_MIPS_ABIFLAGS
Sponsored by:	The FreeBSD Foundation
2015-09-22 01:45:43 +00:00
Alexander Motin
61639a0a3f Bunch of improvements to ctlstat.
Add -p option to allow filtering by ports.
Make -l and -p options work in all modes as filters.
Improve output formatting to better fit columns.
2015-09-21 09:37:49 +00:00
Alexander Motin
2eb293b996 Output times as normal microseconds, rather then in bintime format. 2015-09-20 21:06:37 +00:00
Dimitry Andric
ae2d96ab3a Merge ^/head r287878 through r288034. 2015-09-20 20:34:17 +00:00
Bryan Drewery
6fcd667fd6 Connect sesutil(1) and numactl(1) for META_MODE.
Sponsored by:	EMC / Isilon Storage Division
2015-09-19 17:47:36 +00:00
Baptiste Daroussin
449a792dd5 Restore man -t for manpages rendered by mandoc
Reported by:	swills
2015-09-19 16:00:50 +00:00
Bryan Drewery
e56d20da9d Don't hide build commands. 2015-09-18 21:01:52 +00:00
Bryan Drewery
42c4cf86d4 Update META_MODE dependencies. 2015-09-17 05:06:34 +00:00
Dimitry Andric
a1cb6af119 Merge ^/head r287680 through r287877. 2015-09-16 22:35:59 +00:00
Edward Tomasz Napierala
d051ac804a Make it clear that 'swapuse' is swap reservation and not actual swap usage.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-09-14 15:37:19 +00:00
Dimitry Andric
0e1e5c22c2 Merge ^/head r287527 through r287679. 2015-09-11 17:20:03 +00:00
Mark Johnston
9eddb899d9 Use a common subroutine to fetch and zero protocol stats instead of
duplicating roughly similar code for each protocol.

MFC after:	2 weeks
2015-09-11 04:37:01 +00:00
Mark Johnston
2bdd6ea2ad Remove prototypes for undefined functions from netstat.h. 2015-09-11 04:02:05 +00:00
Mark Johnston
d73ce4c698 Remove the v_cache_min and v_cache_max sysctls. They are unused and have
no effect.

Reviewed by:	alc
Sponsored by:	EMC / Isilon Storage Division
2015-09-11 03:00:20 +00:00
Xin LI
60b0aa6a8f login.c doesn't really need libutil.h, don't include it.
login_fbtab.c includes paths.h and pathnames.h, and pathnames.h includes
paths.h.  Eliminate the paths.h inclusion in login_fbtab.c.

MFC after:	2 weeks
2015-09-10 22:25:40 +00:00
Xin LI
1e902b3b7e - Avoid accessing window properties directly, instead, use accessors.
This should be no-op for now, but allows the code to work if we
   move to NCURSES_OPAQUE.
 - Use calloc() instead of malloc+bzero.

MFC after:	2 weeks
2015-09-10 22:07:52 +00:00
Xin LI
ab9cee11d6 w(1) is not setgid binary since r53279, so remove the setgid() call.
Reviewed By:	wollman
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D3541
2015-09-09 05:17:04 +00:00
Dimitry Andric
cfab224f31 Merge ^/head r287502 through r287526. 2015-09-06 22:05:55 +00:00
Dimitry Andric
999971f7f7 Minimize the number of files compiled for clang only (e.g. when neither
WITH_CLANG_EXTRAS nor WITH_LLDB is in effect).
2015-09-06 22:02:13 +00:00
Allan Jude
dafe59a9ec Fix inverted output re: stack protection no-execute flag in procstat(1)
PR:		196110
Submitted by:	Joerg Pernfuss <code.jpe@gmail.com>
Approved by:	bapt (mentor)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D3576
2015-09-06 17:47:03 +00:00
Dimitry Andric
1757ba14bf Merge ^/head r287490 through r287501. 2015-09-06 12:02:28 +00:00
Allan Jude
3491f5d422 Fix build error on gcc platforms
Approved by:	bapt (mentor)
2015-09-05 19:28:41 +00:00
Dimitry Andric
d9442b10a2 Merge ^/head r286858 through r287489. 2015-09-05 18:36:23 +00:00
Allan Jude
474b62b876 Introduce libxo to procstat(1)
Reviewed by:	rodrigc, bapt
Approved by:	marcel (mentor)
Relnotes:	yes
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D2446
2015-09-05 17:02:01 +00:00
Marcelo Araujo
aa44f2ed5e Rename YP to NIS in the manpages.
Approved by:		bapt (mentor)
Differential Revision:	D3555
2015-09-03 07:18:52 +00:00
Hiroki Sato
81dacd8beb Simplify kvm symbol resolution and error handling. The symbol table
nl_symbols will eventually be organized into several modules depending
on MK_* variables.
2015-09-02 18:51:36 +00:00
Hiroki Sato
a261e36179 Divide statistics in the number of packets with 1000 instead of 1024
in human-readable form.

PR:	183598
2015-09-02 18:42:35 +00:00
Hiroki Sato
10d5269ff9 - Add -W flag support for network column in intpr() (-i flag) and
routepr() (-r flag).  It is too narrow to show an IPv6 prefix
  in most cases.

- Accept "local" as a synonym of "unix" in protocol family name.

- Show a prefix length in CIDR notation when name resolution failed in
  netname().

- Make routename() and netname() AF-independent and remove
  unnecessary typecasting from struct sockaddr.

- Use getnameinfo(3) to format L2 addr in intpr().

- Fix a bug which showed "Address" when -A flag is specfied in pr_rthdr().

- Replace cryptic GETSA() macro with SA_SIZE().

- Fix declarations shadowing local variables with the same names.

- Add more static, remove unused header files and variables.

MFC after:	1 week
2015-09-01 08:42:04 +00:00
Xin LI
0a107daff7 Drop group privileges after opening the kvm descriptor, otherwise, the code
would not drop privileges as expected.

While there also add checks for the drop and bail out immediately if we
failed.

MFC after:	3 days
2015-09-01 06:28:16 +00:00
Xin LI
a4a889a0ef Failure of dropping privilege should be fatal, so test and bail out
when setgid() fails.

Reported by:	clang static analyzer
MFC after:	2 weeks
2015-09-01 06:05:43 +00:00
Ed Maste
a1f0b4cf95 vtfontcvt: fix buffer overflow for non-default size .hex fonts
Sponsored by:	The FreeBSD Foundation
2015-09-01 01:35:43 +00:00
Ed Maste
2e268aa950 vtfontcvt: introduce xmalloc to abort on out-of-memory
Sponsored by:	The FreeBSD Foundation
2015-08-31 23:08:39 +00:00
Ed Maste
a84c4d189b ar: Deobfuscate a while loop 2015-08-31 18:07:17 +00:00
Ed Maste
a64a36e280 ar: fix deterministic mode when running as ranlib
This was broken by r286024.

PR:		202741
Submitted by:	fk@fabiankeil.de
Obtained from:	ElectroBSD
2015-08-31 12:28:13 +00:00
Xin LI
32e49abef0 - uri is expected to be nul-terminated (strchr used later),
so use strlcpy instead of strncpy.
 - unroll the other two cases of strncpy+\0 to strlcpy.

MFC after:	2 weeks
2015-08-31 06:11:39 +00:00
Xin LI
670f01434e Constify opt_f and opt_t and eliminate unneeded copying. This fixes
memory leaks.

Reported by:	clang static analyzer
MFC after:	2 weeks
2015-08-31 05:57:26 +00:00
Michael Tuexen
0835304fea Use the userland exported states and handle them completely. 2015-08-29 09:27:29 +00:00
Michael Tuexen
c1eb13c74c Report CLOSED as state for bound sockets for consistency with
netstat and the way TCP is handled.

PR:		201585
MFC after:	3 weeks
2015-08-29 09:10:52 +00:00
John-Mark Gurney
e7ae88eeda add documentation for timers that silby added in r197244, almost 6 years
ago...
2015-08-27 19:12:42 +00:00
Ed Schouten
bc1ace0b96 Decompose linkat()/renameat() rights to source and target.
To make it easier to understand how Capsicum interacts with linkat() and
renameat(), rename the rights to CAP_{LINK,RENAME}AT_{SOURCE,TARGET}.

This also addresses a shortcoming in Capsicum, where it isn't possible
to disable linking to files stored in a directory. Creating hardlinks
essentially makes it possible to access files with additional rights.

Reviewed by:	rwatson, wblock
Differential Revision:	https://reviews.freebsd.org/D3411
2015-08-27 15:16:41 +00:00
Alexander Kabaev
93f422607b Unbreak nvi message catalog generation for 8 bit locales.
Feeding any file encoded in 8 bit locales such as KOI8-RU
to sort utility running under UTF-8 locale produces astonishing
result of recoding the output to UTF-8. To counter that, just
run sort under 'C' locale for now.
2015-08-27 14:00:16 +00:00
Michael Tuexen
6414db1bc4 Add SCTP support.
PR:		201585
MFC after:	3 weeks
2015-08-26 23:45:06 +00:00
Michael Tuexen
6eb1d5ba64 Remove a variable which is set but never used.
PR:		201585
MFC after:	3 weeks
2015-08-26 22:52:18 +00:00
Michael Tuexen
4e13a5b043 Print the status on the first line of a socket description, not at
the last one. This doesn't matter for TCP, but it does for the upcoming
SCTP support.

PR:		201585
MFC after:	3 weeks
2015-08-26 22:50:53 +00:00
Sergey Kandaurov
d7deff23cd Fix SEE ALSO.
The history mechanism applies to csh.

Sponsored by:	Nginx, Inc.
2015-08-26 11:54:40 +00:00
Baptiste Daroussin
23a32822d2 Merge from HEAD 2015-08-25 20:14:50 +00:00
Marcelo Araujo
58458d066f Sync ypwhich(1) code with the OpenBSD version that is more modern.
Update the BSD LICENSE and remove the 3rd clause.

Reviewed by:	rodrigc, kib, bapt
Approved by:	bapt (mentor)
Obtained from:	OpenBSD
Differential Revision:	D3249
2015-08-25 15:27:32 +00:00
Xin LI
f2f9b434b6 Finish r89633 and completely remove the remaining of VERSION.
PR:		bin/202308
Submitted by:	John Hein <z7dr6ut7gs snkmail com>
MFC after:	2 weeks
2015-08-25 05:31:00 +00:00
Marcel Moolenaar
d1a0d267b7 Upgrade libxo to 0.4.5.
Local changes incorporated by 0.4.5: r284340
Local changes retained: r276260, r282117

Obtained from:	https://github.com/Juniper/libxo
2015-08-24 16:26:20 +00:00
Xin LI
9242719ed3 Although the website [1] says US-ASCII is accepted, ISO-8859-1 seems to
be the only accepted character that is close enough to US-ASCII (and
this is also done on OpenBSD; the alternative would be to use UTF-8).

[1] http://www.denic.de/en/domains/technik/denic_whois-server/index.html

MFC after:	2 weeks
2015-08-23 08:22:00 +00:00
Enji Cooper
46e352ca51 Fix the racy xargs -P0 -n2 test added in r286289
Sort the output obtained from xargs and the expected output
to ensure the end result versus the input file is stable

Differential Revision: D3432
Submitted by: Nikolai Lifanov <lifanov@mail.lifanov.com>
2015-08-21 18:42:57 +00:00
Enji Cooper
3cfe782429 Disable the -P0 test
It's unreliable (sometimes it passes, sometimes it fails)

Reported by: Jenkins (many times over the past few weeks)
2015-08-21 17:47:17 +00:00
John Baldwin
68055893c1 Handle the conditional decoding of execve() argument and environment
arrays generically rather than duplicating a hack in all of the backends.
- Add two new system call argument types and use them instead of StringArray
  for the argument and environment arguments execve and linux_execve.
- Honor the -a/-e flags in the handling of these new types.
- Instead of printing "<missing argument>" when the decoding is disabled,
  print the raw pointer value.
2015-08-20 14:51:11 +00:00
John Baldwin
890843c15b Rework the argv and env string fetching for execve to be more robust.
Before truss would fetch 100 string pointers and happily walk off the end
of the array if it never found a NULL.  This also means for a short argv
list it could fail entirely if the 100 string pointers spanned into an
unmapped page.

Instead, fetch page-aligned blocks of string pointers in a loop fetching
each string until a NULL is found.

While here, make use of the open memstream file descriptor instead of
allocating a temporary array.  This allows us to fetch each string once
instead of twice.
2015-08-20 14:33:30 +00:00
John Baldwin
b38fbc2e54 ino_t is unsigned, so use uintmax_t instead of intmax_t when printing it.
Submitted by:	bde (sort of)
2015-08-19 20:10:58 +00:00
John Baldwin
a143677385 Always use %j with an intmax_t cast to print time_t values. time_t is
longer than long on 32-bit platforms with a 64-bit time_t.

Inspired by:	mail from bde
2015-08-19 20:09:14 +00:00
John Baldwin
4e3da534fc Various style and whitespace fixes. 2015-08-19 20:02:03 +00:00
John Baldwin
9346bf6f4a Use nitems(). 2015-08-19 19:59:42 +00:00
John Baldwin
c915ff0349 Expand the decoding of kevent structures.
- Print the ident value as decimal instead of hexadecimal for filter types
  that use "small" values such as file descriptors and PIDs.
- Decode NOTE_* flags in the fflags field of kevents for several system
  filter types.
2015-08-19 01:44:56 +00:00
John Baldwin
f083f6894c Change the argument formatting function to use a stdio FILE object opened
with open_memstream() to build the string for each argument.  This allows
for more complicated argument building without resorting to intermediate
malloc's, etc.

Related, the strsig*() functions no longer return allocated strings but
use a static global buffer instead.
2015-08-19 00:49:50 +00:00
Pedro F. Giffuni
c8060fafd4 Correct All Saints' day.
Thanks to:	zec
X-MFC with:	r286891
2015-08-18 15:50:02 +00:00
Pedro F. Giffuni
b542033478 Calendar: add a few more dates to the Christian calendar
The many christian denominations have different dates for their
celebrations and controversies are likely to be always.

These are well established and happen to be holidays in many
Catholic countries.

MFC after:	1 month
2015-08-18 15:11:41 +00:00
Christian Brueffer
520bb99704 RIP Stefan Farfeleder (stefanf), committer since 2004.
You will be missed!
2015-08-18 12:27:21 +00:00
John Baldwin
e462b12755 Use an xlat table and xlookup() instead of a home-rolled version for the
sigprocmask operation type.
2015-08-17 19:08:48 +00:00
Dimitry Andric
6fdf637e23 Merge ^/head r286697 through r286857. 2015-08-17 19:02:23 +00:00
John Baldwin
fb7eabb0bf Tidy the linux_socketcall decoding:
- Don't exit if get_struct() fails, instead print the raw pointer value to
  match all other argument decoding cases.
- Use an xlat table instead of a home-rolled switch for the operation name.
- Display the nested socketcall args structure as a structure instead of as
  two inline arguments.
2015-08-17 18:47:39 +00:00
John Baldwin
c9c2e2dc06 Decode the optional SOCK_NONBLOCK and SOCK_CLOEXEC flags passed in a
socket type.
2015-08-17 17:57:01 +00:00
John Baldwin
b289a8d78a - Decode the arguments for several signal-related system calls: sigpending,
sigqueue, sigreturn, sigsuspend, sigtimedwait, sigwait, sigwaitinfo, and
  thr_kill.
- Print signal sets as a structure (with {}'s) and in particular use this to
  differentiate empty sets from a NULL pointer.
- Decode arguments for some other system calls: issetugid, pipe2, sysarch
  (operations are only decoded for amd64 and i386), and thr_self.
2015-08-17 17:52:28 +00:00
Alexander Motin
2f444d157b Drop "internal" CTL frontend.
Its idea was to be a simple initiator and execute several commands from
kernel level, but FreeBSD never had consumer for that functionality,
while its implementation polluted many unrelated places..
2015-08-15 13:34:38 +00:00
Xin LI
e678759c30 Remove automatic checkout feature.
Obtained from:	DragonFly via OpenBSD
Relnotes:	yes
MFC:		never
2015-08-15 00:42:33 +00:00
Rui Paulo
25ec8c921c Introduce a new make variable: NMFLAGS.
As the name indicates, these are flags to pass to nm(1).  The newer
binutils have a plugin mechanism so, to build something with LLVM's
LTO, we need to pass flags to nm(1).  This commit also extends
lorder(1) to pass NMFLAGS to nm(1).
2015-08-14 22:54:52 +00:00
Ed Maste
1bc28ffccd Roll WITHOUT_ELFTOOLCHAIN_TOOLS into WITHOUT_TOOLCHAIN
The option was added only to ease the transition from GNU Binutils to
ELF Tool Chain tools, and that process is now complete (for the viable
replacements). Noting the removal in UPDATING is sufficient as we have
not shipped a release with the option.

Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3240
2015-08-13 17:50:47 +00:00
Marcelo Araujo
07c1d44f87 Use nitems instead of "sizeof ypaliases/sizeof ypaliases[0]".
Make the if statement more expressive.

Differential Revision:	D3366
Reviewed by:		ed
Approved by:		bapt, rodrigc (mentor)
2015-08-13 02:36:37 +00:00
Dimitry Andric
f98ee84465 Merge ^/head r286422 through r286684. 2015-08-12 18:39:49 +00:00
Dimitry Andric
875ed54817 Update llvm/clang to r242221. 2015-08-12 18:31:11 +00:00
Christian Brueffer
99d43aee11 Fix a few mandoc warnings.
MFC after:	1 week
2015-08-12 10:34:05 +00:00
Xin LI
812aa46f45 Use __DECONST instead of doing strdup/free.
Suggested by:	ed
MFC after:	2 weeks
2015-08-11 05:58:33 +00:00
Pedro F. Giffuni
6bc3fe5f4e Clean out some externally visible "more then" grammar
MFC after:	3 days
2015-08-11 03:12:09 +00:00
Pedro F. Giffuni
bf3e4dcf34 xlint(1): Fix some typos in comments and translate some german
No functional change.

Obtained from:	OpenBSD (where xlint is no more)
2015-08-11 02:58:33 +00:00
Marcelo Araujo
d6bd41a3ac More style(9) fixes. No functional changes.
Differential Revision:	D3350
Reviewed by:		ed
Approved by:		bapt (mentor)
2015-08-11 01:02:17 +00:00
Xin LI
2cf624f68a use posix_spawn(3) instead of fork() and exec() manually as suggested
by jmg@.

Reviewed By:	pfg
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D3353
2015-08-10 21:31:50 +00:00
Ed Maste
728fb54dde Use consistent style for optional subdirectories
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3356
2015-08-10 20:19:10 +00:00
Ed Maste
9138b6e04a Remove ${_subdir}s that are never set
The MK_NIS subdirs were leftovers from r212558 and kdump/truss were
introduced in r240404.

Sponsored by:	The FreeBSD Foundation
2015-08-10 19:41:31 +00:00
Peter Wemm
2e1f24485a Add a #ifndef around the HAVE_ICONV settings since it is supplied
by the Makefile.
2015-08-10 00:53:45 +00:00
Peter Wemm
92ec33c978 Don't assume iconv is enabled. I didn't realize there was a configuration
control to turn it off and it wasn't being respected.

Pointed out by:	gshapiro
2015-08-10 00:46:24 +00:00
Baptiste Daroussin
0c648b8384 Pet mandoc -Tlint 2015-08-09 13:20:53 +00:00
Peter Wemm
a71854bd7c Fix typo introduced in r275079 2015-08-09 05:38:31 +00:00
Peter Wemm
19f868bc90 Update svnlite from 1.8.10 to 1.8.14. This is mostly for client-side bug
fixes and quality of life improvements.
While there are security issues in this time frame that affect usage as a
server (eg: linked into apache), this isn't possible here.
2015-08-09 05:22:53 +00:00
Peter Wemm
15cc9ee534 Update apr-util config - I don't believe this part is used by svn, but
if it were, use shm_* instead of sysvshm.
2015-08-09 05:15:28 +00:00
Peter Wemm
84a48fac94 Update apr-1.5.1 to 1.5.2 2015-08-09 05:14:25 +00:00
Baptiste Daroussin
764a768e16 Merge from HEAD 2015-08-09 00:15:17 +00:00
Baptiste Daroussin
3a444dbdbf Convert localedef(1) from avl to RB trees 2015-08-08 22:57:17 +00:00
Baptiste Daroussin
e30c75b1f5 Prefer static generation of functions 2015-08-08 22:01:54 +00:00
Baptiste Daroussin
6131dc6a88 Convert ctype generation to Red Black tree 2015-08-08 21:53:02 +00:00
Baptiste Daroussin
1fbfaeef7e Remove colldef which is not needed anymore 2015-08-08 20:08:09 +00:00
Baptiste Daroussin
c2d5d37b67 Remove mklocale which is not needed anymore 2015-08-08 20:07:32 +00:00
Allan Jude
c782f6f05e fix regression in xargs -Px (introduced in r286289) and add regression tests
PR:		202152
Submitted by:	jbeich (original),  Nikolai Lifanov (final)
Reviewed by:	jbeich
Approved by:	bapt (mentor)
Differential Revision:	https://reviews.freebsd.org/D3330
2015-08-08 18:37:20 +00:00
Edward Tomasz Napierala
840a09d240 Fix interaction between libedit initialization and Capsicum
in units(1). The most visible is the removal of libedit warnings
about being unable to open termcap database.

Reviewed by:	eadler@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3322
2015-08-08 10:38:37 +00:00
Baptiste Daroussin
057ca2d437 Add localedef(1), a locale definition generator tool
The localedef tool can read entire (and unmodified) CLDR posix definition
files, and generate all 6 LC categories: LC_COLLATE, LC_CTYPE, LC_TIME,
LC_NUMERIC, LC_MONETARY and LC_MESSAGES.

This tool has a long history with Solaris.  The Nexenta developers
modified it to read CLDR files and created the much richer collation
formats.  The libc collation functions have to be modified to read the
new format (called "BSD-1.0") and to handle the new data structures.

The result will be that locale-sensitive tools and functions will now
properly sort multibyte and unicode strings.

Obtained from:	Dragonfly
2015-08-07 23:53:31 +00:00
Dimitry Andric
1347814ced Merge ^/head r285924 through r286421. 2015-08-07 20:18:55 +00:00
Marcel Moolenaar
8f1d6b6915 Fix typo introduced in previous commit.
Pointed out by: Nikolai Lifanov <lifanov at mail.lifanov.com>
2015-08-07 18:40:44 +00:00
Marcel Moolenaar
de93252622 o Fix a typo.
o  Describe the file formats mkimg can create.
2015-08-07 17:22:37 +00:00
Marcelo Araujo
b47f904d8f Remove an extra new line on usage().
Rename domain to domainname to be identical to the man page.

Reported by:	bde
2015-08-07 07:05:47 +00:00
Marcel Moolenaar
9286ca0227 Rebase after r286395: rounding fix for dynamic VHD 2015-08-07 04:35:43 +00:00
Marcel Moolenaar
c20f01c4ea Fix the dynamic VHD format to work with qemu. The size of the disk
is taken to match the geometry and only when the geometry is max'd
out, is the actual recorded size taken.

Note that qemu has the same logic for the fixed VHD format. However
that is known to conflict with Microsoft Azure, where the recorded
size of the image is what counts.

Pointed out by: gjb@
2015-08-07 04:27:51 +00:00
Marcelo Araujo
e6330ffeee Get closest as possible with style(9). No functional change.
Differential Revision:	D3295
Reviewed by:		bapt
2015-08-07 02:37:47 +00:00
John Baldwin
1e2ec671fc Consistently use both leading and trailing spaces inside of the {}'s
when pretty-printing structures.  Most structures used both spaces,
but some only used a trailing space and some used neither.
2015-08-06 20:05:40 +00:00
John Baldwin
0a46af44bf Whitespace fixes to consistently use spaces before }'s and
wrap long lines.
2015-08-06 19:36:47 +00:00
John Baldwin
7d89732757 Decode the arguments passed to the *at() family of system calls. This is
especially useful now that libc's open() always calls openat().  While here,
fix a few other things:
- Decode the mode argument passed to access(), eaccess(), and faccessat().
- Decode the atfd paramete to pretty-print AT_FDCWD.
- Decode the special AT_* flags used with some of the *at() system calls.
- Decode arguments for fchmod(), lchmod(), fchown(), lchown(), eaccess(),
  and futimens().
- Decode both of the timeval structures passed to futimes() instead of just
  the first one.
2015-08-06 19:08:33 +00:00
John Baldwin
e82ce59c37 Decode the arguments to mkfifo() and fix an off-by-one error in the arguments
to mknod().
2015-08-06 18:32:32 +00:00
John Baldwin
19d637849e Don't mark the fcntl flag argument as an output parameter so that it is
always decoded.  Previously the argument was not decoded if fcntl() failed.
2015-08-06 18:28:15 +00:00
John Baldwin
d98d7ba0b4 Add recently added values of various flags and enumerations including
kevent filters, kevent flags, flags to mmap, seek locations, fcntl
operations, file flags, socket domains, open flags, resource limits, and
pathconf values.
2015-08-06 01:49:18 +00:00
Xin LI
3fd78bfab2 Fix shell injection vulnerability in patch(1) via ed(1) by
tightening sanity check of the input. [1]

While I'm there also replace ed(1) with red(1) because we do
not need the unrestricted functionality. [2]

Obtained from:	Bitrig [1], DragonFly [2]
Security:	CVE-2015-1418 [1]
2015-08-05 22:04:54 +00:00
Jilles Tjoelker
a2925a5ae3 find: Fix segfault with very long path in -exec/-ok ... {} \;.
If the resulting argument is longer than MAXPATHLEN, realloc() was called to
extend the space, but the new pointer was not correctly stored.

Different from what OpenBSD has done, rewrite brace_subst() to calculate the
necessary space first and realloc() at most once.

As before, the e_len fields are not updated in case of a realloc.
Therefore, a following long argument will do another realloc.

PR:		201750
MFC after:	1 week
2015-08-05 21:33:30 +00:00
John Baldwin
abb3f965d1 Rework get_string() to make it more robust when fetching strings of unknown
length.  In particular, instead of blinding fetching 1k blocks, do an initial
fetch up to the end of the current page followed by page-sized fetches up to
the maximum size.  Previously if the 1k buffer crossed a page boundary and
the second page was not valid, the entire operation would fail.
2015-08-05 18:14:01 +00:00
John Baldwin
7582c8ea08 Whitespace fix: remove some spurious spaces before commas. 2015-08-05 18:10:46 +00:00
Allan Jude
e896b4a4f0 xargs now takes -P0, creating as many concurrent processes as possible
PR:		199976
Submitted by:	Nikolai Lifanov <lifanov@mail.lifanov.com>
Reviewed by:	mjg, bjk
Approved by:	bapt (mentor)
MFC after:	1 month
Relnotes:	yes
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D2616
2015-08-04 14:27:25 +00:00
Marcelo Araujo
c52bab1135 Get it closes to style(9).
Staticization usage() and printit().
Fix the usage of err(3).

Reviewed by:	bde
2015-08-04 07:04:36 +00:00
Pedro F. Giffuni
a8126b4c70 Revert r286144 leaving the original fix to the buffer overflow.
Some developers consider the new code unnecessarily obfuscated.
There was also a benign off-by-one.

Discussed with:	bde, vangyzen, jmallett
2015-08-04 02:56:31 +00:00
Marcelo Araujo
c1f70e3747 Remove the 3rd clause of BSD LICENSE.
Sync the code with the OpenBSD version.
Small style(9) fix up.

Differential Revision:	D3212
Reviewed by:		rodrigc, bapt
Obtained from:		OpenBSD
Sponsored by:		gandi.net
2015-08-04 02:41:14 +00:00
Marcelo Araujo
eb2e6d158d Remove the 3rd clause of BSD LICENSE.
Sync the code with the OpenBSD version.

Differential Revision:	D3213
Reviewed by:		rodrigc, bapt
Obtained from:		OpenBSD
Sponsored by:		gandi.net
2015-08-04 02:34:51 +00:00
Baptiste Daroussin
5c23d0ee98 Remove never used file
Obtained from:	DragonFlyBSD
2015-08-03 18:47:45 +00:00
Marcel Moolenaar
ddaceed224 Make image_copyout_zeroes() an interface function. 2015-08-03 01:24:48 +00:00
Jason Unovitch
0697ab6ec0 - Add myself to the calendar.freebsd. (fix typo in r286160)
Approved by:	delphij (mentor)
Differential Revision:	https://reviews.FreeBSD.org/D3265
2015-08-01 17:48:35 +00:00
Jason Unovitch
994cfa1f63 - Add myself to the committers-ports.dot and add my mentor relationship.
- Add myself to the calendar.freebsd.

Approved by:	delphij (mentor)
Differential Revision:	https://reviews.FreeBSD.org/D3265
2015-08-01 17:29:52 +00:00
John-Mark Gurney
c47f6acf73 use : instead of true...
Change file file to file1 file2, partly for igor, and partly because
it's odd to pass the same file to a command twice..
2015-08-01 17:27:47 +00:00
Pedro F. Giffuni
fc9ce3812d Buffer overflow in wall(1).
Revert r286102 and apply a cleaner fix.
Tested for overflows by FORTIFY_SOURCE GSoC (with clang).

Suggested by:	bde
Reviewed by:	Oliver Pinter
Tested by:	Oliver Pinter
MFC after:	3 days
2015-08-01 01:29:55 +00:00
Ed Maste
ad6fe9fac7 Use standard 'THE AUTHOR' license text
Approved by:	jmg
2015-07-31 16:45:42 +00:00
Pedro F. Giffuni
479184e919 Buffer overflow in wall(1).
This affected syslogd, wall and talkd.
Detected by FORTIFY_SOURCE GSoC (with clang).

Submitted by:	Oliver Pinter
Differential Revision:	https://reviews.freebsd.org/D3254
Reviewed by:	delphij, jmg
MFC after:	3 days
2015-07-31 01:12:31 +00:00
Craig Rodrigues
4ed2d460bd Use correct number of arguments to semctl() for IPC_RMID.
PR:			118292
Submitted by:		araujo
Differential Revision:	D2669
2015-07-30 19:44:46 +00:00
Craig Rodrigues
bc81f73771 Get function prototypes for msg, shm, sem functions
from header files.

Differential Revision: D2669
2015-07-30 18:59:01 +00:00
Craig Rodrigues
2736982e9b Make some variables and functions static. 2015-07-30 18:08:08 +00:00
Ed Maste
5ea9e83e2f Allow ELF Tool Chain elfcopy to be installed as objcopy
ELF Tool Chain elfcopy is nearly a drop-in replacement for GNU objcopy,
but does not currently support PE output which is needed for building
x86 UEFI bits.

Add a src.conf knob to allow installing it as objcopy and set it by
default for aarch64 only, where we don't have a native binutils.

Reviewed by:	bapt
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D2887
2015-07-29 18:45:38 +00:00
Ed Maste
a80ac30b2d ar: Fix deterministic mode default with options other than -q or -r
Reported by:	jhibbits
Reviewed by:	jhibbits
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3237
2015-07-29 17:34:26 +00:00
Ed Maste
fc964cbf4e ar: enable deterministic mode by default
Ar cannot handle UIDs with more than 6 digits, and storing the mtime,
uid, gid and mode provides little to negative value anyhow for ar's
uses. Turn on deterministic (-D) mode by default; it can be disabled by
the user with -U.

PR:		196929
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3190
2015-07-29 13:36:17 +00:00
Marcelo Araujo
006a388bb6 Compilers will complain the usage of obsolescent variable declarations.
Also it will fix the build problem with sparc64.

Submitted by:	ed@
2015-07-29 02:21:35 +00:00
Xin LI
1e3e581593 Fix shell injection vulnerability in patch(1) and drop SCCS
support by replacing system() with execve().

Future revisions may remove the functionality completely.

Obtained from:	Bitrig
Security:	CVE-2015-1416
2015-07-28 19:58:36 +00:00
Marcelo Araujo
033af09de1 Staticfy and constify some variables and clean up the code a bit to make it
more readable. No functional change.

Differential Revision:	D3166
Reviewed by:		kib
Sponsored by:		gandi.net
2015-07-28 02:32:40 +00:00
Dimitry Andric
5f78ec1c9f Merge ^/head r285793 through r285923. 2015-07-27 22:20:28 +00:00
Xin LI
7d477dc35a Rewrite scan procedure with a FSM. This improves code readability by
making clear transits between different states, and avoids bug with
handling repeated $'s.

Reviewed by:	bapt
Differential Revision: https://reviews.freebsd.org/D3221
2015-07-27 19:21:23 +00:00
Baptiste Daroussin
c048a83f51 Replace GNU RCS ident with a BSD license ident
Rationale: ident(1) is useful out of RCS, lot of scripts are using ident(1) and
failing when base is built WITHOUT_RCS.

This version is:
- fully compatible with RCS 5.7 ident.
- fully compatible with RCS 5.9 ident.
- passes all ident test from GNU RCS 5.9 test suite

This version has support for: svn extension for the Keyword id (double colon and
# before last $)

Différences with GNU RCS ident:
- no long options as found in GNU RCS 5.9 (but not commented there).
- '-V' reports nothing but has been added for compatibility.

Differential Revision:	https://reviews.freebsd.org/D3200
Reviewed by:	pfg
2015-07-26 11:21:36 +00:00
Pedro F. Giffuni
3c0948a6b2 Bump GCC max-inline-insns-single in libiconv_modules and grep
This is required by our FORTIFY_SOURCE implementation as it
does more inlining. As a rule of thumb, FORTIFY_SOURCE doubles
the number  of inlines except that in grep inlining
blows up for some reason.
2015-07-26 00:11:04 +00:00
Ed Maste
7072861cd0 ar: add -U (unique) option to disable -D (deterministic) mode
This is required in order for us to support deterministic mode by
default.  If multiple -D or -U options are specified on the command
line, the final one takes precedence.  GNU ar also uses -U for this.

An equivalent change will be applied to ELF Tool Chain's version of ar.

PR:		196929
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3175
2015-07-24 17:46:43 +00:00
Ed Maste
6df1985625 truss: follow pdfork()ed descendents with -f
PR:		201276
Reported by:	David Drysdale
Reviewed by:	oshogbo
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D2976
2015-07-24 16:57:13 +00:00
Ed Maste
119b75925c Add RISC-V ELF machine type definition
EM_RISCV is now officially registered as e_machine 243.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-07-24 16:52:21 +00:00
Baptiste Daroussin
24ef74209a inode should be different to actually mean mandocdb is in used
Sponsored by:	gandi.net
2015-07-24 09:20:02 +00:00
Baptiste Daroussin
772246ef18 Fix man -k with mandocdb
If apropos(1) and whatis(1) are not hardlinks to man(1) that means the system is
using mandocdb, then man -k should spawn apropos(1) and/or whatis(1) directly

Reported by:	kevlo
Tested by:	kevlo
Sponsored by:	gandi.net
2015-07-24 09:10:03 +00:00
Dimitry Andric
8d0f10857a Merge ^/head r285341 through r285792. 2015-07-22 19:55:32 +00:00
Mark Johnston
794c57d3c5 Fix counter reads on platforms where sizeof(uint64_t) != sizeof(uint64_t *).
In the kernel, structs such as tcpstat are manipulated as an array of
counter_u64_t (uint64_t *), but made visible to userland as an array of
uint64_t. kread_counters() was previously copying the counter array into
user space and sequentially overwriting each counter with its value. This
mostly affects IPsec counters, as other counters are exported via sysctl.

PR:		201700
Tested by:	Jason Unovitch
MFC after:	1 week
2015-07-21 23:57:38 +00:00
Conrad Meyer
300ca9a86e patch(1): Add -Vnone option to disable backup files
Differential Revision:	https://reviews.freebsd.org/D3146
Reviewed by:	pfg
Approved by:	markj (mentor)
MFC after:	1 week
Relnotes:	yes
Sponsored by:	EMC / Isilon Storage Division
2015-07-21 22:57:27 +00:00
Ed Schouten
46e834d780 Unbreak "last reboot".
According to the last(1) man page, the "reboot" pseudo-user should print
all system reboot entries. This got broken by the utmpx import, as
records are typed.

Re-add support for "last reboot" by specifically matching against
SHUTDOWN_TIME and BOOT_TIME records.

PR:		168844
Submitted by:	matthew@
MFC after:	1 month
2015-07-21 10:52:05 +00:00
Mark Johnston
4ffc6e480d Fix some libxo format string errors in the pfkey stats code.
PR:	201700
2015-07-20 02:38:51 +00:00
Dag-Erling Smørgrav
cf24373c3b Move assignments around to avoid a false-positive uninitialized variable
warning which broke the sparc64 build.

PR:		201585
MFC after:	3 weeks
2015-07-17 08:37:13 +00:00
Dag-Erling Smørgrav
7a5642b3a1 Add a -s option which adds a column listing the connection state if
applicable (currently only for TCP).

PR:		201585
MFC after:	3 weeks
2015-07-16 13:09:21 +00:00
Baptiste Daroussin
cbc9c8d8d3 Fix trimming spaces writing at index -1 if an empty string is passed
Submitted by:	Gennady Proskurin <gprspb@mail.ru>
2015-07-15 18:49:15 +00:00
John-Mark Gurney
8239de9b1b fix error message... errx since errno may not be set (if we didn't
parse the full field), and err and errx add their own newline at the
end...

Sponsored by:	Netflix, Inc.
2015-07-15 06:14:04 +00:00
Joel Dahl
37cba721ff mdoc: add missing .El 2015-07-14 19:43:10 +00:00
Baptiste Daroussin
cffa7aa609 Convert atoi(3) to stronum(3) which allows to arguments and report proper errors
to the users

Obtained from:	OpenBSD
2015-07-14 19:16:14 +00:00