Commit graph

19101 commits

Author SHA1 Message Date
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