Commit Graph

19268 Commits

Author SHA1 Message Date
Dimitry Andric
fe4fed2e4d Merge llvm, clang, lld, lldb, compiler-rt and libc++ trunk r321545,
update build glue and version numbers, add new intrinsics headers, and
update OptionalObsoleteFiles.inc.
2017-12-29 00:56:15 +00:00
Dimitry Andric
bbd32193a0 Add one more file to libllvm's SRCS_MIN, since this one is required for
MK_SHARED_TOOLCHAIN=yes.
2017-12-29 00:21:50 +00:00
Dimitry Andric
0d8e7490d6 Vendor import of compiler-rt trunk r321545:
https://llvm.org/svn/llvm-project/compiler-rt/trunk@321545
2017-12-28 23:58:28 +00:00
Dimitry Andric
b8a2042aa9 Vendor import of llvm trunk r321545:
https://llvm.org/svn/llvm-project/llvm/trunk@321545
2017-12-28 23:57:18 +00:00
Bartek Rutkowski
e285e32e56 humanize_number(3): fix math edge case in rounding large numbers
Fix for remainder overflow, when in rare cases adding remainder to divider
exceeded 1 and turned the total to 1000 in final formatting, taking up
the space for the unit character.

The fix continues the division of the original number if the above case
happens -- added the appropriate check to the for loop performing
the division. This lowers the value shown, to make it fit into the buffer
space provided (1.0M for 4+1 character buffer, as used by ls).

Add test case for the reported bug and extend test program to support
providing buffer length (ls -lh uses 5, tests hard-coded 4).

PR:		224498
Submitted by:	Pawel Biernacki <pawel.biernacki@gmail.com>
Reported by:	Masachika Ishizuka <ish@amail.plala.or.jp>
Reviewed by:	cem, kib
Approved by:	cem, kib
MFC after:	1 week
Sponsored by:	Mysterious Code Ltd.
Differential Revision:	D13578
2017-12-28 22:57:34 +00:00
Dimitry Andric
ce2df4ef53 Vendor import of compiler-rt trunk r321530:
https://llvm.org/svn/llvm-project/compiler-rt/trunk@321530
2017-12-28 21:23:12 +00:00
Dimitry Andric
55e6d896ad Vendor import of clang trunk r321530:
https://llvm.org/svn/llvm-project/cfe/trunk@321530
2017-12-28 21:23:03 +00:00
Dimitry Andric
b2b7c066a4 Vendor import of llvm trunk r321530:
https://llvm.org/svn/llvm-project/llvm/trunk@321530
2017-12-28 21:22:49 +00:00
Warner Losh
7e8fba7889 Close slave on fork error to prevent pty fd leak.
CID: 978209
2017-12-28 05:33:59 +00:00
Eitan Adler
837fe32558 Fix a few more speelling errors
Reviewed by:		bjk
Reviewed by:		jilles (incl formal "accept")
Differential Revision:	https://reviews.freebsd.org/D13650
2017-12-28 01:31:28 +00:00
Pedro F. Giffuni
f8bece56a3 SPDX: Small for a license ID tags.
Use parenthesis for grouping as suggested by the spec.
2017-12-27 21:36:37 +00:00
Pedro F. Giffuni
91fb056ed6 SPDX: Fix some License ID tags for libc. 2017-12-27 21:21:03 +00:00
Eitan Adler
d52a982ea8 lib: Fix several typos and minor errors
- duplicate words
- typos
- references to old versions of FreeBSD

Reviewed by:	imp, benno
2017-12-27 03:23:41 +00:00
Kirk McKusick
6a3fe71314 Missing disk close in libufs. 2017-12-26 23:16:11 +00:00
Eitan Adler
2b3b473696 fsync(3): correctly document return values
In r268924 the behavior of fflush was changed to return success
on read only streams. Document this.

Reported by:	zrj@DragonFlyBSD.org
2017-12-25 19:49:05 +00:00
Dimitry Andric
bba3cdafbb Only build tsan and tsan_cxx for amd64, as 32 bit is unsupported. 2017-12-25 13:17:29 +00:00
Dimitry Andric
1de93ee561 Vendor import of clang trunk r321426:
https://llvm.org/svn/llvm-project/cfe/trunk@321426
2017-12-24 14:05:01 +00:00
Dimitry Andric
fd4675b5a0 Vendor import of llvm trunk r321426:
https://llvm.org/svn/llvm-project/llvm/trunk@321426
2017-12-24 14:04:50 +00:00
Dimitry Andric
54b4b13c4a Merge ^/head r326936 through r327149. 2017-12-24 13:22:57 +00:00
Dimitry Andric
2757ff7e2f Update clang, lld and llvm version numbers for r321414, and update build
glue.
2017-12-24 12:32:55 +00:00
Dimitry Andric
46d7550315 Vendor import of compiler-rt trunk r321414:
https://llvm.org/svn/llvm-project/compiler-rt/trunk@321414
2017-12-24 01:00:33 +00:00
Dimitry Andric
6252156da5 Vendor import of clang trunk r321414:
https://llvm.org/svn/llvm-project/cfe/trunk@321414
2017-12-24 01:00:23 +00:00
Dimitry Andric
c7dac04c34 Vendor import of llvm trunk r321414:
https://llvm.org/svn/llvm-project/llvm/trunk@321414
2017-12-24 01:00:08 +00:00
Dimitry Andric
fb142d8871 Next step in updating llvm/clang build glue: make libclang_rt build. 2017-12-23 21:41:32 +00:00
Mariusz Zaborski
16545cf5d5 Introduce the daemonfd function.
The daemonfd function is equivalent to the daemon(3) function expect that
arguments are descriptors. For example dhclient(8) which is sandboxed is
unable to open /dev/null to close stdio instead it's allows to fail
daemon(3) function to close the descriptors and then do it explicit in code.
Instead of such hacks we can use now daemonfd.

This API can be also helpful to migrate system to platforms like CheriBSD.

Reviewed by:	brooks@, bcr@, jilles@ (earlier version)
Differential Revision:	https://reviews.freebsd.org/D13433
2017-12-23 18:07:43 +00:00
Eitan Adler
60419a9c89 fopen.1: document truncation
This documentation truncation similar to POSIX and glibc.

PR:		202545
Reported by:	intron@intron.ac
2017-12-23 05:13:39 +00:00
Dimitry Andric
77b0be52d7 Next step in updating llvm/clang build glue: make lldb build. 2017-12-22 19:10:19 +00:00
Dimitry Andric
7bfc2d0f8e Next step in updating llvm/clang build glue: make lld build. 2017-12-22 16:27:29 +00:00
Dimitry Andric
44389c28aa Sort source file lists under lib/clang. 2017-12-22 13:35:26 +00:00
Dimitry Andric
3cd201a12f Next step in updating llvm/clang build glue: make the optional llvm and
clang tools build.
2017-12-22 13:28:10 +00:00
Dimitry Andric
69f53b9734 Next step in updating llvm/clang build glue: make llvm-objdump build. 2017-12-22 11:41:18 +00:00
Dimitry Andric
ea68f99b08 Next step in updating llvm/clang build glue: make the full clang
executable build.
2017-12-22 10:04:40 +00:00
Dimitry Andric
36cb3905c9 First step in updating llvm/clang build glue: make only the clang
executable build.
2017-12-21 21:24:52 +00:00
Warner Losh
41ec95c47f Bump number that's an insane number of devices from 1,000 to 10,000. I
have access to machines that are pushing 400 devices. When 1,000 was
selected, it was rare to get even 40 or 50 devices. Bump the limit by
10x to keep up with the times.

Sponsored by: Netflix
2017-12-21 04:21:59 +00:00
Dimitry Andric
507b79f99e Update libclang_rt version number. 2017-12-20 20:27:59 +00:00
Dimitry Andric
bed303d199 Bump FREEBSD_CC_VERSION. 2017-12-20 20:27:23 +00:00
Dimitry Andric
cd8e0f1f24 Add new clang intrinsics headers, and update version number. 2017-12-20 20:27:09 +00:00
Dimitry Andric
02d2ad99ac Update generated config headers, and version numbers. 2017-12-20 20:25:35 +00:00
Hajimu UMEMOTO
23e1a2d7da Don't ignore trailing spaces after numerical IP addresses.
PR:		224403
Reported by:	Michael Kaufmann
Reviewed by:	Michael Kaufmann
MFC after:	1 week
2017-12-20 17:44:31 +00:00
Dimitry Andric
eb1ff93d02 Vendor import of lld trunk r321017:
https://llvm.org/svn/llvm-project/lld/trunk@321017
2017-12-18 20:12:21 +00:00
Dimitry Andric
0564cdb94a Vendor import of libc++ trunk r321017:
https://llvm.org/svn/llvm-project/libcxx/trunk@321017
2017-12-18 20:12:08 +00:00
Dimitry Andric
cdf4f3055e Vendor import of compiler-rt trunk r321017:
https://llvm.org/svn/llvm-project/compiler-rt/trunk@321017
2017-12-18 20:11:54 +00:00
Dimitry Andric
461a67fa15 Vendor import of clang trunk r321017:
https://llvm.org/svn/llvm-project/cfe/trunk@321017
2017-12-18 20:11:37 +00:00
Dimitry Andric
044eb2f6af Vendor import of llvm trunk r321017:
https://llvm.org/svn/llvm-project/llvm/trunk@321017
2017-12-18 20:10:56 +00:00
Ed Schouten
87f69beea3 libsysdecode: Add a new ABI type, SYSDECODE_ABI_CLOUDABI32.
In order to let truss(8) support tracing of 32-bit CloudABI
applications, we need to add a new ABI type to libsysdecode. We can
reuse the existing errno mapping table. Also link in the cloudabi32
system call table to translate system call names.

While there, remove all of the architecture ifdefs. There are not
needed, as the CloudABI data types and system call tables build fine on
any architecture. Building this unconditionally will make it easier to
do tracing for different compat modes, emulation, etc.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D13516
2017-12-16 19:37:55 +00:00
Dimitry Andric
5bf0d7ad74 Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
5.0.1 release (upstream r320880).

Relnotes:	yes
MFC after:	2 weeks
2017-12-16 18:06:30 +00:00
Ed Maste
0d18946c9a revert r322589: force use of ld.bfd for linking i386 libc
As of r326897 ld.lld can link a working i386 libc.so, so we no longer
need to force use of ld.bfd.

Sponsored by:	The FreeBSD Foundation
2017-12-16 15:17:54 +00:00
Dimitry Andric
bafea25f36 Vendor import of lld 5.0.1 release r320880:
https://llvm.org/svn/llvm-project/lld/tags/RELEASE_501/final@320880
2017-12-16 14:46:38 +00:00
Dimitry Andric
75c3240472 Vendor import of clang 5.0.1 release r320880:
https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_501/final@320880
2017-12-16 14:45:37 +00:00
Dimitry Andric
eb70dddbd7 Vendor import of llvm 5.0.1 release r320880:
https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_501/final@320880
2017-12-16 14:44:35 +00:00
Pedro F. Giffuni
62cf53fdac SPDX: some uses of the RSA-MD license. 2017-12-13 16:30:39 +00:00
Pedro F. Giffuni
9b10f59a10 SPDX: mostly fixes to previous changes.
Introduce the recently approved BSD-1-Clause and replace 0BSD which
never did fit well our use cases.
2017-12-13 16:13:17 +00:00
Michal Meloun
6e16d0bc43 Rework alignment handling in __libc_allocate_tls() for Variant I of TLS layout.
There are two versions of variant I of TLS
- ARM and aarch64 uses original version of variant I here TP points to
  start of TCB followed by aligned TLS segment. Both TCB and TLS must
  be aligned to alignment of TLS section. The TCB[0] points to DTV vector
  and DTV values are real addresses (without bias).

- MIPS, PowerPC and RISC-V use modified version of variant I,
  where TP points (with bias) to TLS and TCB immediately precedes TLS
  without any alignment gap. Only TLS should be aligned. The TCB[0]
  points to DTV vector and DTV values are biased by constant value (0x8000)
  from real addresses.

Take all this in account when allocating memory for TLS structures.

MFC after:	1 month
Reviewed by:	kib, mizhka
Tested by:	mizhka(on mips)
Differential Revision:	https://reviews.freebsd.org/D13378
2017-12-12 11:25:30 +00:00
Dimitry Andric
45b8a101e7 Correct r326748, indicating that tgammal(3) is mapped to tgamma(3), not
to itself.

Noticed by:	jilles
MFC after:	3 days
2017-12-10 23:03:13 +00:00
Dimitry Andric
240076e595 Document the existence and precision of the remaining long double
functions for which an imprecise stub implementation was added in
r255294, namely powl(3) and tgammal(3).

Submitted by:	Steve Kargl
MFC after:	3 days
2017-12-10 16:42:59 +00:00
Ed Schouten
6c093deeda Remove basename_r(3).
Now that the POSIX working group is going to require that basename(3)
and dirname(3) are thread-safe in future revisions of the standard,
there is even less of a need to provide basename_r(3). Remove this
function to prevent people from writing code that only builds on
FreeBSD and Bionic.

Removing this function seems to break exactly one port: sbruno@'s
qemu-user-static. I will send him a pull request on GitHub in a bit.
__FreeBSD_version will not be bumped, as any value from 2017 can be used
to test for the presence of a thread-safe basename(3)/dirname(3).

PR:		https://bugs.freebsd.org/224016
2017-12-08 22:06:18 +00:00
Pedro F. Giffuni
824ce2def5 SPDX: more ISC-related files. 2017-12-08 17:52:53 +00:00
Pedro F. Giffuni
6e778a7efd SPDX: license IDs for some ISC-related files. 2017-12-08 15:57:29 +00:00
Dimitry Andric
95708dbcae Remove an unused incude from lib/msun/bsdsrc/b_log.c.
Submitted by:	Steve Kargl
MFC after:	3 days
2017-12-07 20:41:23 +00:00
Dimitry Andric
dfd6ede5f9 Remove the sentence in math(3) about some long double math functions not
being available.

Submitted by:	Steve Kargl
MFC after:	3 days
2017-12-07 20:38:37 +00:00
Mark Johnston
3e4f07fc77 Ensure that "out" is initialized in all error paths.
Reported by:	gcc
Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D13402
2017-12-07 15:16:17 +00:00
Benjamin Kaduk
9e6e05e43f Note that old sys/event.h required manual sys/types.h inclusion
ed fixed this in r313704 but older versions are still affected.
2017-12-07 01:50:17 +00:00
Alan Somers
0812ee3af2 Fix a null-pointer dereference and a tautological check in cam_get_device
Reported by:	Coverity
CID:		1017964
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D13184
2017-12-06 23:24:11 +00:00
Alan Somers
82241ed55c Optimize telldir(3)
Currently each call to telldir() requires a malloc and adds an entry to a
linked list which must be traversed on future telldir(), seekdir(),
closedir(), and readdir() calls. Applications that call telldir() for every
directory entry incur O(n^2) behavior in readdir() and O(n) in telldir() and
closedir().

This optimization eliminates the malloc() and linked list in most cases by
packing the relevant information into a single long. On 64-bit architectures
msdosfs, NFS, tmpfs, UFS, and ZFS can all use the packed representation.  On
32-bit architectures msdosfs, NFS, and UFS can use the packed
representation, but ZFS and tmpfs can only use it for about the first 128
files per directory.  Memory savings is about 50 bytes per telldir(3) call.
Speedup for telldir()-heavy directory traversals is about 20-30x for one
million files per directory.

Reviewed by:	kib, mav, mckusick
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D13385
2017-12-06 22:06:48 +00:00
Stephen J. Kiernan
8b17691466 The function fwscanf() return value is wrong when encountering an early
matching failure.

According to the Open Group documentation for fwscanf:
"Upon successful completion, these functions shall return the number of
successfully matched and assigned input items; this number can be zero in
the event of an early matching failure."

Without this change, fwscanf would return EOF in the case of an early
matching failure, instead of the proper return value of 0.

This change aligns fwscanf(3) with the implementation in fscanf(3).

PR:		202240
Submitted by:	rajendra.sy@gmail.com
Reviewed by:	jhb, cem
Approved by:	sjg (mentor)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D13288
2017-12-06 21:12:24 +00:00
Mark Johnston
cdaa2de87e Use a global extern declaration to appease gcc.
Reported by:	gjb
X-MFC with:	r326498
2017-12-06 17:52:01 +00:00
Ed Maste
19164ee6cd use @@@ instead of @@ in __sym_default
Using
    .symver foo,foo@@VER
causes foo and foo@@VER to be output to the .o file. This requires foo
to be weak since the linker handles foo@@VER as foo.

Using
    .symver foo,foo@@@VER
causes just foo@@ver to be output and avoid the need for making foo
weak. It also reduces the constraint on how exactly a linker has to
handle foo and foo@@VER being present.

Submitted by:	Rafael Espíndola
Reviewed by:	dim, kib
Differential Revision:	https://reviews.freebsd.org/D11653
2017-12-05 20:19:13 +00:00
Mark Johnston
5577b8a709 Add an envp argument to proc_create().
This is needed to support dtrace's -x setenv option.

MFC after:	2 weeks
2017-12-03 16:50:16 +00:00
Dimitry Andric
d4419f6fa8 Upgrade our copies of clang, llvm, lldb and libc++ to r319231 from the
upstream release_50 branch.  This corresponds to 5.0.1 rc2.

MFC after:	2 weeks
2017-12-03 12:14:34 +00:00
Ed Maste
a71393e7d3 lib/msun: remove trailing whitespace from e_pow.c
Submitted by:	Steve Kargl
MFC after:	1 week
2017-12-03 01:56:03 +00:00
Eitan Adler
c774ad670a Add include guard to fpmath.h
Submitted by:	kargl
2017-12-02 19:42:08 +00:00
Dimitry Andric
133637d591 Make the assignment of CRTARCH conditional, even in the armhf case, and
slightly rework the .if statement.  While here, fix a minor typo.
2017-12-02 17:39:04 +00:00
Dimitry Andric
b5ea630dfd Vendor import of clang release_50 branch r319231:
https://llvm.org/svn/llvm-project/cfe/branches/release_50@319231
2017-12-02 12:46:48 +00:00
Dimitry Andric
edad5bcb76 Vendor import of llvm release_50 branch r319231:
https://llvm.org/svn/llvm-project/llvm/branches/release_50@319231
2017-12-02 12:46:23 +00:00
Warner Losh
09ee5d8ab6 Create a function to translate UEFI paths to unix paths
efivar_device_path_to_unix_path translates from UEFI to Unix
efivar_unix_path_to_device_path translates from Unix to UEFI

At present, only HD() device types are supported (both GPT and
MBR). CdRom and floppy devices aren't supported. ZFS isn't supported
because there's no way in the UEFI standard to specify a ZFS datastore.
Network devices aren't supported either.

Three forms of Unix path are accepted: /path/to/file (for a mounted
filesystem), //path/to/file (uses the EFI partition on the same disk
as /), and dev:/path/to/file (for unmounted filesystem). Two forms are
produced (the first and last).

Sponsored by: Netflix
2017-12-02 07:29:19 +00:00
Warner Losh
94ebc05f37 Fix missing .Dd bump 2017-12-01 22:52:45 +00:00
Warner Losh
8e0cd68ff4 Correct history for Unix 2nd Edition through 6th Edition for the
system calls. Man pages are missing for v2 and v5, so any entries for
those versions were inferred by new implementations of these functions
in libc.

Obtained from: http://www.tuhs.org/cgi-bin/utree.pl
2017-12-01 22:48:20 +00:00
Warner Losh
aeb71118e6 Mark all the system calls that were in 1st Edition Unix as such in the
HISTORY section. Note: Any system calls that were added prior to v7,
but after v1 weren't changed.

Obtained from: http://www.tuhs.org/cgi-bin/utree.pl?file=V1/man/man2
2017-12-01 22:26:36 +00:00
Ed Schouten
1bf4012c84 Eliminate the last user of basename_r() in the base system.
In this case it's fairly easy to make use of basename().
2017-12-01 10:25:52 +00:00
Pedro F. Giffuni
64de3fdd58 SPDX: use the Beerware identifier. 2017-11-30 20:33:45 +00:00
Alex Richardson
55c6cacd56 Fix fabs() for MIPS when used on -0.0
It would previously return negative zero for -0.0 since -0.0 does not
compare less than 0. The issue was discovered when running the libc++
test suite on softfloat MIPS64.

I have verified that both clang and GCC generate sensible code for the
builtin. For soft float they clear the sign bit using integer operations
and in hard float mode they use abs.d.

Reviewed by:	#mips, jhb, brooks, imp, emaste
Approved by:	jhb (mentor)
Differential Revision: https://reviews.freebsd.org/D13135
2017-11-28 20:37:27 +00:00
Fedor Uporov
bf7fa6b4ca Sync bsd_to_linux_errno[] table with i386 and amd64 tables in the sys directory.
Additional fix for r326282.

MFC after: 1 week
Approved by: pfg
2017-11-28 16:25:46 +00:00
Poul-Henning Kamp
22adaea1ee Truncate negative lengths to zero 2017-11-27 09:57:37 +00:00
Michal Meloun
30347b77cc Addd work around for LLVM bug 35023.
Clang crashes when compiling zstd_compress.c with optimization for ARM targets.
https://bugs.llvm.org/show_bug.cgi?id=35023
2017-11-26 16:41:30 +00:00
Warner Losh
5320ef6adf Add efidp_format_device_path_node to format a single node in a device
path, much like efidp_format_device_path will format the entire path.

Sponsored by: Netflix
2017-11-26 16:12:10 +00:00
Pedro F. Giffuni
5e53a4f90f lib: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using mis-identified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
2017-11-26 02:00:33 +00:00
Pedro F. Giffuni
d915a14ef0 libc: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using mis-identified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
2017-11-25 17:12:48 +00:00
John Baldwin
ffb6607984 Decode kevent structures logged via ktrace(2) in kdump.
- Add a new KTR_STRUCT_ARRAY ktrace record type which dumps an array of
  structures.

  The structure name in the record payload is preceded by a size_t
  containing the size of the individual structures.  Use this to
  replace the previous code that dumped the kevent arrays dumped for
  kevent().  kdump is now able to decode the kevent structures rather
  than dumping their contents via a hexdump.

  One change from before is that the 'changes' and 'events' arrays are
  not marked with separate 'read' and 'write' annotations in kdump
  output.  Instead, the first array is the 'changes' array, and the
  second array (only present if kevent doesn't fail with an error) is
  the 'events' array.  For kevent(), empty arrays are denoted by an
  entry with an array containing zero entries rather than no record.

- Move kevent decoding tables from truss to libsysdecode.

  This adds three new functions to decode members of struct kevent:
  sysdecode_kevent_filter, sysdecode_kevent_flags, and
  sysdecode_kevent_fflags.

  kdump uses these helper functions to pretty-print kevent fields.

- Move structure definitions for freebsd11 and freebsd32 kevent
  structures to <sys/event.h> so that they can be shared with userland.
  The 32-bit structures are only exposed if _WANT_KEVENT32 is defined.
  The freebsd11 structures are only exposed if _WANT_FREEBSD11_KEVENT is
  defined.  The 32-bit freebsd11 structure requires both.

- Decode freebsd11 kevent structures in truss for the compat11.kevent()
  system call.

- Log 32-bit kevent structures via ktrace for 32-bit compat kevent()
  system calls.

- While here, constify the 'void *data' argument to ktrstruct().

Reviewed by:	kib (earlier version)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D12470
2017-11-25 04:49:12 +00:00
John Baldwin
2edb60b9d5 Add stdio.h to the synopsis for sysdecode functions that take a FILE *. 2017-11-25 03:59:36 +00:00
Konstantin Belousov
ee50062cfb Kill all descendants of the reaper, even if they are descendants of a
subordinate reaper.

Also, mark reapers when listing pids.

Reported by:	Michael Zuo <muh.muhten@gmail.com>
PR:	223745
Reviewed by:	bapt
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D13183
2017-11-23 11:25:11 +00:00
Alan Somers
512bd18da5 Add a test case for cam_get_device with sa(4) devices
sa(4) has some unique behavior that is special-cased in cam_get_device. The
existing tests don't provide coverage for this special case.

Reviewed by:	ken
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D13185
2017-11-22 19:58:29 +00:00
Warner Losh
dd82111285 Add a reference to getfsstat in statfs.
Sponsored by: Netflix
2017-11-22 05:27:18 +00:00
Mark Johnston
1bdc41d252 Refine symtab sorting in libproc.
Add some rules to more closely match what illumos does when an address
resolves to multiple symbols:
- prefer non-local symbols
- prefer symbols with fewer leading underscores and no leading '$'

Add some regression tests to verify these rules.
2017-11-21 16:03:21 +00:00
Alan Somers
8a0a413e12 Fix multiple bugs in cam_strmatch
* Wrongly matches strings that are shorter than the pattern
* Fails to match negative character sets
* Fails to match character sets that aren't at the end of the pattern
* Fails to match character ranges

Reviewed by:	imp
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D13173
2017-11-20 22:01:45 +00:00
Ed Maste
5f8eed2f42 Install strings unconditionally
Previously it was enabled by WITH_/WITHOUT_TOOLCHAIN, but it is commonly
expected to be available and may have non-toolchain consumers.  As it
is now taken from the BSD-licensed ELF Tool Chain project, just install
it unconditionally.

PR:		213665, 223725
Reviewed by:	bdrewery
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8398
2017-11-20 20:55:41 +00:00
Pedro F. Giffuni
2b61d29172 iconv: Fix a pointer mismatch.
Catch NULL pointer earlier, check for empty string later.
Apparently this fixes a GCC8 warning.

Obtained from:	NetBSD (CVS Rev. 1.21, 1.22) through DragonFlyBSD
MFC after:	1 week
2017-11-20 20:05:30 +00:00
Pedro F. Giffuni
8a16b7a18f General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
Pedro F. Giffuni
df57947f08 spdx: initial adoption of licensing ID tags.
The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.

Initially, only tag files that use BSD 4-Clause "Original" license.

RelNotes:	yes
Differential Revision:	https://reviews.freebsd.org/D13133
2017-11-18 14:26:50 +00:00
Warner Losh
ca987d4641 Move sys/boot to stand. Fix all references to new location
Sponsored by:	Netflix
2017-11-14 23:02:19 +00:00
Warner Losh
0c16b53773 Move zstd from contrib to sys/contrib so it can be used in the
kernel. Adjust the Makefiles that referenced it to the new path.

Sponsored by: Netflix
OK'd by: cem@ and AllanJude@
2017-11-14 05:03:38 +00:00
Eric van Gyzen
9121aedd2f Fix formatting of _umtx_op(2)
Do not use macros in the -width of a .Bl, since mandoc does not support them.

Fix issues reported by igor and mandoc -Tlint.

Use a .Bl for list of clock IDs instead of a comma list.

MFC after:	3 days
Sponsored by:	Dell EMC
2017-11-13 17:46:38 +00:00
Warner Losh
50a717a67b Add notes about overlapping copies.
Add notes to each of these that specifically state that results are
undefined if the strings overlap. In the case of memcpy, we document
the overlapping behavior on FreeBSD (pre-existing). For str*, it is
left unspecified, however, since the default (and x86) implementations
do not handle overlapping strings properly.

PR: 223653
Sponsored by: Netflix
2017-11-13 17:04:44 +00:00
Mariusz Zaborski
7b4fce76cc Introduce syslog service for Casper.
syslog in libc secretly reconnects to the daemon.
Another issue is that we don't have any information from openlog(3) if we
succeeded to open log or not so we don't know if we are ready
to enter cabability mode.
Because all of that we decided we need a syslog service for Caspser.

Reviewed by:	bapt@
Differential Revision:	https://reviews.freebsd.org/D12824
2017-11-12 08:34:25 +00:00
Mariusz Zaborski
8751b03b19 We return a pointer when we are using cap_init() or cap_service_open()
function, so check if cap_chanel_t is NULL is not enough.
Casper with a normal libc will still fail in capability mote so let's not
enter capability mode without casper support when we need to resolve DNS.

Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D12823
2017-11-12 07:18:10 +00:00
Will Andrews
ec8659b385 libkvm: fix lib32 build. 2017-11-12 03:28:47 +00:00
Will Andrews
8baaf913be libkvm: fix build failures 2017-11-12 01:36:48 +00:00
Will Andrews
2aa6a4f3c8 libkvm: fix 'index' shadowing. 2017-11-12 00:00:38 +00:00
Will Andrews
c9057838be libkvm: add kvm_walk_pages API.
This API allows callers to enumerate all known pages, including any
direct map & kernel map virtual addresses, physical addresses, size,
offset into the core, & protection configured.

For architectures that support direct map addresses, also generate pages
for any direct map only addresses that are not associated with kernel
map addresses.

Fix page size portability issue left behind from previous kvm page table
lookup interface.

Reviewed by:	jhb
Sponsored by:	Backtrace I/O
Differential Revision:	https://reviews.freebsd.org/D12279
2017-11-11 23:30:58 +00:00
Baptiste Daroussin
b903189b6c Fix some nroff style issue
MFC after:	3 days
2017-11-11 14:39:13 +00:00
Baptiste Daroussin
04ac1c64fe Follow up on zstd update 2017-11-11 13:57:30 +00:00
Warner Losh
831bec1163 Simplify the efivar interface a little.
We started out having Linux compatible libefivar interfaces. This was
in anticipation of porting the GPL'd efibootmgr to FreeBSD via a
port. However, since we need that functionality in the base, that port
isn't going to happened. It also appears that efivar is a private
library that's not used much outside a command line util and
efibootmgr. Reduce compatibility with the Linux version a little by
removing the mode parameter to efi_set_variable (which was unused on
FreeBSD, and not set to something useful in the code we'd
written). Also remove some efi error routines that were never
implemented and existed only to placate early GPL efibootmgr porting
experiments.

Suggested by: Matt Williams
Sponsored by: Netflix
2017-11-10 23:30:23 +00:00
Bryan Drewery
ddf95e2ae8 Tell bsd.dep.mk which depend files to dinclude.
This allows the _SKIP_DEPEND optimization to work, avoiding reading
the files when not needed.  It also fixes META_MODE incorrectly
reading these files when not needed.

Sponsored by:	Dell EMC Isilon
2017-11-10 20:09:15 +00:00
Alexander Motin
898300ee11 s/NgSendMsgReply/NgSendReplyMsg/ in man to match the code.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	2 weeks
2017-11-08 12:34:47 +00:00
Glen Barber
0ff7d32714 Fix the 'casper' package, following r325062.
Submitted by:	woodsb02
Sponsored by:	The FreeBSD Foundation
2017-11-08 01:00:59 +00:00
John Baldwin
2b6e6d8500 Wrap to 80 columns. No functional change. 2017-11-07 17:45:39 +00:00
Bartek Rutkowski
cee09850f7 Make sysctl_kern_proc_umask execute fast path when requested pid in
curproc->p_pid or 0, avoiding unnecessary locking. Update libc consumer
to skip calling getpid().

Submitted by:	Pawel Biernacki <pawel.biernacki@gmail.com>
Reviewed by:	mjg, robak
Approved by:	mjg
Sponsored by:	Mysterious Code Ltd.
Differential Revision:	D12972
2017-11-07 15:13:32 +00:00
Warner Losh
25dfe63ccb Use MACHINE_CPUARCH in preference MACHINE for userland.
Sponsored by: Netflix
2017-11-07 09:57:26 +00:00
Warner Losh
8f3b60c5f1 Correct the detection of hard float arm
* Don't test MACHINE, it's irrelevant to userland and should never be
  used in userland Makefiles.
* If we match armv[67] and CPUTYPE is undefined OR it doesn't have
  'soft' in it, choose armhf.
* Add a note that the soft float on armv[67] may be broken.

Sponsored by: Netflix
2017-11-07 09:47:05 +00:00
Enji Cooper
d61b3d7a72 Redo r325502
:U:Mfoo expands to :Mfoo, apparently. Explicit check for CPUTYPE being
defined, and test for it's value not containing *soft* before calling CRTARCH
armhf.

Tested, somewhat. Unfortunately recent changes appear to have affected
cross-builds where it no longer works, per my tests after universe12a being
upgraded from 07/2017 to 11/2017 sources (DESTDIR isn't being used in WORLDTMP;
MK_SYSTEM_COMPILER might be causing issues right now).

MFC after:	1 week
MFC with:	r325502
Reported by:	imp
2017-11-07 06:26:48 +00:00
Enji Cooper
c03bb93303 Handle arm/armv[67] hosted/targeted builds gracefully
CPUTYPE (apparently) isn't defined in non-cross-builds, which caused
arm/armv[67] hosted/targeted builds to fail when evaluating CPUTYPE.

Add the :U modifier to CPUTYPE so it evaluates to "". This allows armv[67] to
get past the conditional successfully.

MFC after:	1 week
Reported by:	bob prohaska <fbsd@www.zefox.net>
2017-11-07 05:02:36 +00:00
Enji Cooper
5252514fb4 Remove unnecessary src.opts.mk .include
MK_<FOO> isn't used in lib/libcompiler_rt/Makefile at all. Remove it to reduce
namespace pollution.

MFC after:	1 week
2017-11-07 04:56:53 +00:00
Enji Cooper
a2a142486a Use bsd.compiler.mk instead of src.opts.mk
- MK_PROFILE is controlled in bsd.opts.mk, which is pulled in via bsd.own.mk,
  which is pulled in via bsd.init.mk . All upstream Makefiles which build off
  of this one use bsd.init.mk.
- COMPILER_{TYPE,VERSION} is set via bsd.compiler.mk .

This reduces the namespace pollution/complexity somewhat.

MFC after:	1 week
2017-11-07 04:55:23 +00:00
Enji Cooper
792bc22266 Choose a simpler, more philosophically correct version for CRTARCH with armv[67]
This is a rework of r325443.

PR:		222925
Tested with:	make buildenv with appropriate TARGET/TARGET_ARCH pairs
2017-11-05 20:38:40 +00:00
Enji Cooper
c9c9774c70 Revert r325443
Despite the fact that it's a working solution, it doesn't follow the design
philosophy of only doing TARGET_* in Makefile.inc1 and special locations in
the source tree.

PR:		222925
Requested by:	imp
2017-11-05 20:01:00 +00:00
Enji Cooper
571e134eea Fix paths for cross-built versions of lib/libclang_rt and hardfloat arm variants
- Define TARGET_CPUARCH and use in libclang_rt as the basis for CRTARCH

  When cross-compiling, the wrong architecture was being embedded in the
  libclang_rt binary filenames. It should be based on TARGET_ARCH (target), not
  MACHINE_ARCH (host).

  If TARGET_ARCH isn't defined (host-builds), fallback to MACHINE_ARCH.

- Define CRTARCH to armhf when TARGET/TARGET_ARCH are set to arm/armv[67]

  TARGET_ABI/TARGET_CPU in Makefile.inc1 sets the ABI to gnueabihf, which
  affects the clang lookup path per `getArchNameForCompilerRTLib(..)` in
  contrib/llvm/tools/clang/lib/Driver/ToolChain.cpp, so chase clang and
  Linux's assumed naming convention for hard-float arm architectures.

  CROSSENV (in Makefile.inc1) sets CPUTYPE/MACHINE(_ARCH)? to the
  TARGET*-relevant values when building the `libraries` target, so test
  those variables instead.

- Add OLD_FILES/OLD_LIBS entries for TARGET/TARGET_ARCH == arm/armv[67]. This
  impacts only arm/armv6 and arm/armv7.

PR:	222925
2017-11-05 19:38:51 +00:00
Enji Cooper
a060f1416a Support compiling lib/libclang_rt/profile a bit more with recent versions of gcc
Several of the flags were being treated as CFLAGS, when they were actually
technically CXXFLAGS. Move them there.

Only apply -fno-sanitize=safe-stack with clang.

PR:             223179
2017-11-05 19:25:06 +00:00
Benedict Reuschling
18b80db55f The last example used LOG_INFO, but the message itself said error.
Change to LOG_ERR to be less confusing.

PR:			216756
Submitted by:		Thomas Cort (linuxgeek@gmail.com)
Reviewed by:		noone (after 2 months)
Differential Revision:	https://reviews.freebsd.org/D11824
2017-11-05 18:24:31 +00:00
Enji Cooper
600da319ad Simplify r325427
CROSSENV (in Makefile.inc1) sets CPUTYPE/MACHINE(_ARCH)? to the
TARGET*-relevant values when building the `libraries` target.

PR:	222925
2017-11-05 07:48:40 +00:00
Enji Cooper
7efeac5c18 Define CRTARCH to armhf when TARGET/TARGET_ARCH are set to arm/armv[67]
TARGET_ABI/TARGET_CPU in Makefile.inc1 sets the ABI to gnueabihf, which affects
the clang lookup path per getArchNameForCompilerRTLib(..) in
contrib/llvm/tools/clang/lib/Driver/ToolChain.cpp .

This is a follow up to r324873.

PR:		222925
2017-11-05 07:36:11 +00:00
Enji Cooper
254d2760ce MFhead@r325422 2017-11-05 04:08:00 +00:00
Ed Maste
8ca8d252bb posix_fallocate.2: add an EINVAL errno case
As of r325320 posix_fallocate returns EINVAL on ZFS to indicate that
the underlying filesystem does not support this operation, per
POSIX.1-2008. Document this case in the man page.

MFC after:	20 days
MFC with:	r325320
Sponsored by:	The FreeBSD Foundation
2017-11-05 03:02:19 +00:00
Mariusz Zaborski
0dfac7ee08 The src.opts.mk sets default value for the SHLIBDIR, so our set was not
respected.

Please notice that libcasper is already in ObsoleteFiles so we don't add it
again.

Reported by:	Herbert J. Skuhra <herbert@mailbox.org>
Reviewed by:	bdrewery@
Differential Revision:	https://reviews.freebsd.org/D12918
2017-11-04 15:50:05 +00:00
Mariusz Zaborski
95844abe53 Casper work's only as shared library - disable building static ones.
Reviewed by:	bdrewery@
Differential Revision:	https://reviews.freebsd.org/D12917
2017-11-04 15:47:18 +00:00
Konstantin Belousov
6a96a39c77 C++17 requires quick_exit(3) to be async-signal safe.
Make it safe, and update man page with the useful information.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-11-04 10:52:58 +00:00
Enji Cooper
f6e116eea9 MFhead@r325383 2017-11-04 07:05:21 +00:00
Kenneth D. Merry
70a8349311 Add the LTO-8 Type M density code (0x5d, LTO-8M) to libmt and the
mt(1) man page.

LTO-8 Type M (also known as M8) is a pristine LTO-7 cartridge
formatted in a LTO-8 drive in a new, higher density format.  It
has a separate density code, and is only readable in an LTO-8
drive.

lib/libmt/mtlib.c:
	Add the LTO-8 Type M density code to the density table
	in libmt.

usr.bin/mt/mt.1:
	Add the LTO-8 Type M density code to the density
	table in the mt(1) man page.

MFC after:	3 days
Sponsored by:	Spectra Logic
2017-11-03 21:04:22 +00:00
Michal Meloun
8584ed54ab Add alignment support to __libc_allocate_tls().
For statically linked binaries, where all relocation are solved by static
linker, the linker expect that offset to TLS section is aligned. Additionaly,
to maintain absolute alignment, TLS TCB should by also aligned.

Obtained from:	CheriBSD (initial version)
MFC after:	1 month
Reviewed by:	brooks (previous version), kib
Differential Revision:	https://reviews.freebsd.org/D12907
2017-11-03 15:57:27 +00:00
Cy Schubert
aee1526ce7 While discussing the new gets_s.c in D12785, ed@ suggested putting
{}'s around the if (c == EOF) block to prevent potential 'trailing else'
issues from being introduced when refactoring. As my gets_s() code
is based on this, it makes sense to fix the same issue here first
here and now, then do an svn copy again to capture this history).

Suggested by:	ed@ in D12785
2017-11-03 13:08:29 +00:00
Alex Richardson
8974782e89 Export std::get_new_handler() from libcxxrt.so
When trying to build world for MIPS64 with clang I was getting
linker errors because of a missing reference to std::get_new_handler().
It turns out std::get_new_handler() was not listed in Version.map so it was
marked as a local symbol in libcxxrt.so.

Reviewed by:	theraven, brooks (mentor), emaste
Approved by:	trasz
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D11925
2017-11-03 12:52:59 +00:00
Bryan Drewery
939d033cab Disconnect libpathconv tests since they require external perl and do not work with kyua.
This reverts r325192 and is due to libpathconv being connected in r325186.

Reported by:	ngie
Sponsored by:	Dell EMC Isilon
2017-10-31 19:52:30 +00:00
Enji Cooper
0821ef1af8 MFhead@r325209 2017-10-31 04:12:48 +00:00
Enji Cooper
ca28b8ee5b Add static to cap_setgrent prototype in !WITH_CASPER case
This unbreaks the default powerpc/sparc64 build configuration after r325062.
2017-10-31 04:02:50 +00:00
Enji Cooper
076777cc29 MFhead@r325199 2017-10-31 02:46:36 +00:00
Bryan Drewery
ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Bryan Drewery
3806950135 DIRDEPS_BUILD: Connect new directories.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:04:07 +00:00
Bryan Drewery
82fcadcd55 Connect libpathconv, disconnected since import in r309035.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:03:52 +00:00
Bryan Drewery
a160cbfa07 DIRDEPS_BUILD: libgcc now depends on MK_LLVM_LIBUNWIND
The dependency on gnu/lib/libgcc or lib/libgcc* is determined
at 'make dirdeps' time.

Sponsored by:	Dell EMC Isilon
2017-10-31 00:03:36 +00:00
Enji Cooper
ae1a42beff Revert r325128; would break buildworld without TARGET_ARCH 2017-10-30 08:23:48 +00:00
Enji Cooper
ebcaa90545 Don't try overriding TARGET_ARCH from llvm.build.mk; rely on sys.mk's definition 2017-10-30 08:19:27 +00:00
Enji Cooper
3c5ab8c1cc MFhead@r325119 2017-10-30 05:52:26 +00:00