Commit Graph

12771 Commits

Author SHA1 Message Date
John Baldwin
8dec694290 Decode arguments to truncate and ftruncate.
In particular, decode the off_t argument as a 64-bit argument to fix
decoding for 32-bit processes.
2016-10-01 22:03:41 +00:00
John Baldwin
71ed318eb4 Handle 64-bit system call arguments (off_t, id_t).
In particular, 64-bit system call arguments use up two register_t
arguments for 32-bit processes.  They must also be aligned on a 64-bit
boundary on 32-bit powerpc processes.  This fixes the decoding of
lseek(), procctl(), and wait6() arguments for 32-bit processes (both
native and via freebsd32).

Note that the ktrace system call return record only returns a single
register, so the return value of lseek is always truncated to the low
32-bits for 32-bit processes.
2016-10-01 22:01:41 +00:00
Pedro F. Giffuni
758a3cff59 patch(1): make some macros look boolean.
Similar to r306560, plus remove an unused macro.

Suggested by:	jmallett
2016-10-01 20:46:01 +00:00
Pedro F. Giffuni
c7ef297a8e patch(1): make some macros look boolean.
Minor cleanup inspired by a new patch(1) variant in schily tools.

For reference:
https://sourceforge.net/p/schillix-on/

MFC after:	1 week
2016-10-01 20:31:00 +00:00
Ed Maste
6cd8c11ba5 primes: trivially capsicumize
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7982
2016-09-30 13:50:59 +00:00
Ed Maste
335bcabec9 Merge ^/head r306303 through 306411. 2016-09-28 19:29:01 +00:00
Ed Maste
826e43974c lld: use ${SRCDIR} instead of ${.CURDIR}-relative path 2016-09-28 19:15:46 +00:00
Ed Maste
f987297fc9 Add a WITHOUT_DIALOG src.conf(5) knob
It also turns off dependencies (bsdinstall, bsdconfig, dpv, tzsetup).

Reviewed by:	dteske
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7969
2016-09-27 18:08:38 +00:00
Ruslan Bukin
60e5fa86df Increase timeout for legacy_test from 300 (default) to 600 seconds.
It takes about 7 minutes to pass the test on MIPS64EB in QEMU.

Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
2016-09-26 13:59:18 +00:00
Marcel Moolenaar
7b5a53ea4d Portability changes:
1.  macOS nor Linux have MAP_NOCORE nor MAP_NOSYNC. Define as 0.
2.  macOS doesn't have SEEK_DATA nor SEEK_HOLE. Define as -1
    so that lseek will return -1 (with errno set to EINVAL).
3.  gcc correctly warns that error is assigned but not used in
    image_copyout_region().  Fix by returning on the first error.
2016-09-26 04:14:00 +00:00
Marcel Moolenaar
5aad7d9a87 Avoid depending on the <sys/endian.h> header for le*enc and be*enc.
Not only is the header unportable, the encoding/decoding functions
are as well.  Instead, duplicate the handful of small inlines we
need into a private header called endian.h.

Aside: an alternative approach is to move the encoding/decoding
functions to a separate system header.  While the header is still
nonportable, such an approach would make it possible to re-use the
definitions by playing games with include paths. This may be the
preferred approach if more (build) utilities need this.  This
change does not preclude that.  In fact, it makes it easier.
2016-09-26 01:06:32 +00:00
Marcel Moolenaar
4039ea7c9b Eliminate the use of EDOOFUS. The error code was used to signal
programming errors, but is really a poor substitute for assert.
And less portable as well.
2016-09-26 00:41:08 +00:00
Marcel Moolenaar
5a1302ab2e Replace the use of linker sets with constructors for both the
formats and schemes.  Formats and schemes are registered at
runtime now, rather than collected at link time.
2016-09-25 22:57:59 +00:00
Dimitry Andric
8c4282b370 Merge ^/head r305892 through r306302. 2016-09-24 20:58:59 +00:00
Marcel Moolenaar
ac3425511d Update local variable 'block' after calling capacity_resize(),
otherwise format_resize(), which is called right after, isn't
getting the current/actual image size. Rather than rounding up,
format_resize() could end up truncating the size and we don't
allow that by design.

MFC after:	1 week
2016-09-24 17:29:27 +00:00
Bryan Drewery
304336144c DIRDEPS_BUILD: Connect new directories.
Sponsored by:	Dell EMC Isilon
2016-09-23 22:46:19 +00:00
Konstantin Belousov
7402f93ef2 Provide proccontrol(1), an utility to control processes behaviour, related
to procctl(2).

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-09-23 12:34:54 +00:00
Joseph Mingrone
fef8f03390 Add myself (jrm) to calendar.freebsd
Approved by:    swills (mentor)
2016-09-21 18:52:49 +00:00
Alan Somers
005156d7b3 Update mkimg(1) author's contact info
Reviewed by:	marcel, imp
MFC after:	3 days
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D7991
2016-09-21 18:42:17 +00:00
Ed Maste
9e8f606352 elfdump: limit STDIN to no rights rather than closing it
Closing stdin/stdout/stderr is often a bad idea as a future open()
can end up with its fd. Leave it open and limit it to no rights
instead.

Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D7984
2016-09-20 21:38:12 +00:00
Ed Maste
23648b7d73 bspatch: Remove backwards-compatibility sys/capability.h support
bspatch previously included sys/capability.h or sys/capsicum.h based
on __FreeBSD_version, as FreeBSD is the upstream for bsdiff and we may
see this file incorporated into other third-party software.

The Capsicum header is now installed as sys/capsicum.h in stable/10 and
FreeBSD 10.3, so we can just use sys/capsicum.h and simplify the logic.

Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D7954
2016-09-20 15:13:15 +00:00
Conrad Meyer
d36899d10f Move sys/capsicum.h includes after types.h or param.h
This is not actually documented or even implied in style(9).  Make the change
to match convention.  Someone should document this convention in style(9).

Reported by:	jhb
Sponsored by:	EMC Dell Isilon
2016-09-19 20:43:03 +00:00
Pedro F. Giffuni
0c9426b684 hexdump(1): Simplify by using asprintf(3)
Instead of strlen() + calloc() + snprintf, just use asprintf().
No functional change.

Obtained from:	OpenBSD (CVS Rev. 1.22)
2016-09-19 18:35:22 +00:00
Conrad Meyer
10cc720c25 indent(1): Capsicumify
This is a nice and trivial program for sandboxing.  One input file, one
output file.

Reviewed by:	pfg
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D7920
2016-09-19 16:16:14 +00:00
Conrad Meyer
875cba632b tr(1): Capsicumify
This is a straightforward single input, single output program for
capsicum.

Reviewed by:	bapt
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D7928
2016-09-19 16:14:38 +00:00
Conrad Meyer
e75a7302d3 cmp(1): Capsicumify
Reviewed by:	allanjude, bapt, oshogbo
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D7912
2016-09-19 16:13:00 +00:00
Baptiste Daroussin
3ba0c99044 Revert capsicum support
In some corner case VFS lookup is not working and I do not have time to debug
it for now.
2016-09-19 06:39:11 +00:00
Enji Cooper
720ca50063 Fix typo introduced in r305949 with the stable/10 bootstrapping logic
The header is sys/capability.h, not sys/capabilities.h

X-MFC with:	r305949
Pointyhat to:	bapt
Reported by:	allanjude, Jenkins
Sponsored by: 	Dell EMC Isilon
2016-09-19 03:02:43 +00:00
Ed Maste
06403dbce5 elfdump: adjust stdout/stderr capabilities
stdio uses fstat and the TIOCGETA ioctl. Also collapse the
cap_rights_limit and new cap_ioctls_limit calls into one if statement.
Errors here are not actionable by the user and distinguishing stdout
from stderr doesn't really have value.

Reported by:	kib
Reviewed by:	allanjude, bapt
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7944
2016-09-18 20:23:26 +00:00
Baptiste Daroussin
e645c6addb Simplify the fix for bootstrap tools
building head is not supported from prior to stable/10 where sys/capsicum.h was
named sys/capabilities.h

Reported by:	kib
2016-09-18 19:16:48 +00:00
Baptiste Daroussin
8197e93d39 Fix building as bootstrap tools on pre-capsicum.h systems 2016-09-18 18:49:18 +00:00
Baptiste Daroussin
160af93197 Better error checking
if getcwd fails: just ignore it and do not try to adding to the list of possible
path where to find the files.

if fdopen fails, warn and return NULL the rest of the code knows how to deal
with it

Reported by:	oshogbo
2016-09-18 18:03:06 +00:00
Baptiste Daroussin
b2c71bcefc style(9) fix
Reported by:	oshogbo
2016-09-18 17:56:14 +00:00
Baptiste Daroussin
d33dad44da Capsicum-ize tee(1)
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D7940
2016-09-18 16:34:40 +00:00
Baptiste Daroussin
224d9e3ed2 Capsicum-ize soelim(1).
As a trick to be able to access all files passed in arguments (readonly) within
the sandbox we first open the root directory, then consider all files as
relative to this file descriptor.

This might be improved once casper add supports for filesystem.

MFC after:	1 month
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D7936
2016-09-18 16:25:41 +00:00
Baptiste Daroussin
c59a0a34e8 Remove reference of z(s)diff which was dropped before importing 2016-09-18 10:06:35 +00:00
Dimitry Andric
93badfa1f2 Merge ^/head r305687 through r305890. 2016-09-16 20:49:12 +00:00
Warren Block
a63166d8fc Update history. Patch supplied by Sevan Janiyan <venture37@geeklan.co.uk>.
PR:		181390
Submitted by:	ksmakoto@dd.iij4u.or.jp
MFC after:	1 week
2016-09-16 14:23:16 +00:00
Ed Maste
6c6e388929 sdiff: improve errx string
errx() appends a newline so \n is superfluous. Also switch to lower case
with no period for consistency with other errx strings.
2016-09-15 02:48:56 +00:00
Ed Maste
6d9f0e4d70 bspatch: use #define for header size instead of magic number
Reviewed by:	allanjude, kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7861
2016-09-15 01:58:12 +00:00
Ed Maste
b1ca2de9e9 login: clean up errx strings
errx() prefixes the error string with argv[0] so including "login: "
in the string is redundant. Also remove a superfluous newline.

Sponsored by:	The FreeBSD Foundation
2016-09-15 01:55:18 +00:00
Ed Maste
9b61efccf7 vtfontcvt: remove superfluous newlines in errx messages 2016-09-14 18:22:12 +00:00
Pedro F. Giffuni
be4391a2d5 localedef(1): make better use of calloc(3) arguments.
The first argument of calloc(3) should be an ordinal type, and the
second a size: split a multiplication to make better use of calloc(3)
and detect overflows.

Do some other re-ordering and style fixes while here.

MFC after:	3 weeks
2016-09-14 16:47:17 +00:00
Ed Maste
04708d25e0 bspatch: remove superfluous newlines from errx strings 2016-09-12 14:28:38 +00:00
Dimitry Andric
a75e9a0239 Merge ^/head r305623 through r305686. 2016-09-10 17:00:08 +00:00
Dimitry Andric
4c1492a1aa Fix sneaky typo in lld's Makefile: s/OBJOP/OBJTOP/ 2016-09-10 16:08:50 +00:00
Simon J. Gerraty
95e3ed2cdb Update to bmake-20170818
This version has some new knobs for dealing with troublesome targets
in meta mode.
2016-09-09 01:09:39 +00:00
Dimitry Andric
d002f039ae Merge ^/head r305431 through r305622. 2016-09-08 18:15:36 +00:00
Gabor Kovesdan
a6be469014 - Fix typo
PR:		211245
Submitted by:	Christoph Schonweiler <public2016@hauptsignal.at>
MFC after:	5 days
2016-09-08 14:50:23 +00:00
Ed Maste
e3d9ae4c56 bspatch: add sanity checks on sizes to avoid integer overflow
Note that this introduces an explicit 2GB limit, but this was already
implicit in variable and function argument types.

This is based on the "non-cryptanalytic attacks against freebsd
update components" anonymous gist. Further refinement is planned.

Reviewed by:	allanjude, cem, kib
Obtained from:	anonymous gist
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7619
2016-09-06 19:00:37 +00:00
Dimitry Andric
1839de1a4b Merge ^/head r305397 through r305430. 2016-09-05 18:05:45 +00:00
Dag-Erling Smørgrav
b6924c9309 Add a toggle to display the approximate amount of swap used by each
process.  We don't *quite* pull that number out of our backside, as
the actual number is difficult to determine without modifying the VM
system to report it, but it's still useful to get an idea of what's
going on when a machine unexpectedly starts swapping.

MFC after:	1 week
2016-09-05 08:27:04 +00:00
Dimitry Andric
084b3adb03 Some further micro-optimizations for the libllvm and lldb build. 2016-09-04 16:54:55 +00:00
Dimitry Andric
b989893ac8 Undo r305299, since it also sets up BINDIR, via usr.bin/Makefile.inc.
Just set WARNS to zero instead.
2016-09-02 20:07:05 +00:00
Dimitry Andric
2aeb03806a Merge ^/head r305220 through r305300. 2016-09-02 19:44:23 +00:00
Dimitry Andric
710f7c3aa1 For now, undo the WARNS=3 setting for the clang and llvm tools. More
work needs to be done first to get everything compiling without warnings.
2016-09-02 19:26:39 +00:00
Hajimu UMEMOTO
2279a9a428 When -n is specified, don't make bogus DNS queries. Instead,
when -n is specified more than once, hostnames stored in utmp
are attempted to resolve to display them as network addresses.

PR:		212272
2016-09-02 18:28:14 +00:00
Bryan Drewery
08e3200cd3 DIRDEPS_BUILD: Connect lld.
Sponsored by:	EMC / Isilon Storage Division
2016-09-01 21:03:27 +00:00
Bryan Drewery
03165addb5 DIRDEPS_BUILD: Connect the new clang build.
Sponsored by:	EMC / Isilon Storage Division
2016-09-01 20:38:59 +00:00
Bryan Drewery
7d969b1d9b DIRDEPS_BUILD: Use libllvmminimal for tblgen for the host build.
The host tools are only ever built for the same reason as TOOLS_PREFIX, for running
during the build.

Sponsored by:	EMC / Isilon Storage Division
2016-09-01 18:35:37 +00:00
Dimitry Andric
8f1f370da9 Merge ^/head r305087 through r305219. 2016-09-01 18:16:45 +00:00
Marcelo Araujo
4c22fda976 - Invert calloc(3) argument order.
MFC after:	4 weeks
2016-09-01 15:23:33 +00:00
Ed Maste
75bc38b916 Add WITH_/WITHOUT_LLD knobs to enable the lld linker
Use this to control inclusion of the libllvm functionality required
by lld. Enable by default on arm64 and amd64, the two platforms where
lld is most usable for testing.

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7713
2016-08-31 21:18:38 +00:00
Ed Maste
d74808dd1a users: don't build when we don't have a C++ toolchain
(On RISC-V MK_CXX is in BROKEN_OPTIONS, so users remains skipped there.)

Reviewed by:	bdrewery
Differential Revision:	https://reviews.freebsd.org/D7725
2016-08-31 21:12:50 +00:00
Bryan Drewery
1eb4ec9c62 DIRDEPS_BUILD: Add some missing dirctories to the build.
Sponsored by:	EMC / Isilon Storage Division
2016-08-31 19:30:59 +00:00
Bryan Drewery
776d5e11e9 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	EMC / Isilon Storage Division
2016-08-31 19:30:46 +00:00
Ed Maste
adbee1887f Add lld Makefile
Sponsored by:	The FreeBSD Foundation
2016-08-30 21:08:45 +00:00
Dimitry Andric
aa0c5579f2 Merge ^/head r305029 through r305080. 2016-08-30 19:29:00 +00:00
Dimitry Andric
c43262580d Squelch clang 3.9.0 warnings about BASE (which is 32768) being converted
to -32768 when it is used as an argument to mp_itom(), in both libtelnet
and newkey.  This code has been wrong since r26238 (!), so after almost
20 years it is rather useless to try to correct it.

MFC after:	1 week
2016-08-30 19:02:15 +00:00
Dimitry Andric
29ed43fcec Merge ^/head r304885 through r304954. 2016-08-28 11:58:15 +00:00
Dimitry Andric
e92a9ae100 Compile clang, lldb and related tools with WARNS=3 by default. 2016-08-27 16:01:10 +00:00
Bruce Evans
de618daaf0 Fix build without INET6 and with gcc. A function definition was ifdefed
for INET6, but its protototype was not, and gcc detects the error.
2016-08-27 11:06:06 +00:00
Dimitry Andric
01d8757d3d Centralize where LLVM_SRCS, CLANG_SRCS and LLDB_SRCS are defined. 2016-08-27 10:00:33 +00:00
Dimitry Andric
c9bab4efb0 Missed one .mk file where OBJTOP can be used. 2016-08-27 09:51:57 +00:00
Dimitry Andric
491cdc1b53 Merge ^/head r304700 through r304884. 2016-08-27 09:40:29 +00:00
Dimitry Andric
e1cd768299 Use SRCTOP and OBJTOP throughout the llvm/clang/lldb build. 2016-08-27 09:29:39 +00:00
Xin LI
64093e14eb Use printable ASCII instead of octal representation.
MFC after:	2 weeks
2016-08-27 00:56:37 +00:00
Dimitry Andric
986e05bc2a Completely revamp the way llvm, clang and lldb are built.
* Bootstrap llvm-tblgen and clang-tblgen with a minimal llvm static
  library, that has no other dependencies.
* Roll up all separate llvm libraries into one big static libllvm.
* Similar for all separate clang and lldb static libraries.
* For all these libraries, generate their .inc files only once.
* Link all llvm tools (including extra) against the big libllvm.
* Link clang and clang-format against the big libllvm and libclang.
* Link lldb against the big libllvm, libclang and liblldb.

N.B.: This is work in progress, some details may still be missing.

It also heavily depends on bsd.*.mk's support for SRCS and DPSRCS with
relative pathnames, which apparently does not always work as expected.
For building llvm, clang and lldb though, it seems to work just fine.

The main idea behind this restructuring is maintainability and build
peformance.  The previous large number of very small libraries, each
with their own generated files and dependencies was slow to traverse
and hard to understand.

Possible future improvements:
* Only build certain targets, e.g. for most regular users having just
  one target will be fine.  This will shave off some build time.
* Building the big llvm, clang and lldb libraries as shared (private)
  libraries.
* Adding other components from the LLVM project, such as lld.
2016-08-26 22:44:22 +00:00
Ed Maste
06ce2764a5 bspatch: remove output file in the case of error
Reviewed by:	oshogbo
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7644
2016-08-25 21:33:39 +00:00
Enji Cooper
8905590ba9 Add non-TRUSTEDBSD prefixed knobs for the _PC_ACL* and {CAP,INF,MAC}_PRESENT knobs
It's not necessarily intuitive that the variables to query contain TRUSTEDBSD
in the prefix. Add non-TRUSTEDBSD prefixed knobs for querying things like
"_PC_ACL_NFS4".

MFC after:	1 week
Relnotes:	yes
Reviewed by:	wollman
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D7618
2016-08-25 17:07:43 +00:00
Allan Jude
76723b39ca Capsicumize bspatch
Move all of the fopen() and open() calls to the top of main()

Restrict each FD to least privilege (read/seek only, write only, etc)

cap_enter(), and make all except the output FD read/seek only.

Reviewed by:	emaste, ed, oshogbo, delphij
Approved by:	so
MFC after:	3 days
Relnotes:	yes
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D7358
2016-08-25 15:08:33 +00:00
Navdeep Parhar
97b84d344d Make the iSCSI parameter negotiation more flexible.
Decouple the send and receive limits on the amount of data in a single
iSCSI PDU.  MaxRecvDataSegmentLength is declarative, not negotiated, and
is direction-specific so there is no reason for both ends to limit
themselves to the same min(initiator, target) value in both directions.

Allow iSCSI drivers to report their send, receive, first burst, and max
burst limits explicitly instead of using hardcoded values or trying to
derive all of them from the receive limit (which was the only limit
reported by the drivers prior to this change).

Display the send and receive limits separately in the userspace iSCSI
utilities.

Reviewed by:	jpaetzel@ (earlier version), trasz@
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D7279
2016-08-25 05:22:53 +00:00
Dimitry Andric
7d0ce7aa30 Merge ^/head r304537 through r304699. 2016-08-23 19:55:02 +00:00
Enji Cooper
bb323b9e7b Add support for _PC_ACL_NFS4 as TRUSTEDBSD_ACL_NFS4
The TRUSTEDBSD prefix was chosen for consistency with the other
related `_PC_ACL*` prefixed variables.

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division
2016-08-23 19:41:49 +00:00
Enji Cooper
de7b37e618 Add MIN_HOLE_SIZE pathconf(2) support to getconf
This allows shell programs to programmatically determine whether
or not a filesystem supports sparse files

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division
2016-08-23 19:28:01 +00:00
Enji Cooper
11b0c200fb Clean up trailing whitespace
MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division
2016-08-23 19:15:01 +00:00
Ed Maste
ce437beff1 bspatch: apply style(9)
Make style changes (and trivial refactoring of open calls) now in order
to reduce noise in diffs for future capsicum changes.

Reviewed by:	oshogbo
No objection:	cperciva
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D7610
2016-08-23 17:42:03 +00:00
Pedro F. Giffuni
bf140447ba indent(1): have the memset invocation somewhat more canonical.
While correct, the previous invocation was somewhat more error prone.

Pointed out by:	delphij, bde
2016-08-23 15:49:31 +00:00
Pedro F. Giffuni
38359266c5 indent(1): remove dead assignments.
Taken from:	Piotr Sephaniak
2016-08-23 15:46:20 +00:00
Pedro F. Giffuni
8e7c1235ce indent(1): Fix off-by-one in control flow leading dead code.
Coverity correctly reported that it's impossible for /comparison/ to be 0
here, because the only way for the for loop to end is by /comparison/
being < 0.

Fortunately the consequences of this bug weren't severe; for duplicated
entries in the typedef names file it would unnecessarily duplicate strings
with strdup(), but pointers to those would replace existing ones. So this
was a memory leak at worst.

CID:	 1361477
Obtained from:	 Piotr Stephaniak
2016-08-23 02:07:08 +00:00
Pedro F. Giffuni
16c2e36059 indent(1): add some comments to quiet down Coverity.
Hopefully adding comments should help explain the code to both static
checkers and humans.

CID:	976543, 976544, 976545
Obtained from:	Piotr Stephaniak
2016-08-23 01:58:02 +00:00
Pedro F. Giffuni
f3c23ec321 indent(1): Fix memory leaks pointed out by clang-analyzer.
Shift the responsibility of allocating memory for the string duplicate
from the caller (set_option, add_typedefs_from_file) to the callee
(add_typename) as it has more knowledge about when the duplication
actually needs to occur.

Taken from:	Piotr Stefaniak
2016-08-23 01:40:45 +00:00
Dimitry Andric
113c14a010 Don't link the clang executable with unnecessary libraries. 2016-08-20 19:33:55 +00:00
Dimitry Andric
65e1b13807 Merge ^/head r304236 through r304536. 2016-08-20 18:52:03 +00:00
Dimitry Andric
9228435a16 Update build glue for lldb. Also comment out parts of the
initialization and termination code which reference plugins and
components that we don't use.
2016-08-20 18:45:25 +00:00
Dimitry Andric
7fff4413af Update build glue for clang and the llvm/clang extras. 2016-08-19 17:55:34 +00:00
Ed Schouten
a5c3c5b14f Import the new automatically generated system call table for CloudABI.
Now that we've switched over to using the vDSO on CloudABI, it becomes a
lot easier for us to phase out old features. System call numbering is no
longer something that's part of the ABI. It's fully based on names. As
long as the numbering used by the kernel and the vDSO is consistent
(which it always is), it's all right.

Let's put this to the test by removing a system call (thread_tcb_set())
that's already unused for quite some time now, but was only left intact
to serve as a placeholder. Sync in the new system call table that uses
alphabetic sorting of system calls.

Obtained from:	https://github.com/NuxiNL/cloudabi
2016-08-19 17:49:35 +00:00
Andrey A. Chernov
4e78ecd2c9 Fix TAB replaced with spaces in prev. commit. 2016-08-18 10:18:11 +00:00
Michael Tuexen
5ad497eead Fix the output for scope statistics.
MFC after: 3 days
2016-08-17 16:56:20 +00:00
Michael Tuexen
e0694d2f0a Use names for SCTP and UDPLite when reporting the input histogram.
MFC after: 3 days
2016-08-17 14:44:47 +00:00
Marcelo Araujo
4b61b26b28 Use nitems() from sys/param.h.
MFC after:	2 weeks.
2016-08-16 15:53:05 +00:00
Marcelo Araujo
4c59a8860a Use nitems() from sys/param.h.
MFC after:	2 weeks.
2016-08-16 15:52:10 +00:00
Sofian Brabez
80a2905883 tty: Use proper definition of exit status code and stdin macro
Reviewed by:	bapt, bdrewery
Differential Revision:	https://reviews.freebsd.org/D6828
2016-08-16 14:15:09 +00:00
Rick Macklem
684d18c9ae Fix r304026 so that it builds for gcc.
Reported by:	np
Tested by:	np
MFC after:	1 month
2016-08-16 00:48:13 +00:00
Mark Johnston
da974ed4ab nfsstat depends on libdevstat as of r304058.
X-MFC-With:	r304058
2016-08-14 00:24:00 +00:00
Greg Lehey
7430368a0e Correct date ov VJ day (1945-08-15, about 03:00 UTC). 2016-08-13 23:35:20 +00:00
Rick Macklem
50f3f9f909 Update the man page to descibe the "-d" option added by r304058.
This is a content change.

Submitted by:	will (earlier version)
Reviewed by:	ken, wblock
MFC after:	1 month
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D1626
2016-08-13 20:21:32 +00:00
Rick Macklem
693957f886 Update nfsstat.c to use the new kernel nfsstat structure and
add the new "-d" flag from D1626.
The man page will be updated in a subsequent commit.

Submitted by:	will (earlier version)
Reviewed by:	ken
MFC after:	1 month
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D1626
2016-08-13 20:14:44 +00:00
Konstantin Belousov
6bdee22607 Remove unused prototypes.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-08-12 07:52:13 +00:00
John Baldwin
c357102c5b Remove files unused after pulling system call names from libsysdecode. 2016-08-11 05:18:09 +00:00
Bryan Drewery
cca89ee385 Fix sorting in r303934.
Reported by:	jhb
X-MFC-With:	r303934
MFC after:	3 days
Sponsored by:	EMC / Isilon Storage Division
2016-08-10 21:59:59 +00:00
Bryan Drewery
6178f8e8a6 Use proper argument length for rmdir(2) for r303934.
Reported by:	kib
X-MFC-With:	r303934
MFC after:	3 days
Sponsored by:	EMC / Isilon Storage Division
2016-08-10 18:45:26 +00:00
Bryan Drewery
c870956d72 Support rmdir(2).
MFC after:	3 days
Sponsored by:	EMC / Isilon Storage Division
2016-08-10 18:19:17 +00:00
Bryan Drewery
c8a8570cdb Squelch a false-positive Clang static analyzer warning.
MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2016-08-10 18:19:14 +00:00
Bryan Drewery
4a4768d948 Fix -b failure not restoring flags on the destination file.
MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2016-08-10 18:19:11 +00:00
Bryan Drewery
89ad63ad2d Fix -S with -l not being atomic.
It was unlinking the target even though it uses rename(2) which already
effectively does that.  -S is intended to not unlink(2) the target first.

MFC after:	1 week
Reviewed by:	jhb
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D7452
2016-08-10 18:19:08 +00:00
Bryan Drewery
49cfff9131 Support -v for -l.
MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
2016-08-10 18:19:05 +00:00
Bryan Drewery
b81ddc83c9 Fix -S with -b not atomically updating the destination file.
With both of these flags, the backup was created via rename(dest, backup)
followed by rename(tmp, dest).  This left the destination file missing
for a moment which contradicts the point of -S.

This fixes a race with installworld where PRECIOUSPROG and PRECIOUSLIB
files (which use -S for installation) would briefly be missing.  In the
case of installing rtld with parallel installworld it could render an
error due to not having rtld present to run install/cp in another
process.

Reported by:	jhb
Reviewed by:	jhb
MFC after:	1 week
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D7451
2016-08-10 18:19:02 +00:00
Bryan Drewery
e9a4487309 Trim out excessive / with -v when target directory ends with a trailing '/'.
This is a minor nit after r289391 made all installations to a directory always
end in a trailing '/'.

MFC after:	3 days
Sponsored by:	EMC / Isilon Storage Division
2016-08-10 18:18:51 +00:00
Enji Cooper
bfa4e93d35 Remove vestigal references to __alpha__
Replace alpha reference in getconf(1) with amd64 [*]

MFC after:	1 week
PR:	 	211300 [*]
Submitted by:	Sevan Janiyan <venture37@geeklan.co.uk> [*]
Sponsored by:	EMC / Isilon Storage Division
2016-08-08 07:19:30 +00:00
Enji Cooper
06fd1dab30 Fix building usr.bin/tar/tests with PIE symbol building enabled by
removing CFLAGS+= -static

`CFLAGS+= -static` was a carryover from pre-r289195 with
usr.bin/tar/test/Makefile that should have been specified in LDFLAGS
There doesn't seem to be an apparent need for static compilation
of the test binaries.

Differential Revision:	https://reviews.freebsd.org/D7430
MFC after:	1 week
Obtained-from:	opBSD (418a491eed20d2603ddd1f1bd92c2c0d95094002)
Submitted by:	op
Sponsored by:	EMC / Isilon Storage Division
2016-08-06 19:05:01 +00:00
Baptiste Daroussin
9dc3843e67 sdiff: remove non finish/function code
2 extra options not available neither on other BSD nor in GNU sdiff:
--diff-pid and --pipe-fd were present in the SoC code, none were usable

Just remove it
2016-08-05 19:14:55 +00:00
Pedro F. Giffuni
a6bcfda487 indent(1): Use bsearch() for looking up type keywords.
Reference:
f3b8e6e57f

Submitted by:	Piotr Stefaniak
Differential Revision: https://reviews.freebsd.org/D6966
2016-08-04 15:27:09 +00:00
Pedro F. Giffuni
771aff0aa5 indent(1): add new -sac and -U options.
Add -sac (space after cast) and -nsac options.
These control whether space character is put after a cast operator or not.
Default is -nsac.

Add -U option for providing a file containing list of types.
This is needed for properly deciding which asterisks denote unary
operation and which denote binary.

These come from PostgreSQL.

Reference:
84b00e3d46
49c52cf383

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by:	Piotr Stefaniak
2016-08-03 22:08:07 +00:00
Pedro F. Giffuni
b4939677e8 indent(1): accept offsetof(3) as a keyword.
Reference:
c470e5e2c9

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by:	Piotr Stefaniak
2016-08-03 16:33:34 +00:00
Baptiste Daroussin
0f21f5285b truss: fix uninitialized trussinfo->curthread in add_threads()/enter_syscall
trussinfo->curthread must be initialized before calling enter_syscall(),
it is used by t->proc->abi->fetch_args().
Without that truss is segfaulting and the attached program also crash.

Submitted by:	Nikita Kozlov (nikita@gandi.net)
Reviewed by:	jhb
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D7399
2016-08-02 22:47:06 +00:00
Dimitry Andric
00f060000f Fix a segfault in bsdgrep when parsing the invalid extended regexps "?"
or "+" (these are invalid, because there is no preceding operand).

When bsdgrep attempts to emulate GNU grep in discarding and ignoring the
invalid ? or + operators, some later logic in tre_compile_fast() goes
beyond the end of the buffer, leading to a crash.

Fix this by bailing out, and reporting a bad pattern instead.

Reported by:	Steve Kargl
MFC after:	1 week
2016-08-02 20:25:22 +00:00
Pedro F. Giffuni
249a8a8003 sed(1): Revert r303047 "cleanup" and therefore r303572.
While big, the change was meant to have no effect on behavior and instead
so far we have found two regressions: one in the etcupdate tests and
another one in the games/openttd port[1].

Revert to a known working state. We will likely have to split the patch in
functional parts before bringing back the changes.

PR:		195929
Reported by:	danfe, madpilot [1]
2016-08-02 15:35:53 +00:00
Pedro F. Giffuni
707e8dae2d indent: Avoid using values of pointers that refer to deallocated space.
For now maintain the local style in this file.

Reviewed by:	jilles

Reference:
9099a9f17b

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by:	Piotr Stefaniak
2016-08-01 19:24:01 +00:00
Pedro F. Giffuni
70a3049ea5 indent(1): Use a dash in the license headers.
Use of the canonical dash avoids indent(1) from reformatting the
license headers.
2016-08-01 16:40:42 +00:00
Pedro F. Giffuni
e725fe4b06 indent(1): Rearrange option parsing code to squelch clang's static analyzer.
clang-analyzer complained that eqin() sets file-scoped pointer param_start
to point into char buffer defined in scan_profile(), and once
scan_profile() exits, param_start is a "dangling reference". param_start
was never used afterwards, but it's cleaner to move it to set_option()
which is the only branch where param_start is needed.

Reference:
ab0e44e5da

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by:	Piotr Stefaniak
2016-07-31 21:43:43 +00:00
Pedro F. Giffuni
efc12d78f7 indent(1): replace function call to bzero with memset.
Reference:
7422f42f80

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by:	Piotr Stefaniak
2016-07-31 21:36:40 +00:00
Pedro F. Giffuni
f7adee2314 indent(1): Don't newline on cpp lines like #endif unless -bacc is on.
Reference:
01f36f4141

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by:	Piotr Stefaniak
2016-07-31 21:29:10 +00:00
Pedro F. Giffuni
69e66b43bc indent(1): Untangle the connection between pr_comment.c and io.c.
It's pr_comment.c that should decide whether to put a "star comment
continuation" or not. This duplicates code a bit, but it simplifies
pr_comment() at the same time since pr_comment() no longer has to "signal"
whether a star continuation is needed or not.

This change requires indent(1) to not wrap comment lines that lack a blank
character, but I think it's for the better if you look at cases when that
happens (mostly long URIs and file system paths, which arguably shouldn't
be wrapped).

It also fixes two bugs:

1. Cases where asterisk is a part of the comment's content (like in "*we*
are the champions") and happens to appear at the beginning of the line,
misleading dump_line() into thinking that this is part of the star comment
continuation, leading to misalignment.

2. Cases where blank starred lines had three too many characters on the
line when wrapped.

Reference:
3b41ee78aa

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by:	Piotr Stefaniak
2016-07-31 21:09:22 +00:00
Pedro F. Giffuni
8ad92a65e4 indent(1): Fix wrapping of some lines in comments.
After a blank line was printed (to separate paragraphs in comments), the
next line was sometimes wrapped to the column at which the previous
non-empty line ended. The fix is to reset the last blank pointer (last_bl)
on newline.

References:
345663c07a

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by:	Piotr Stefaniak
2016-07-31 20:13:00 +00:00
Pedro F. Giffuni
54d57555a3 indent(1): Simplify pr_comment().
Modify count_spaces() to take a third parameter "end" that will make the
function return when the end is reached. This lets the caller pass a
pointer to non nul-terminated sequence of characters. Rename
count_spaces() to count_spaces_until() and reinstate count_spaces(), this
time based on count_spaces_until().

Use count_spaces_until() to recalculate current column when going through
a comment just before the fragment which decides if current line of the
comment should be wrapped. This move simplifies this code by eliminating
the need for keeping the column counter up to date every time e_com is
advanced and also reduces spread of code that has to know how many columns
a tab will produce.

Deduplicate code that decided if a comment needs a blank line at the top.

References:
d9fa3b4815
27185b4b33

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by:	Piotr Stefaniak
2016-07-31 20:04:18 +00:00
Baptiste Daroussin
e69f68b6b0 Remove another occurence of _WITH_GETLINE 2016-07-31 19:02:19 +00:00
Pedro F. Giffuni
267c747003 indent(1): Remove dead code relating to unix-style comments.
The original indent(1) described unix-style comments as similar to box
comments, except the first non-blank character on each line is lined up
with the '*' of the "/*" which appears on a line by itself.

The code has been turned off for ages and -sc/-nsc make it even
less relevant.

Reference:
89c5fe2c56

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)

Submitted by:	Piotr Stefaniak
2016-07-31 15:02:53 +00:00
Andrey A. Chernov
2c2524f6b3 Fix date 2016-07-31 10:15:04 +00:00
Enji Cooper
637a1a7446 Fix regression with /i caused by r303047
'\n' was specifically added to -e arguments prior to r303047. Restore
historical behavior which in turn fixes usr.sbin/etcupdate/preworld_test:main .

The fix is being committed to address the issue in the short term and may be
iterated upon as noted in bug 211399

Discussed with:		mi, pfg
Differential Revision:	https://reviews.freebsd.org/D7368
PR:			195929, 211399 [*]
MFC after:		18 days
X-MFC with:		r303047
Reported by:		Jenkins
Sponsored by:		EMC / Isilon Storage Division
2016-07-31 05:31:09 +00:00
Pedro F. Giffuni
5467ab90aa indent(1): Bail out if there's no more space on the parser stack.
Also increase the stack size still keeping a conservative value of 256.
This is based on a similar changes done for PostgreSQL which instead
uses a stack size of 1000.

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by:	Piotr Stefaniak (with changes)
2016-07-31 04:58:06 +00:00
Pedro F. Giffuni
11c4989364 indent(1): Consistently indent declarations.
This fixes a very visible issue that may be hidden by some indent.pro
settings as in the example from FreeBSD's /usr/share.

From Piotr's log:
____
To prevent losing tabs from indentation in declarations, FreeBSD indent's
r125624 added code for the most common case when it's an identifier that
is indented, but didn't do anything with the original code that did the
same for any other cases. The other cases are: lparens (function pointer
declaration), asterisks (pointer declaration), stray semicolons, and
commas leading identifiers instead of trailing them.

Use the code added in r125624 (and improved in later commits) to write a
new function indent_declaration() and use it in all places that meant to
indent declarations. In order to indent only once per line, reuse existing
ps.dumped_decl_indent variable that was only used when formatting for
troff (-troff) until now.
____

Reference:
ddd263db2a

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by:	Piotr Stefaniak
2016-07-31 04:14:20 +00:00
Andrey A. Chernov
74edd7b569 Reflect CLDR timedef changes 2016-07-31 03:26:53 +00:00
Andrey A. Chernov
c880d95745 Remove another vestige of scripted conversion 2016-07-31 03:11:10 +00:00
Andrey A. Chernov
cf15dd7d3a Remove vestige of scripted conversion 2016-07-31 02:43:45 +00:00
Marcelo Araujo
6cf1bae2d9 Use nitems() from sys/param.h.
MFC after:	2 weeks.
Sponsored by:	gandi.net (BSD Day Taiwan)
2016-07-30 07:28:15 +00:00
Marcelo Araujo
f18e52f46e Use nitems() from sys/param.h.
MFC after:	2 weeks.
Sponsored by:	gandi.net (BSD Day Taiwan)
2016-07-30 07:15:54 +00:00
Marcelo Araujo
d19ba08a16 Use nitems() from sys/param.h.
MFC after:	2 weeks.
Sponsored by:	gandi.net (BSD Day Taiwan)
2016-07-30 07:06:23 +00:00
Marcelo Araujo
d7d0513c31 Use nitems() from sys/param.h.
MFC after:	2 weeks.
Sponsored by:	gandi.net (BSD Day Taiwan)
2016-07-30 07:04:46 +00:00
Marcelo Araujo
d61c7fc026 Use nitems() from sys/param.h.
MFC after:	2 weeks.
Sponsored by:	gandi.net (BSD Day Taiwan)
2016-07-30 07:02:33 +00:00
Marcelo Araujo
09a47cc7e6 Use nitems() from sys/param.h.
Sponsored by:	gandi.net (BSD Day Taiwan)
MFC after: 	2 weeks.
2016-07-30 06:35:49 +00:00
Marcelo Araujo
268b75a878 Use nitems() from sys/param.h
Sponsored by:	gandi.net (BSD Day Taiwan)
2016-07-30 06:32:18 +00:00
Enji Cooper
131cac80e1 Explicitly test for cu_fgets returning NULL or !NULL
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division
2016-07-30 04:40:44 +00:00
Baptiste Daroussin
a43d43d574 Remove usage of _WITH_GETLINE from usr.bin 2016-07-30 01:07:47 +00:00
Pedro F. Giffuni
e643b783e3 indent(1): Yet more style issues.
strchr(3) returns a pointer not a boolean.
Attempt to make the style somewhat more ocnsistent with what indent
had before recent changes.

Pointed out by:	bde
2016-07-30 01:04:18 +00:00
Pedro F. Giffuni
9b4009b417 indent(1): Attempt to preserve some consistent style.
Remove the excessive braces from r303485 and align the comments to the
right as done in the rest of the code. This is not nice but there is no
clear way to make it nice (and KNF).

Pointed out by:	bde
2016-07-29 23:30:33 +00:00
Eric van Gyzen
c05d9feb7f Fix markup for -j in cpuset(1) synopsis
MFC after:	3 days
Sponsored by:	Dell Inc.
2016-07-29 21:18:20 +00:00
Kurt Lidl
2dc39caa91 Make resizewin.1 manpage use .Fx macro
Fix capitalization of "PuTTY" also.

MFC after:	1 week
2016-07-29 21:05:17 +00:00
Pedro F. Giffuni
c917a54b26 indent(1): Use NULL instead of zero for pointers. 2016-07-29 19:36:10 +00:00
Pedro F. Giffuni
9f827409fb indent(1): Support "f" and "F" floating constant suffixes.
Actually this just brings back r303487 with the correct commit log.

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Obtained from:	Piotr Stefaniak
2016-07-29 18:00:10 +00:00
Pedro F. Giffuni
b58cc20a1a Revert r303487: Wrong commit log.
Will be brought back with the correct log.
2016-07-29 17:55:38 +00:00
Pedro F. Giffuni
09544f7d97 indent(1): Removed whitespace shouldn't be considered in column calculations.
This piece of code removed tabs and space characters from after colons
that follow labels by decrementing the e_lab (end of label) "pointer"
which is later used to calculate the width of the string that fprintf()
puts into "output". But pad_output() gets the length from the actual
string, so it miscalculated what the current column is.

Fixed by putting a string terminator at the e_lab "pointer".

Differential Revision: https://reviews.freebsd.org/D6966
(Partial)
Obtained from:	Piotr Stefaniak
2016-07-29 16:34:16 +00:00
Pedro F. Giffuni
e5302a297b indent(1): fix struct termination detection.
Small style cleanup while here.

Differential Revision: https://reviews.freebsd.org/D6966 (Partial)
Obtained from:	Piotr Stefaniak
2016-07-29 16:28:51 +00:00
Pedro F. Giffuni
bb88f82294 indent(1): fix struct termination detection.
Semicolons inside struct declarations don't end the declarations.

Differential Revision: https://reviews.freebsd.org/D6966 (Partial)
Obtained from:	Piotr Stefaniak
2016-07-29 16:23:00 +00:00
Pedro F. Giffuni
5cd358485e indent(1): Fix breakage caused by single comment following "else".
indent(1) simply wasn't taught that "else" may be followed by a comment
without any opening brace anywhere on the line, so it was very confused
in such cases.

Differential Revision: https://reviews.freebsd.org/D6966 (Partial)
Obtained from:	Piotr Stefaniak
2016-07-29 16:17:54 +00:00
Pedro F. Giffuni
11821cabe8 indent(1): Avoid potential use-after-free.
last_bl is a char pointer that tracks the last blank character in a
comment, which is used for wrapping long comment lines. Since the
underlying array may be reallocated, make sure last_bl is up to date when
that happens.

Differential Revision: https://reviews.freebsd.org/D6966 (Partial)
Obtained from:	Piotr Stefaniak
2016-07-29 16:14:03 +00:00
Pedro F. Giffuni
19fe172ace indent(1): Avoid out of bound access of array codebuf.
dump_line() requires s_code to be a string, because it will call count_spaces().

Differential Revision: https://reviews.freebsd.org/D6966 (Partial)
Obtained from:	Piotr Stefaniak
2016-07-29 16:09:05 +00:00
Pedro F. Giffuni
0504bd6580 indent: avoid calling write(2) with a negative second parameter.
negative_returns: n is passed to a parameter that cannot be negative.
Fix a style issue while here.

CID:	1008107
2016-07-28 16:54:12 +00:00
Ed Schouten
491cb043bd Pull a copy of the input string before calling basename() and dirname().
POSIX allows implementations of these functions to modify their input.
2016-07-28 16:06:37 +00:00
Ed Schouten
33f5799a81 Call basename() in a portable way.
Pull a copy of the filename string before calling basename(). Change the
loop to not return on its own, so we can put a free() statement at the
bottom.
2016-07-28 15:19:47 +00:00
Ed Schouten
6718ba1851 Don't call basename() and dirname() in an unportable way.
POSIX allows these functions to modify their input buffer, so that they
have storage for the return value. Pull copies of the filename before
calling these utility functions.
2016-07-28 15:17:12 +00:00
Enji Cooper
60b0ea0dfb Testcase 7.8 no longer needs to be marked TODO
It passes out of the box today

MFC after: 2 months
Sponsored by: EMC / Isilon Storage Division
2016-07-27 06:49:16 +00:00
Xin LI
2c8d04d022 Fix bspatch heap overflow vulnerability.
Obtained from:	Chromium
Reported by:	Lu Tung-Pin
Security:	FreeBSD-SA-16:25.bspatch
2016-07-25 14:45:48 +00:00
Xin LI
c08cbc64dc Change bsdiff to use divsufsort suffix sort library instead of qsufsort,
which is more efficient.

Note that for now we do not create a separate library for libdivsufsort
because it's not used anywhere else.

Obtained from:	Chromium
MFC after:	2 months
2016-07-25 03:58:19 +00:00
Gleb Smirnoff
3aa8d4a5ed Fix failures of scripted conversion.
Noticed by:	ache
Pointy hat to:	glebius
2016-07-24 20:47:57 +00:00
Baptiste Daroussin
b6b79081e8 Remove reference cpp(1) which is not used anymore 2016-07-24 11:05:23 +00:00
Gleb Smirnoff
7c96fe19a9 The date format for ru_RU.UTF-8 locale has changed some time ago, adjust
the ru_RU.UTF-8 calendar files.
2016-07-24 10:35:44 +00:00
Pedro F. Giffuni
f05dbca7c7 sed(1): Appease older GCC. 2016-07-21 14:17:36 +00:00
Conrad Meyer
8a263d910d Mirror r303120 to gcore
Sponsored by:	EMC / Isilon Storage Division
2016-07-21 00:53:14 +00:00
Conrad Meyer
bd0371c964 Add extended segment support to gcore
A follow-up to r303099, D7255.  Basically, apply the exact same change, with
the exact same rationale, to gcore.  gcore's elfcore.c is largely a clone of
the kernel imgact_elf coredump facility.

Reviewed by:	emaste (earlier version, not substantially different)
Requested by:	jhb
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D7265
2016-07-20 22:03:45 +00:00
Andrey A. Chernov
e8ab43489a Continuation lines with comments badly affects gprof, it is excluded from
build on amd64 f.e.
2016-07-20 15:59:37 +00:00
Bryan Drewery
359c502af5 Only build makewhatis(1)/apropos(1) with MAN_UTILS.
This is what src.conf(5) documents and is what the older non-mandoc
versions respected.

Sponsored by:	EMC / Isilon Storage Division
2016-07-20 00:06:03 +00:00
Pedro F. Giffuni
b4932d18ee sed(1): Assorted cleanups and simplifications.
Const-ify several variables, make it build cleanly with WARNS level 5.

Submitted by:	mi
PR:		195929
MFC after:	1 month
2016-07-19 22:56:40 +00:00
John Baldwin
ccb83afd81 Include process IDs in core dumps.
When threads were added to the kernel, the pr_pid member of the
NT_PRSTATUS note was repurposed to store LWP IDs instead of process
IDs.  However, the process ID was no longer recorded in core dumps.
This change adds a pr_pid field to prpsinfo (NT_PRSINFO).  Rather than
bumping the prpsinfo version number, note parsers can use the note's
payload size to determine if pr_pid is present.

Reviewed by:	kib, emaste (older version)
MFC after:	2 months
Differential Revision:	https://reviews.freebsd.org/D7117
2016-07-18 15:14:23 +00:00
Pedro F. Giffuni
4386fba70c sed(1): Fix off by one introduced in r299211.
Detected by running the gsed tests.

Submitted by:	Mikhail Teterin
PR:		195929
MFC after:	3 days
2016-07-17 21:49:53 +00:00
Michael Tuexen
9bf9ce8144 Don't duplicate code for SCTP, just use the ones used for UDP and TCP.
This fixes a bug with link local addresses. This will require and
upcoming change in the kernel to bring SCTP to the same behaviour
as UDP and TCP.

MFC after:	3 days
2016-07-17 11:43:27 +00:00
Michael Tuexen
ca658db39c Ensure that the -a, -W, -L options for SCTP behave similar
as for TCP.

MFC after:	3 days
2016-07-15 23:13:57 +00:00
Pedro F. Giffuni
eeb341a9f3 mail(1): Minor declaration updates.
Missing from r302903.
2016-07-15 20:27:21 +00:00
Pedro F. Giffuni
c433bea8c0 mail(1): Avoid closing negative file descriptors.
CID:		1008105, 1008106
MFC after:	1 week
2016-07-15 19:43:24 +00:00
Michael Tuexen
db2627f4b1 When calling netstat -Laptcp the local address values are not aligned
with the corresponding entry in the table header.
r295136 increased the value width from 14 to 32 without the corresponding
change to the table header. This commit adds the change to the table
header width.

MFC after:	3 days
2016-07-15 17:40:34 +00:00
Michael Tuexen
282d1dd7ff Fix a bug which results in a core dump when running netstat with
the -W option and having a listening SCTP socket.
The bug was introduced in r279122 when adding support for libxo.

MFC after:	3 days
2016-07-15 15:55:36 +00:00
Pedro F. Giffuni
b948550d2f mail(1): Update more prototypes.
Also rename delete and undelete_messages to deletecmd and undeletecmd
respectively in an attempt to sync with other BSDs.

Obtained from:	OpenBSD
2016-07-15 15:37:54 +00:00
John Baldwin
c77547d2f9 Include command line arguments in core dump process info.
Fill in pr_psargs in the NT_PRSINFO ELF core dump note with command
line arguments.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D7116
2016-07-14 23:20:05 +00:00
Pedro F. Giffuni
20a50e9ca9 mail(1): check for out of memory conditions when calling calloc(3).
X-MFC with:	r302771
2016-07-14 15:09:08 +00:00
Andrey A. Chernov
c4c8ae8b87 Optimize [Cc]flag case: don't repeatedly add the last character of
string2 to squeeze cset when string2 reach its EOS state.
2016-07-14 09:26:53 +00:00
Andrey A. Chernov
4573d5012b Document incomplete support of [=equiv=] and collation for ranges. 2016-07-14 09:24:55 +00:00
Andrey A. Chernov
5b4fa425ba Back out non-collating [a-z] ranges (r302594).
Instead of changing the whole course to another POSIX-permitted way
for consistency and uniformity I decide to completely ignore missing
regex fucntionality and focus on fixing bugs in what we have now,
too many small obstacles we have choicing other way, counting ports.
Corresponding libc changes are backed out in r302824.
2016-07-14 09:19:53 +00:00
Pedro F. Giffuni
92fa728bb1 mail(1): Bring some fixes from other BSDs.
Fix missing forked job changes from r302776 in wait_child().

Obtained from:	NetBSD
2016-07-14 02:25:29 +00:00
Mark Johnston
0691d32ba4 Remove gcore's -s option.
It has no effect and is always implicitly set since ptrace(2) stops the
target process.
2016-07-14 00:32:27 +00:00
Pedro F. Giffuni
b22a869924 mail(1): Bring some fixes from other BSDs.
- Use varargs properly
- Use pid_t
- Better handling of error conditions on forked jobs.
- Some prototype and warning cleanups.

Obtained from:	NetBSD (some originaly from OpenBSD)
2016-07-13 16:45:26 +00:00