]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agobsdinstall/zfsboot GPT+BIOS+GELI installs now make use of GELIBOOT
Allan Jude [Sun, 22 May 2016 20:31:52 +0000 (20:31 +0000)]
bsdinstall/zfsboot GPT+BIOS+GELI installs now make use of GELIBOOT

In this configuration, a separate bootpool is not required.
This allows ZFS Boot Environments to be used with GELI encrypted ZFS pools.

Support for GPT+EFI+GELI is planned for the future.

Tested by: Joseph Mingrone, HardenedBSD
Relnotes: yes
Sponsored by: ScaleEngine Inc.
Differential Revision: https://reviews.freebsd.org/D5869

8 years agognugrep: Update the configuration.
Pedro F. Giffuni [Sun, 22 May 2016 20:17:55 +0000 (20:17 +0000)]
gnugrep: Update the configuration.

The only effect is that it will use our native iconv(3).

Relnotes: yes

8 years agourtwn: cleanup some unused code in urtwn_tx_data().
Andriy Voskoboinyk [Sun, 22 May 2016 20:12:07 +0000 (20:12 +0000)]
urtwn: cleanup some unused code in urtwn_tx_data().

- Drop unused 'subtype' variable.
- Remove obsolete comment (hardware crypto support was added in r292175).

8 years agourtwn: setup per-frame retry limit.
Andriy Voskoboinyk [Sun, 22 May 2016 19:43:40 +0000 (19:43 +0000)]
urtwn: setup per-frame retry limit.

Override global retry limit (which is set in R92C_RL) via per-frame
TX descriptor field. Obsoletes D3840 (should work better with 2+ vaps).

Tested with RTL8188EU and RTL8192CUS in STA mode (maxretry = [3-9]).

8 years agoRemove false claim. Giant is dropped by mi_startup() before passing
Konstantin Belousov [Sun, 22 May 2016 19:25:53 +0000 (19:25 +0000)]
Remove false claim.  Giant is dropped by mi_startup() before passing
the control to swapper.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

8 years agoConvert proto family in both directions. The linux and native values for
Dmitry Chagin [Sun, 22 May 2016 19:08:29 +0000 (19:08 +0000)]
Convert proto family in both directions. The linux and native values for
local and inet are identical, but for inet6 values differ.

PR: 155040
Reported by: Simon Walton
MFC after: 2 week

8 years agoWrap EXPAND(..) macro with a do-while(0) loop and put a single statement on each...
Enji Cooper [Sun, 22 May 2016 19:06:38 +0000 (19:06 +0000)]
Wrap EXPAND(..) macro with a do-while(0) loop and put a single statement on each line

As a positive side-effect, this eliminates the double semicolons reported by Coverity:
the macro contained a trailing semicolon, in addition to the semicolon placed on
each line where EXPAND(..) was called.

MFC after: 1 week
Reported by: Coverity
CID: 1194269
Sponsored by: EMC / Isilon Storage Division

8 years agoRemove a now unused global declaration of some sysentvec struct.
Dmitry Chagin [Sun, 22 May 2016 19:04:34 +0000 (19:04 +0000)]
Remove a now unused global declaration of some sysentvec struct.

MFC after: 2 week

8 years agoFix humanized decoding of struct stat with respect to .st_mtim
Enji Cooper [Sun, 22 May 2016 18:20:45 +0000 (18:20 +0000)]
Fix humanized decoding of struct stat with respect to .st_mtim

st_mtim was being incorrectly described as "stime=", not "mtime=". This was
introduced with the original feature commit (r176471).

MFC after: 1 week
PR: 209699
Submitted by: naddy
Sponsored by: EMC / Isilon Storage Division

8 years agoRemove drop/reacquire of Giant around geom calls for cd9660 and udf.
Konstantin Belousov [Sun, 22 May 2016 18:16:25 +0000 (18:16 +0000)]
Remove drop/reacquire of Giant around geom calls for cd9660 and udf.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

8 years agoFix default ZFS layout to work better by default with sysutils/beadm
Allan Jude [Sun, 22 May 2016 16:24:21 +0000 (16:24 +0000)]
Fix default ZFS layout to work better by default with sysutils/beadm

The root file system is mounted early via vfs.root.mountfrom.
The canmount=noauto property only affects the zfs rc.d script.
This ensures that the 'default' BE is not mounted overtop of another BE when
one is selected from the beastie menu

Sponsored by: ScaleEngine Inc.

8 years agoImprove panic message by specifying on which cpu it really is.
Andrey A. Chernov [Sun, 22 May 2016 15:22:45 +0000 (15:22 +0000)]
Improve panic message by specifying on which cpu it really is.

8 years agoarc4random() returns 0 to (2**32)−1, use an alternative to initialize
Kevin Lo [Sun, 22 May 2016 14:31:20 +0000 (14:31 +0000)]
arc4random() returns 0 to (2**32)−1, use an alternative to initialize
i_gen if it's zero rather than a divide by 2.

With inputs from  delphij, mckusick, rmacklem

Reviewed by: mckusick

8 years agondis(4): Undo unneeded workarounds in ndis' rand().
Pedro F. Giffuni [Sun, 22 May 2016 14:13:20 +0000 (14:13 +0000)]
ndis(4):  Undo unneeded workarounds in ndis' rand().

- Revert the change for seed(0) in r300384. I misunderstood the standard
and while our random() implementation in libkern may be improved, it
handles the seed(0) case fine.

Pointed out by: bde, ache

8 years agoFix the deciKelvin to Celsius conversion in kernel.
Luiz Otavio O Souza [Sun, 22 May 2016 13:58:32 +0000 (13:58 +0000)]
Fix the deciKelvin to Celsius conversion in kernel.

After r285994, sysctl(8) was fixed to use 273.15 instead of 273.20 as 0C
reference and as result, the temperature read in sysctl(8) now exibits a
+0.1C difference.

This commit fix the kernel references to match the reference value used in
sysctl(8) after r285994.

Sponsored by: Rubicon Communications (Netgate)

8 years agovfork(2): Mention some risks of calling vfork() from application code.
Jilles Tjoelker [Sun, 22 May 2016 13:32:45 +0000 (13:32 +0000)]
vfork(2): Mention some risks of calling vfork() from application code.

MFC after: 1 week

8 years agoFix typo introduced by me (not the submitter) when fixing typos
Baptiste Daroussin [Sun, 22 May 2016 13:10:48 +0000 (13:10 +0000)]
Fix typo introduced by me (not the submitter) when fixing typos

8 years agoFix typos in the comments
Baptiste Daroussin [Sun, 22 May 2016 13:04:45 +0000 (13:04 +0000)]
Fix typos in the comments

Submitted by: cipherwraith666@gmail.com (via github)

8 years agoFix typo in comments for the zfsboot script
Baptiste Daroussin [Sun, 22 May 2016 12:59:07 +0000 (12:59 +0000)]
Fix typo in comments for the zfsboot script

Submitted by: Colby Swandale <colby@taplaboratories.com.au> (via github)

8 years agoAdd a missing errno translation for SO_ERROR optname.
Dmitry Chagin [Sun, 22 May 2016 12:49:08 +0000 (12:49 +0000)]
Add a missing errno translation for SO_ERROR optname.

PR: 135458
Reported by: Stefan Schmidt @ stadtbuch.de
MFC after: 1 week

8 years agoAdd macro to convert errno and use it when appropriate.
Dmitry Chagin [Sun, 22 May 2016 12:46:34 +0000 (12:46 +0000)]
Add macro to convert errno and use it when appropriate.

MFC after: 1 week

8 years agoFor future use move futex timeout code to the separate function and
Dmitry Chagin [Sun, 22 May 2016 12:37:40 +0000 (12:37 +0000)]
For future use move futex timeout code to the separate function and
switch to the high resolution sbintime_t.

MFC after: 1 week

8 years agoDue to lack the priority propagation feature replace sx by mutex. WIth this
Dmitry Chagin [Sun, 22 May 2016 12:35:50 +0000 (12:35 +0000)]
Due to lack the priority propagation feature replace sx by mutex. WIth this
commit NPTL tests are ends in 1 minute faster.

MFC after: 1 week

8 years agoAdd my copyright as I rewrote most of the futex code. Minor style(9) cleanup
Dmitry Chagin [Sun, 22 May 2016 12:28:55 +0000 (12:28 +0000)]
Add my copyright as I rewrote most of the futex code. Minor style(9) cleanup
while here.

MFC after: 1 week

8 years agoMinor style(9) cleanup, no functional changes.
Dmitry Chagin [Sun, 22 May 2016 12:26:03 +0000 (12:26 +0000)]
Minor style(9) cleanup, no functional changes.

MFC after: 1 week

8 years agoINTRNG - implement pic_post_filter method. This method is fundamental
Svatopluk Kraus [Sun, 22 May 2016 11:42:34 +0000 (11:42 +0000)]
INTRNG - implement pic_post_filter method. This method is fundamental
one and must always be implemented for a PIC. There is no default for
it intentionally.

8 years agoFix some format strings to make them either correct or uniform.
Svatopluk Kraus [Sun, 22 May 2016 09:59:43 +0000 (09:59 +0000)]
Fix some format strings to make them either correct or uniform.
No functional change.

8 years agoStop dereferencing _end in crt1.c. This was only needed for brk/sbrk so is
Andrew Turner [Sun, 22 May 2016 08:20:30 +0000 (08:20 +0000)]
Stop dereferencing _end in crt1.c. This was only needed for brk/sbrk so is
no longer needed.

Sponsored by: ABT Systems Ltd

8 years ago1) POSIX prohibits printing errors to stderr here and require
Andrey A. Chernov [Sun, 22 May 2016 06:18:59 +0000 (06:18 +0000)]
1) POSIX prohibits printing errors to stderr here and require
returning NULL:

"Upon successful completion, initstate() and setstate() shall return a
pointer to the previous state array; otherwise, a null pointer shall
be returned.

Although some implementations of random() have written messages to
standard error, such implementations do not conform to POSIX.1-2008."

2) Move error detections earlier to prevent state modifying.

MFC after:      1 week

8 years agoSilence top(1) compiler warnings
Enji Cooper [Sun, 22 May 2016 04:17:00 +0000 (04:17 +0000)]
Silence top(1) compiler warnings

The contrib/top code is no longer maintained upstream (last pulled 16 years
ago). The K&R-style followed by the code spews -Wimplicit-int and -Wreturn-type
warnings, amongst others. This silences 131 warnings with as little modification
as possible by adding necessary return types, definitions, headers, and header
guards, and missing header includes.

The 5 warnings that remain are due to undeclared ncurses references. I didn't
include curses.h and term.h because there are several local functions and macros
that conflict with those definitions.

MFC after: 3 weeks
Reviewed by: cem, ngie
Submitted by: Randy Westlund <rwestlun@gmail.com>
Differential Revision: https://reviews.freebsd.org/D6468

8 years agoRemove a couple of extra blank lines.
Luiz Otavio O Souza [Sun, 22 May 2016 04:09:05 +0000 (04:09 +0000)]
Remove a couple of extra blank lines.

8 years agoSort and remove a couple of unnecessary headers.
Luiz Otavio O Souza [Sun, 22 May 2016 04:02:34 +0000 (04:02 +0000)]
Sort and remove a couple of unnecessary headers.

8 years agoGet rid of two consumers of gpiobus acquire/release.
Luiz Otavio O Souza [Sun, 22 May 2016 03:55:57 +0000 (03:55 +0000)]
Get rid of two consumers of gpiobus acquire/release.

The GPIO hardware should not be owned by a single device, this defeats any
chance of use of the GPIO controller as an interrupt source.

ow(4) is now the only consumer of this 'feature' before we can remove it
for good.

Discussed with: ian, bsdimp

8 years agoUse a better prefix for defines, return BUS_PROBE_DEFAULT for probe routine.
Luiz Otavio O Souza [Sun, 22 May 2016 03:34:18 +0000 (03:34 +0000)]
Use a better prefix for defines, return BUS_PROBE_DEFAULT for probe routine.

Refuse to attach if the number of given pins is not enough for our needs.

8 years agoFix probe routine to return BUS_PROBE_DEFAULT instead of BUS_PROBE_SPECIFIC.
Luiz Otavio O Souza [Sun, 22 May 2016 03:12:49 +0000 (03:12 +0000)]
Fix probe routine to return BUS_PROBE_DEFAULT instead of BUS_PROBE_SPECIFIC.

While here fix a few style(9) issues.

8 years agonis_rpcent: don't leak resultbuf from yp_first(..)/yp_next(..)
Enji Cooper [Sun, 22 May 2016 03:05:27 +0000 (03:05 +0000)]
nis_rpcent: don't leak resultbuf from yp_first(..)/yp_next(..)

If the buffer couldn't be adequately resized to accomodate an additional "\n",
it would leak resultbuf by breaking from the loop early

MFC after: 2 weeks
Reported by: Coverity
CID: 1016702
Sponsored by: EMC / Isilon Storage Division

8 years agoCall endnetconfig on nc_handle sooner to avoid leaking nc_handle if tmpnconf
Enji Cooper [Sun, 22 May 2016 02:53:11 +0000 (02:53 +0000)]
Call endnetconfig on nc_handle sooner to avoid leaking nc_handle if tmpnconf
was NULL

This would theoretically happen if the netconfig protocol family and protocol
semantics were never matched.

MFC after: 2 weeks
Reported by: Coverity
CID: 978179
Sponsored by: EMC / Isilon Storage Division

8 years agogetnetid(..): consistently fclose fd at the end of the function
Enji Cooper [Sun, 22 May 2016 02:24:38 +0000 (02:24 +0000)]
getnetid(..): consistently fclose fd at the end of the function

This mutes a false positive with cppcheck, but also helps eliminate future
potential issues with this variable

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoDon't leak `handle` if svc_tp_create(..) succeeds and allocating a new
Enji Cooper [Sun, 22 May 2016 02:02:18 +0000 (02:02 +0000)]
Don't leak `handle` if svc_tp_create(..) succeeds and allocating a new
struct xlist object fails

MFC after: 1 week
Reported by: Coverity
CID: 978277
Sponsored by: EMC / Isilon Storage Division

8 years agoDon't leak `tmp` if `p->nc_lookups` can't be malloced
Enji Cooper [Sun, 22 May 2016 01:45:15 +0000 (01:45 +0000)]
Don't leak `tmp` if `p->nc_lookups` can't be malloced

MFC after: 1 week
Reported by: cppcheck
Sponsored by: EMC / Isilon Storage Division

8 years agondis(4): adjustments for our random() specific implementation.
Pedro F. Giffuni [Sun, 22 May 2016 00:29:25 +0000 (00:29 +0000)]
ndis(4):  adjustments for our random() specific implementation.

- Revert r300377: The implementation claims to return a value
  within the range. [1]
- Adjust the value for the case of a zero seed, whihc according
  to standards should be equivalent to a seed of value 1.

Pointed out by: cem

8 years agonet80211: send RTM_IEEE80211_SCAN event when scan was cancelled.
Andriy Voskoboinyk [Sat, 21 May 2016 23:21:42 +0000 (23:21 +0000)]
net80211: send RTM_IEEE80211_SCAN event when scan was cancelled.

wpa_supplicant(8) expects to see 'scan complete' event after every
scan command; in case, when event is not sent it will hang for
indefinite time.

PR: 209198

8 years agoWhen descending a shadow chain of objects, it makes no sense to update
Alan Cox [Sat, 21 May 2016 23:18:23 +0000 (23:18 +0000)]
When descending a shadow chain of objects, it makes no sense to update
the current offset (spelled: "fs.pindex") until it is known whether a
backing object exists.  In fact, if not for the fact that the backing
object offset is zero when there is no backing object, this update would
produce a broken offset.

Reviewed by: kib

8 years agolibc/regex: fix two buffer underruns.
Pedro F. Giffuni [Sat, 21 May 2016 19:54:10 +0000 (19:54 +0000)]
libc/regex: fix two buffer underruns.

Fix some rather complex regex issues found on OpenBSD as part of some
ongoing work to fix a sed(1) bug.

Curiously the OpenBSD tests don't trigger segfaults on FreeBSD but the
bugs were confirmed by running a port of FreeBSD's regex under OpenBSD's
malloc. Huge thanks to Ingo for confirming the behavior.

Taken from: Ingo Schwarze (through openbsd-tech 2016-05-15)
MFC after: 1 week

8 years agondis(4): Avoid overflow.
Pedro F. Giffuni [Sat, 21 May 2016 17:52:44 +0000 (17:52 +0000)]
ndis(4): Avoid overflow.

This is a long standing problem: our random() function returns an
unsigned integer but the rand provided by ndis(4) returns an int.
Scale it down.

MFC after: 2 weeks

8 years agondis(4): Better mimic the behavior of rand() on Windows.
Pedro F. Giffuni [Sat, 21 May 2016 17:38:43 +0000 (17:38 +0000)]
ndis(4): Better mimic the behavior of rand() on Windows.

In ndis(4) we expose a rand() function that was constantly reseeding
with a time depending function every time it was called. This
essentially broke the reasoning behind seeding, and rendered srand()
a no-op.

Keep it simple, just use random() and srandom() as it's meant to work.
It  would have been tempting to just go for arc4random() but we
want to mimic Microsoft, and we don't need crypto-grade randomness
here.

PR: 209616
MFC after: 2 weeks

8 years agoAdjust _ALIGNBYTES to the proper value for arm and armv6 arches. Modern
Ian Lepore [Sat, 21 May 2016 16:52:38 +0000 (16:52 +0000)]
Adjust _ALIGNBYTES to the proper value for arm and armv6 arches.  Modern
compilers can emit arm instructions that require 8-byte alignment.  The
alignment-sensitive instructions were added in armv5, which has to be
supported by our combined v4/v5 kernels, so the value is set uncoditionally
for all arm architecture versions.

Also adjust the comment to explain in more detail why the macros have the
form and values they do.

Per advice from bde@, maintain the unsignedness of the value of _ALIGNBYTES
(but do so using his second choice of allowing sizeof() to supply the
unsignedness, rather than just hardcoding '8U', which in my mind would
require an even more verbose comment to explain why it's right).  Also
explain in the comment that the resulting type of _ALIGN() is equivelent
to uinptr_t on arm (32-bit unsigned int), but it's purposely spelled as
"unsigned" to avoid problems with including other header files.  Even
including machine/_types.h to allow use of __uintptr_t causes compilation
failures because of this header being included (indirectly) in asm code.

The discussion that led to this change (albeit at a glacial pace) is at
https://lists.freebsd.org/pipermail/svn-src-head/2014-November/064593.html

8 years agoelftoolchain: backwards compatability for ELFOSABI_CLOUDABI definition
Ed Maste [Sat, 21 May 2016 15:38:40 +0000 (15:38 +0000)]
elftoolchain: backwards compatability for ELFOSABI_CLOUDABI definition

It is not provided by sys/elf_common.h on older releases or -current
before March 2015.

Reported by: Jenkins

8 years agofix loss of taskqueue wakeups (introduced in r300113)
Andriy Gapon [Sat, 21 May 2016 14:51:49 +0000 (14:51 +0000)]
fix loss of taskqueue wakeups (introduced in r300113)

Submitted by: kmacy
Tested by: dchagin

8 years agoSame as for UFS, remove drop/reacquire of Giant, and use si_mountpt as
Konstantin Belousov [Sat, 21 May 2016 11:40:41 +0000 (11:40 +0000)]
Same as for UFS, remove drop/reacquire of Giant, and use si_mountpt as
the mount semaphore.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

8 years agoProperly reset session state when using proxy and fail_on_disconnection=1.
Edward Tomasz Napierala [Sat, 21 May 2016 11:26:03 +0000 (11:26 +0000)]
Properly reset session state when using proxy and fail_on_disconnection=1.
Without it the reconnection would fail due to mismatched sequence numbers.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoProvide a way for ICL modules to declare they support PIM_UNMAPPED.
Edward Tomasz Napierala [Sat, 21 May 2016 11:10:48 +0000 (11:10 +0000)]
Provide a way for ICL modules to declare they support PIM_UNMAPPED.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoPass maxtags value to the ICL module. iSER needs it.
Edward Tomasz Napierala [Sat, 21 May 2016 10:59:36 +0000 (10:59 +0000)]
Pass maxtags value to the ICL module.  iSER needs it.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoStop dropping and reacquiring Giant around geom calls in UFS.
Konstantin Belousov [Sat, 21 May 2016 10:13:25 +0000 (10:13 +0000)]
Stop dropping and reacquiring Giant around geom calls in UFS.

Sponsored by: The FreeBSD Foundation

8 years agoRemove zero assignments in the cdev allocator. cdp memory is
Konstantin Belousov [Sat, 21 May 2016 09:55:32 +0000 (09:55 +0000)]
Remove zero assignments in the cdev allocator.  cdp memory is
requested with M_ZERO.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

8 years agoImprove handling of rdev->si_mountpt on mount and unmount of FFS
Konstantin Belousov [Sat, 21 May 2016 09:49:35 +0000 (09:49 +0000)]
Improve handling of rdev->si_mountpt on mount and unmount of FFS
volumes.  Treat the field as a semaphore protecting availability of
the device for mounting.  Do no access devvp->v_rdev without the vnode
lock owned.

Protect change of the devvp->v_bufobj bo_ops vector with the vnode
lock.

Reviewed by: bde
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

8 years agoRegen after r300359 (struct l_sched_param removal).
Dmitry Chagin [Sat, 21 May 2016 08:03:13 +0000 (08:03 +0000)]
Regen after r300359 (struct l_sched_param removal).

MFC after: 1 week

8 years agoCorrect an argument param of linux_sched_* system calls as a struct l_sched_param
Dmitry Chagin [Sat, 21 May 2016 08:01:14 +0000 (08:01 +0000)]
Correct an argument param of linux_sched_* system calls as a struct l_sched_param
does not defined due to it's nature.

MFC after: 1 week

8 years agoBetter document security_show_{success,info,badconfig} in /etc/periodic.conf
Alan Somers [Sat, 21 May 2016 02:14:11 +0000 (02:14 +0000)]
Better document security_show_{success,info,badconfig} in /etc/periodic.conf

periodic(8) already handles the security_show_{success,info,badconfig}
variables correctly. However, those variables aren't explicitly set in
/etc/defaults/periodic.conf or anywhere else, which suggests to the user
that they shouldn't be used.

etc/defaults/periodic.conf
Explicitly set defaults for security_show_{success,info,badconfig}

usr.sbin/periodic/periodic.sh
Update usage string

usr.sbin/periodic/periodic.8
Minor man page updates

One thing I'm _not_ doing is recommending setting security_output to
/var/log/security.log or adding that file to /etc/newsyslog.conf, because
periodic(8) would create it with default permissions, usually 644, and
that's probably a bad idea.

Reviewed by: brd
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D6477

8 years agoRegenerate
Bryan Drewery [Sat, 21 May 2016 01:35:48 +0000 (01:35 +0000)]
Regenerate

8 years agoOpportunistically skip building a cross-compiler with SYSTEM_COMPILER set.
Bryan Drewery [Sat, 21 May 2016 01:32:23 +0000 (01:32 +0000)]
Opportunistically skip building a cross-compiler with SYSTEM_COMPILER set.

This will still build the compiler for the target but will not build the
bootstrap cross-compiler in the cross-tools phase.  Other toolchain
bootstrapping, such as elftoolchan and binutils, currently still occurs.

This will utilize the default CC (cc, /usr/bin/cc) as an external compiler.

This is planned to be on-by-default eventually.

This will utilize the __FreeBSD_cc_version compiler macro defined in the
source tree and compare it to CC's version.  If they match then the
cross-compiler is skipped.  If [X]CC is an external compiler (absolute
path) or WITHOUT_CROSS_COMPILER is already set, then this logic is skipped.
If the expected bootstrap compiler type no longer matches the found CC
compiler type (clang vs gcc), then the logic is skipped.  As an extra
safety check the version number is also compared from the compiler to
the tree version.

Clang:
  The macro FREEBSD_CC_VERSION is defined in:
    lib/clang/include/clang/Basic/Version.inc
  For clang -target will be used if TARGET_ARCH != MACHINE_ARCH.  This
  is from the current external toolchain logic.  There is currently an
  assumption that the host compiler can build the TARGET_ARCH.  This
  will usually be the case since we don't conditionalize target arch
  support in clang, but it will break when introducing new
  architectures.  This problem is mitigated by incrementing the version
  when adding new architectures.

GCC:
  The macro FBSD_CC_VER is defined in:
    gnu/usr.bin/cc/cc_tools/freebsd-native.h
  For GCC there is no simple -target support when TARGET_ARCH !=
  MACHINE_ARCH.  In this case the opportunistic skip is not done.  If we
  add proper support for this case in external toolchain logic then it
  will be fine to enable.

This relies on the macros being incremented whenever any change occurs
to these compilers that warrant rebuilding files.  It also should never
repeat earlier values.

Reviewed by: brooks, bapt, imp
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D6357

8 years agoAdd FREEBSD_CC_VERSION which will be used to define __FreeBSD_cc_version.
Bryan Drewery [Sat, 21 May 2016 01:32:20 +0000 (01:32 +0000)]
Add FREEBSD_CC_VERSION which will be used to define __FreeBSD_cc_version.

The WITH_SYSTEM_COMPILER build option will rely on this value to determine what
__FreeBSD_cc_version the source tree will produce.  This value will be compared
against the /usr/bin/cc value to determine if a new compiler is needed.

Start with 1100002 which is 1 more than than the value we've had since
3.8.0 to ensure that all changes since then are present.

Reviewed by: dim
Sponsored by: EMC / Isilon Storage Division

8 years agoEnable external compiler logic if both bootstrap compilers are disabled.
Bryan Drewery [Sat, 21 May 2016 01:32:16 +0000 (01:32 +0000)]
Enable external compiler logic if both bootstrap compilers are disabled.

Reviewed by: brooks
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D6358

8 years agoFetch the __FreeBSD_cc_version as COMPILER_FREEBSD_VERSION.
Bryan Drewery [Sat, 21 May 2016 01:32:13 +0000 (01:32 +0000)]
Fetch the __FreeBSD_cc_version as COMPILER_FREEBSD_VERSION.

Reviewed by: brooks, bapt, dim
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D6356

8 years agoAuto determine X_COMPILER_TYPE/X_COMPILER_VERSION if XCC is set.
Bryan Drewery [Sat, 21 May 2016 01:32:10 +0000 (01:32 +0000)]
Auto determine X_COMPILER_TYPE/X_COMPILER_VERSION if XCC is set.

Reviewed by: brooks, bapt
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D6355

8 years agoEnable and utilize WITHOUT_CROSS_COMPILER logic for external CC.
Bryan Drewery [Sat, 21 May 2016 01:32:07 +0000 (01:32 +0000)]
Enable and utilize WITHOUT_CROSS_COMPILER logic for external CC.

This is a NOP.

Reviewed by: brooks, bapt
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D6354

8 years agoMove external toolchain support earlier.
Bryan Drewery [Sat, 21 May 2016 01:32:04 +0000 (01:32 +0000)]
Move external toolchain support earlier.

This is to consolidate external toolchain and WITHOUT_CROSS_COMPILER support.

Reviewed by: brooks, bapt
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D6353

8 years agoWITH_META_MODE: Avoid rebuilds of cc_tools during target build.
Bryan Drewery [Sat, 21 May 2016 01:32:01 +0000 (01:32 +0000)]
WITH_META_MODE: Avoid rebuilds of cc_tools during target build.

This is the same as r299289 and r297997.

Sponsored by: EMC / Isilon Storage Division

8 years agoWITH_META_MODE: Disable cookie handling for include installation.
Bryan Drewery [Sat, 21 May 2016 01:31:57 +0000 (01:31 +0000)]
WITH_META_MODE: Disable cookie handling for include installation.

Using a cookie with meta mode causes it to *not rerun* (as normal make
does) unless the command changes or filemon-detected files change.

After all of the work done here it turns out that skipping installation
is dangerous since the install commands use <dir>/*.h.  The actual build
command is not changing but the files installed are changing by the mere
act of adding a new header into the source tree.  Thus we cannot safely
use meta mode logic here.  It must always rerun and install the headers.
The install -C flag at least prevents churning timestamps when
installing a header that was already present.

Sponsored by: EMC / Isilon Storage Division

8 years agoWITH_META_MODE: Disable for 'make install' from top-level.
Bryan Drewery [Sat, 21 May 2016 01:31:54 +0000 (01:31 +0000)]
WITH_META_MODE: Disable for 'make install' from top-level.

See r298220 for more explanation.  We don't want to prevent installing
if a cookie exists for the install target.

Sponsored by: EMC / Isilon Storage Division

8 years agoWITH_META_MODE: Use META_MODE rather than .MAKE.MODE for buildkernel.
Bryan Drewery [Sat, 21 May 2016 01:31:51 +0000 (01:31 +0000)]
WITH_META_MODE: Use META_MODE rather than .MAKE.MODE for buildkernel.

This is mostly a style change so that other code does not duplicate
it.  The problem is when META_MODE needs to be disabled but it has
been overridden by .MAKE.MODE.

Sponsored by: EMC / Isilon Storage Division

8 years agoWITH_META_MODE: Fix suffix transformation rules with guessed dependencies.
Bryan Drewery [Sat, 21 May 2016 01:31:48 +0000 (01:31 +0000)]
WITH_META_MODE: Fix suffix transformation rules with guessed dependencies.

This is the same problem as r290629.  With META_MODE we do not generate
.depend files, so there is no proper dependency to lookup.  Guessed
dependencies must be used.  If this proves to be a problem then we will
have to generate and use .depend files even with META_MODE.

Sponsored by: EMC / Isilon Storage Division

8 years agoWITH_DIRDEPS_BUILD: Fix forcing user to run bootstrap-tools.
Bryan Drewery [Sat, 21 May 2016 01:31:44 +0000 (01:31 +0000)]
WITH_DIRDEPS_BUILD: Fix forcing user to run bootstrap-tools.

This is a follow-up to r299289.  If the user did not run bootstrap-tools
for this directory then just build the tool as normal.  It assumes that
TARGET == MACHINE, but that was already the case before r299289.

Sponsored by: EMC / Isilon Storage Division

8 years agoFTS: Remove stale reference to nfs4 fs which was removed in r192578.
Bryan Drewery [Sat, 21 May 2016 01:31:41 +0000 (01:31 +0000)]
FTS: Remove stale reference to nfs4 fs which was removed in r192578.

MFC after: 2 weeks

8 years agoed(1): simplify by using arc4random_buf().
Pedro F. Giffuni [Sat, 21 May 2016 00:45:42 +0000 (00:45 +0000)]
ed(1): simplify by using arc4random_buf().

Suggested by: ed

8 years agoAdd sglist functions for working with arrays of VM pages.
John Baldwin [Fri, 20 May 2016 23:28:43 +0000 (23:28 +0000)]
Add sglist functions for working with arrays of VM pages.

sglist_count_vmpages() determines the number of segments required for
a buffer described by an array of VM pages. sglist_append_vmpages()
adds the segments described by such a buffer to an sglist.  The latter
function is largely pulled from sglist_append_bio(), and
sglist_append_bio() now uses sglist_append_vmpages().

Reviewed by: kib
Sponsored by: Chelsio Communications

8 years agoMove the KTR for the update of ddp_active_id on each completion under
John Baldwin [Fri, 20 May 2016 23:08:22 +0000 (23:08 +0000)]
Move the KTR for the update of ddp_active_id on each completion under
VERBOSE_TRACES.

Sponsored by: Chelsio Communications

8 years agoelftoolchain: backwards compatability for EM_RISCV definition
Ed Maste [Fri, 20 May 2016 20:27:30 +0000 (20:27 +0000)]
elftoolchain: backwards compatability for EM_RISCV definition

It is not provided by sys/elf_common.h on older releases

Reported by: Jenkins

8 years agogas: Implement the .inst assembler directive for arm.
Pedro F. Giffuni [Fri, 20 May 2016 20:01:10 +0000 (20:01 +0000)]
gas: Implement the .inst assembler directive for arm.

We normally use the binutils from ports but on other systems this
is required for building gcc 4.9.

Obtained from: OpenBSD (CVS rev. 1.5)
MFC after: 3 weeks

8 years agoCheck for overflow and return EINVAL if detected. Backport this and
Konstantin Belousov [Fri, 20 May 2016 19:50:32 +0000 (19:50 +0000)]
Check for overflow and return EINVAL if detected.  Backport this and
r300305 to i386.

PR: 209661
Reported and reviewed by: cturt
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

8 years agoConsistently set status to -1 when completing an AIO request with an error.
John Baldwin [Fri, 20 May 2016 19:46:25 +0000 (19:46 +0000)]
Consistently set status to -1 when completing an AIO request with an error.

Sponsored by: Chelsio Communications

8 years agoLarge improvements to efi-show (though some weird problems
Warner Losh [Fri, 20 May 2016 19:38:01 +0000 (19:38 +0000)]
Large improvements to efi-show (though some weird problems
linger). We now print only printable characters for the
values and we print ascii strings as strings.

8 years agoImplement efi-set and efi-unset
Warner Losh [Fri, 20 May 2016 19:37:54 +0000 (19:37 +0000)]
Implement efi-set and efi-unset

8 years agoCleanup to use %S.
Warner Losh [Fri, 20 May 2016 19:37:46 +0000 (19:37 +0000)]
Cleanup to use %S.

8 years agoAdd the density code for LTO-7 to libmt and the mt(1) man page.
Kenneth D. Merry [Fri, 20 May 2016 19:30:52 +0000 (19:30 +0000)]
Add the density code for LTO-7 to libmt and the mt(1) man page.

The density code and bits per mm values were obtained from an
actual drive density report.

The number of tracks were obtained from an LTO-7 hardware
announcement on IBM's web site.

Sponsored by: Spectra Logic
MFC after: 3 days

8 years agoRegenerate
Bryan Drewery [Fri, 20 May 2016 19:25:57 +0000 (19:25 +0000)]
Regenerate

8 years agoAdd a WITH_LIBSOFT
Bryan Drewery [Fri, 20 May 2016 19:23:07 +0000 (19:23 +0000)]
Add a WITH_LIBSOFT

8 years agoRemove hf appending code from param.h for machine arch name.
Warner Losh [Fri, 20 May 2016 19:18:32 +0000 (19:18 +0000)]
Remove hf appending code from param.h for machine arch name.

Submitted by: ian@ andyt@

8 years agoed(1): Cleanups for the DES mode.
Pedro F. Giffuni [Fri, 20 May 2016 19:10:29 +0000 (19:10 +0000)]
ed(1): Cleanups for the DES mode.

- Use arc4random_uniform(3).
- Prevent a segmentation fault when ed receives a signal
  while being in getpass(). [1]

Obtained from: OpenBSD [1] (CVS Rev. 1.15)
MFC after: 2 weeks

8 years agoelftoolchain: backwards compatability for EM_IAMCU definition
Ed Maste [Fri, 20 May 2016 18:54:42 +0000 (18:54 +0000)]
elftoolchain: backwards compatability for EM_IAMCU definition

It is not provided by sys/elf_common.h on older stable/10.

8 years agoGCC: Add support for named initializers for anonymous structs/unions.
Pedro F. Giffuni [Fri, 20 May 2016 18:01:53 +0000 (18:01 +0000)]
GCC: Add support for named initializers for anonymous structs/unions.

Missing hunk from r300301.

Reported by: Ed Schouten
Obtained from: OpenBSD (CVS rev. 1.2)

8 years agoImplement support for RF_UNMAPPED and bus_map/unmap_resource on x86.
John Baldwin [Fri, 20 May 2016 18:00:10 +0000 (18:00 +0000)]
Implement support for RF_UNMAPPED and bus_map/unmap_resource on x86.

Add implementations of bus_map/unmap_resource to the x86 nexus driver.
Change bus_activate/deactivate_resource to honor RF_UNMAPPED and to
use bus_map/unmap_resource to create/destroy the implicit mapping when
RF_UNMAPPED is not set.

Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D5237

8 years agoAdd new bus methods for mapping resources.
John Baldwin [Fri, 20 May 2016 17:57:47 +0000 (17:57 +0000)]
Add new bus methods for mapping resources.

Add a pair of bus methods that can be used to "map" resources for direct
CPU access using bus_space(9).  bus_map_resource() creates a mapping and
bus_unmap_resource() releases a previously created mapping.  Mappings are
described by 'struct resource_map' object.  Pointers to these objects can
be passed as the first argument to the bus_space wrapper API used for bus
resources.

Drivers that wish to map all of a resource using default settings
(for example, using uncacheable memory attributes) do not need to change.
However, drivers that wish to use non-default settings can now do so
without jumping through hoops.

First, an RF_UNMAPPED flag is added to request that a resource is not
implicitly mapped with the default settings when it is activated.  This
permits other activation steps (such as enabling I/O or memory decoding
in a device's PCI command register) to be taken without creating a
mapping.  Right now the AGP drivers don't set RF_ACTIVE to avoid using
up a large amount of KVA to map the AGP aperture on 32-bit platforms.
Once RF_UNMAPPED is supported on all platforms that support AGP this
can be changed to using RF_UNMAPPED with RF_ACTIVE instead.

Second, bus_map_resource accepts an optional structure that defines
additional settings for a given mapping.

For example, a driver can now request to map only a subset of a resource
instead of the entire range.  The AGP driver could also use this to only
map the first page of the aperture (IIRC, it calls pmap_mapdev() directly
to map the first page currently).  I will also eventually change the
PCI-PCI bridge driver to request mappings of the subset of the I/O window
resource on its parent side to create mappings for child devices rather
than passing child resources directly up to nexus to be mapped.  This
also permits bridges that do address translation to request suitable
mappings from a resource on the "upper" side of the bus when mapping
resources on the "lower" side of the bus.

Another attribute that can be specified is an alternate memory attribute
for memory-mapped resources.  This can be used to request a
Write-Combining mapping of a PCI BAR in an MI fashion.  (Currently the
drivers that do this call pmap_change_attr() directly for x86 only.)

Note that this commit only adds the MI framework.  Each platform needs
to add support for handling RF_UNMAPPED and thew new
bus_map/unmap_resource methods.  Generally speaking, any drivers that
are calling rman_set_bustag() and rman_set_bushandle() need to be
updated.

Discussed on: arch
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D5237

8 years agoDrop trailing asterisks.
John Baldwin [Fri, 20 May 2016 17:41:12 +0000 (17:41 +0000)]
Drop trailing asterisks.

8 years agoCall the ICL module's handoff method even when using ICL proxy.
Edward Tomasz Napierala [Fri, 20 May 2016 17:38:51 +0000 (17:38 +0000)]
Call the ICL module's handoff method even when using ICL proxy.
The upcoming iSER code uses this.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoPull in r270240 from upstream clang trunk (by me):
Dimitry Andric [Fri, 20 May 2016 17:38:45 +0000 (17:38 +0000)]
Pull in r270240 from upstream clang trunk (by me):

  Make __FreeBSD_cc_version predefined macro configurable at build time

  The `FreeBSDTargetInfo` class has always set the `__FreeBSD_cc_version`
  predefined macro to a rather static value, calculated from the major OS
  version.

  In the FreeBSD base system, we will start incrementing the value of this
  macro whenever we make any signifant change to clang, so we need a way
  to configure the macro's value at build time.

  Use `FREEBSD_CC_VERSION` for this, which we can define in the FreeBSD
  build system using either the `-D` command line option, or an include
  file.  Stock builds will keep the earlier value.

  Differential Revision: http://reviews.llvm.org/D20037

Follow-up commits will start using the __FreeBSD_cc_version to determine
whether a bootstrap compiler has to be built during buildworld.

8 years agoMerge bmake-20160512
Simon J. Gerraty [Fri, 20 May 2016 17:35:39 +0000 (17:35 +0000)]
Merge bmake-20160512

8 years agoUpdate to ELF Tool Chain r3475
Ed Maste [Fri, 20 May 2016 17:24:34 +0000 (17:24 +0000)]
Update to ELF Tool Chain r3475

Improvements include:

 * Add support for reporting and handling a number of new constants in
   various tools, including:
    * CloudABI OSABI
    * DT_TLSDESC_*
    * i386, MIPS, SPARC and amd64 relocations

 * C++ demangler bug fixes

 * Man page updates

 * Improved input validation in several tools

This update also reduces diffs against upstream as a number of fixes
included in upstream were previously cherry-picked into FreeBSD.

Sponsored by: The FreeBSD Foundation

8 years agoImport bmake-20160512
Simon J. Gerraty [Fri, 20 May 2016 16:19:56 +0000 (16:19 +0000)]
Import bmake-20160512

Interesting changes (from ChangeLog):
o meta.c: ignore paths that match .MAKE.META.IGNORE_PATTERNS
  this is useful for gcov builds.
o propagate errors from filemon(4).
o meta.c: apply realpath() before matching against metaIgnorePaths
o allow makefile to set .MAKE.JOBS

8 years agoExtract the correct bits from the GICD_TYPER register. The interrupt count
Andrew Turner [Fri, 20 May 2016 15:43:51 +0000 (15:43 +0000)]
Extract the correct bits from the GICD_TYPER register. The interrupt count
is encoded in the bottom 5 bits.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation