Commit Graph

16624 Commits

Author SHA1 Message Date
John Baldwin
b871bfa1a2 vfork() first appeared in 3BSD which pre-dates 2.9BSD. Verified via the
copy of 3BSD on disc 1 of "The CSRG Archives".

PR:		198612
MFC after:	1 week
2015-04-06 20:40:01 +00:00
Ed Maste
5d93595789 Update reported elftoolchain version to 3179
Missed in r280932
2015-04-06 13:55:33 +00:00
Gleb Smirnoff
56d5e0967c Stop including if_var.h from userland.
Sponsored by:	Nginx, Inc.
2015-04-06 09:42:23 +00:00
Pedro F. Giffuni
3d4c8bbc51 Make strlcpy/strlcat slightly easier to read.
Bring small upstream updates.

Obtained from:	OpenBSD
2015-04-06 03:21:22 +00:00
Adrian Chadd
f6e6460dfc Add support for the MIPS74K SoC family performance counters events.
These are similar to the mips24k performance counters - some are
available on perfcnt0/3, some are available on perfcnt1/4.
However, the events aren't all the same.

* Add the events, named the same as from Linux oprofile.
* Verify they're the same as  "MIPS32(R) 74KTM Processor Core Family
  Software User's Manual"; Document Number: MD00519; Revision 01.05.
* Rename INSTRUCTIONS to something else, so it doesn't clash with
  the alias INSTRUCTIONS.  I'll try to tidy this up later; there
  are a few other aliases to add and shuffle around.

Tested:

* QCA9558 SoC (AP135 board) - MIPS74Kc core (no FPU.)
* make universe; where it didn't fail for other reasons.

TODO:

* It'd be nice to support the four performance counters
  in at least this hardware, rather than just two.

Reviewed by:	bsdimp ("looks good; don't break world".)
2015-04-05 02:57:02 +00:00
Jilles Tjoelker
d30c6f8edf fts: Don't return FTS_SLNONE if it's not a symlink (if race).
When following symlinks, fts returned FTS_SLNONE when fstatat(flag=0)
failed, but a subsequent fstatat(flag=AT_SYMLINK_NOFOLLOW) succeeded. This
incorrectly triggered if a filename existed to be read from the directory,
was deleted before the fstatat(flag=0) and created again after the
fstatat(flag=0).

Fix this by only returning FTS_SLNONE if the result from
fstatat(flag=AT_SYMLINK_NOFOLLOW) is actually a symlink. If it is not a
symlink, treat it as if fstatat(flag=0) succeeded.

PR:		196724
Reported and tested by:	pho
MFC after:	1 week
2015-04-04 20:22:12 +00:00
Ed Maste
541236cf60 libc: Eliminate duplicate copies of __vdso_gettc.c
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D2152
2015-04-02 21:18:11 +00:00
Andrew Turner
cd12a51d8d Add stub functions to build libkvm. There will be added, but we need them
now get the toolchain target building.

Differential Revision:	https://reviews.freebsd.org/D2185
Sponsored by:	The FreeBSD Foundation
2015-04-02 17:30:19 +00:00
Edward Tomasz Napierala
522196b5ed Update open(2) to make it more obvious that O_NOCTTY and O_TTY_INIT
are ignored.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-04-02 11:41:04 +00:00
Dimitry Andric
76e2c537bc Ensure the cross assembler, linker and objcopy are used for the build32
stage, just like for the regular world stage.

Reviewed by:	rodrigc, imp, bapt, emaste
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D2187
2015-04-02 06:58:17 +00:00
Konstantin Belousov
1849df3006 Correctly handle __fcntl_compat symbol for the !SYSCALL_COMPAT case.
Both .weak and .alias assembler directives only work when assembling
the file which defines the symbol.

Reported and tested by:	andrew
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-04-01 16:55:30 +00:00
Andrew Turner
f03b8244b4 Add the arm64 parts of libthread_db.
Differential Revision:	https://reviews.freebsd.org/D2184
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
2015-04-01 08:37:50 +00:00
Tycho Nightingale
ef7c2a82ed Fix "MOVS" instruction memory to MMIO emulation. Currently updates to
%rdi, %rsi, etc are inadvertently bypassed along with the check to
see if the instruction needs to be repeated per the 'rep' prefix.

Add "MOVS" instruction support for the 'MMIO to MMIO' case.

Reviewed by:	neel
2015-04-01 00:15:31 +00:00
Jilles Tjoelker
2f61288c80 wordexp: Explicitly pass along IFS.
Per Austin group issue #884, sh should not import IFS from the environment
but always set it to $' \t\n'. For wordexp(), however, it is documented and
useful for it to use IFS from the environment.

Since sh currently imports IFS from the environment, this change has no
functional effect.

MFC after:	1 week
2015-03-31 20:51:01 +00:00
Andrew Turner
f734628543 Add the fe* symbols to libm for arm64.
Sponsored by:	The FreeBSD Foundation
2015-03-31 19:07:28 +00:00
Andrew Turner
a7dfee7ab1 Add pthread_md.h for arm64.
Differential Revision:	https://reviews.freebsd.org/D2137
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
2015-03-30 19:10:09 +00:00
Ed Maste
58853f4fb9 Correct mrs_fpcr and mrs_fpsr macros in arm64 fenv.h
Submitted by:	andrew
Sponsored by:	The FreeBSD Foundation
2015-03-30 16:42:08 +00:00
Ed Maste
b4a5ecf64c compiler-rt: Build additional quad precision floating point builtins
These are needed for arm64

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D2160
2015-03-30 14:28:31 +00:00
Konstantin Belousov
b072e86d09 Make kevent(2) a cancellation point.
Note that to cancel blocked kevent(2) call, changelist must be empty,
since we cannot cancel a call which already made changes to the
process state.  And in reverse, call which only makes changes to the
kqueue state, without waiting for an event, is not cancellable.  This
makes a natural usage model to migrate kqueue loop to support
cancellation, where existing single kevent(2) call must be split into
two: first uncancellable update of kqueue, then cancellable wait for
events.

Note that this is ABI-incompatible change, but it is believed that
there is no cancel-safe code that relies on kevent(2) not being a
cancellation point.  Option to preserve the ABI would be to keep
kevent(2) as is, but add new call with flags to specify cancellation
behaviour, which only value seems to add complications.

Suggested and reviewed by:	jilles
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2015-03-29 19:14:41 +00:00
Michael Tuexen
4b2dd7af64 Add an SCTP symbol which was missed in
https://svnweb.freebsd.org/base?view=revision&revision=169622
This fixes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=197783
Thanks to Jukka Ukkonen for reporting the bug and providing a fix.

MFC after: 3 days
2015-03-28 09:08:57 +00:00
Jilles Tjoelker
73cc817ec8 setmode(): Use sysctl kern.proc.umask instead of umask() if possible.
The kern.proc.umask.<pid> sysctl allows querying the umask without
temporarily modifying it.
2015-03-26 21:58:06 +00:00
Alexander Motin
5523c82c1a Make GEOM_PART work in presence of previous withered self.
MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2015-03-26 12:17:47 +00:00
Jung-uk Kim
01ed3ca3de Remove defunct SSLv2 support from fetch(1) and fetch(3). 2015-03-25 18:56:36 +00:00
Luiz Otavio O Souza
4e8058e313 Add the missing manual page link to the recently added function. 2015-03-20 19:29:59 +00:00
Andrew Turner
8daa81674e Start to import support for the AArch64 architecture from ARM. This change
only adds support for kernel-toolchain, however it is expected further
changes to add kernel and userland support will be committed as they are
reviewed.

As our copy of binutils is too old the devel/aarch64-binutils port needs
to be installed to pull in a linker.

To build either TARGET needs to be set to arm64, or TARGET_ARCH set to
aarch64. The latter is set so uname -p will return aarch64 as existing
third party software expects this.

Differential Revision:	https://reviews.freebsd.org/D2005
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
2015-03-19 13:53:47 +00:00
Andrew Turner
667a4af397 We won't support a.out on arm64/aarch64. As such there will be no need to
support it in nlist(3).

Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
2015-03-18 13:54:53 +00:00
Bryan Drewery
215d02b78c Add LIB_CXX so that C++ libraries will use CXX to link.
This fixes C++ libraries not implicitly linking in libc++.  This is
generally not an issue because the final linking with the compiled binary
will involve CXX via PROG_CXX or other means.  It is however
inconsistent with libraries implicitly linking in libc and problematic
for trying to build libraries with '-z defs' to ensure all direct
dependencies are linked in.

libatf-c++ is currently the only consumer of this new feature.

Differential Revision:	https://reviews.freebsd.org/D2039
Reviewed by:	imp
Discussed with:	bapt
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-03-17 15:16:36 +00:00
Dimitry Andric
e0125cfdd1 Merge ^/head r279893 through r279984. 2015-03-14 13:08:00 +00:00
Dimitry Andric
25e141edd2 Pull in r231965 from upstream compiler-rt trunk (by Jörg Sonnenberger):
Refactor float to integer conversion to share the same code.
  80bit Intel/PPC long double is excluded due to lacking support
  for the abstraction. Consistently provide saturation logic.
  Extend to long double on 128bit IEEE extended platforms.

  Initial patch with test cases from GuanHong Liu.
  Reviewed by Steve Canon.

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

Pull in r232107 from upstream compiler-rt trunk (by Ed Maste):

  Use signed int implementation for __fixint

Requested by:	emaste
2015-03-14 12:40:19 +00:00
Pedro F. Giffuni
cf0f0b800c libc: plug memory leaks in edge cases for the posix1e code.
CID:	1016705
CID:	1016706
CID:	1016707

Differential Revision:	https://reviews.freebsd.org/D2023
2015-03-13 18:42:43 +00:00
John Baldwin
ad06e987b1 The System V ABI for amd64 allows functions to use space in a 128 byte
redzone below the stack pointer for scratch space and requires
interrupt and signal frames to avoid overwriting it. However, EFI uses
the Windows ABI which does not support this. As a result, interrupt
handlers in EFI push their interrupt frames directly on top of the
stack pointer. If the compiler used the red zone in a function in the
EFI loader, then a device interrupt that occurred while that function
was running could trash its local variables.  In practice this happens
fairly reliable when using gzipfs as an interrupt during decompression
can trash the local variables in the inflate_table() function
resulting in corrupted output or hangs.

Fix this by disabling the redzone for amd64 EFI binaries. This
requires building not only the loader but any libraries used by the
loader without redzone support.

Thanks to Jilles for pointing me at the redzone once I found the stack
corruption.

Differential Revision:	https://reviews.freebsd.org/D2054
Reviewed by:	imp
MFC after:	2 weeks
Sponsored by:	Cisco Systems, Inc.
2015-03-13 09:38:16 +00:00
Stanislav Sedov
0faaddb8db Fix debug symbols loading in libproc: 0 is a valid file descriptor.
Reported by:	Chris Torek <chris.torek@gmail.com>
2015-03-13 04:26:48 +00:00
John Baldwin
498046a190 Spin the twiddle in dosfs to give visual feedback for disk I/O on
FAT filesystems as is done for other filesystems in the loader.

MFC after:	1 week
2015-03-12 17:10:04 +00:00
Dimitry Andric
a857c4c833 Merge ^/head r279759 through r279892. 2015-03-11 19:04:01 +00:00
Michael Tuexen
59b6d5be4e Add a SCTP socket option to limit the cwnd for each path.
MFC after: 1 month
2015-03-10 19:49:25 +00:00
Steve Kargl
186f620727 According to POSIX.1-2008, the Bessel functions of second kind
should raise a divide-by-zero floating point exception for x = +-0
and an invalid floating point exception for x < 0 including x = -Inf.
Update the code to raise the exception and update the documentation
with hopefully better description of the behavior.

Reviewed by:	bde (code only)
2015-03-10 17:10:54 +00:00
Ryan Stone
bc0ad9a99d Fix Ivy Bridge+ MEM_UOPS_RETIRED counters
The MEM_UOPS_RETIRED actually work the same way as the Sandy
Bridge counters, but the counters were documented in a different
way and that seemed to cause the Ivy Bridge counters to be
implemented incorrectly.  Use the same counter definitions as
Sandy Bridge.  While I'm here, rename the counters to match
what's documented in the datasheet.

Differential Revision:	https://reviews.freebsd.org/D1590
MFC after:	1 month
Sponsored by:	Sandvine Inc.
2015-03-10 01:24:08 +00:00
Ryan Stone
ae9975db34 Use the correct event table for Haswell Xeon events
Differential Revision:	https://reviews.freebsd.org/D1588
MFC after:	1 month
Sponsored by:	Sandvine Inc.
2015-03-10 01:23:55 +00:00
Ryan Stone
9e60f3acd2 Fix Sandy Bridge+ hwpmc branch counters
On Sandy Bridge and later, to count branch-related events you
have to or together a mask indicating the type of branch
instruction to count (e.g. direct jump, branch, etc) and a bits
indicating whether to count taken and not-taken branches.  The
current counter definitions where defining this bits individually,
so the counters never worked and always just counted 0.

Fix the counter definitions to instead contain the proper
combination of masks.  Also update the man pages to reflect the
new counters.

Differential Revision:	https://reviews.freebsd.org/D1587
MFC after:	1 month
Sponsored by:	Sandvine Inc.
2015-03-10 01:23:47 +00:00
Ryan Stone
f1ec0939ec Add manpage for Haswell Xeon pmc implementation
Differential Revision:	https://reviews.freebsd.org/D1584
Reviewed by:	gnn
MFC After:	1 month
Sponsored by:	Sandvine Inc
2015-03-10 01:22:43 +00:00
Jung-uk Kim
be070eb896 Fix a typo in comment and explain the reason. 2015-03-09 20:26:42 +00:00
Nathan Whitehorn
78f38c60bc Fix loader on PowerPC following r279784. It turns out that, due to .PATH
confusion, the _setjmp.S in libstand was never being used and was instead
being shadowed by the libc version. Since the libc version now uses FPRs,
it caused loader to crash.
2015-03-09 02:19:44 +00:00
Luiz Otavio O Souza
5126a47396 Fix contraction and unnecessary commas in function arguments.
Found with mandoc and igor.
2015-03-08 21:17:56 +00:00
Nathan Whitehorn
1ee3532451 Save and restore non-volatile floating-point registers during longjmp().
This should also save and restore non-volatile Altivec registers, but that
needs to wait on solving two problems:
1. Adding the nonvolatile vector registers means we need 5 more than _JBLEN
   entries in jmp_buf on 32-bit targets (64-bit is OK).
2. Need to figure out how to determine if saving/restoring vector regs
   is supported on the current CPU from userland.

MFC after:	1 month
2015-03-08 19:37:08 +00:00
Luiz Otavio O Souza
d752f0f69d Add a new ioctl to allow the setting of GPIO pin names.
When a gpiobus child is added, use its name to identify the mapped pin
names.

Make the respective changes to libgpio.

Add a new '-n' flag to gpioctl(8) to set the pin name.

Differential Revision:	https://reviews.freebsd.org/D2002
Reviewed by:	rpaulo
Requested by:	many
2015-03-08 00:47:50 +00:00
Dimitry Andric
bf5d6cf0a9 Fix lib/libnv tests compilation with -std=c++11, by adding appropriate
casts for NULL to invocations of the ATF_REQUIER_EQ() macro.

Reviewed by:	rstone, jmmv
Differential Revision: https://reviews.freebsd.org/D2027
2015-03-08 00:30:52 +00:00
Dimitry Andric
6404f697a0 Merging ^/head r279596 through r279758. 2015-03-07 23:01:27 +00:00
John-Mark Gurney
32d52c275d forgot to bump date, and replace contraction (igor)... 2015-03-07 03:48:32 +00:00
John-Mark Gurney
4a46673183 make things a bit more clear.. we worked together on language..
Submitted by:	Justin Cormack
2015-03-06 23:17:18 +00:00
Pedro F. Giffuni
b3d078e666 compat_passwd(): yet another uninitialized access to stayopen.
CID:	1018731
2015-03-06 22:22:57 +00:00
Pedro F. Giffuni
2eaea119b8 qsort(3): small style(9) cleanups.
Basically spaces vs. tabs.
No functional change.
2015-03-05 17:17:11 +00:00
Pedro F. Giffuni
9382fabf1f qsort(3): enhance to handle 32-bit aligned data on 64-bit systems
Implement a small enhancement to the original qsort implementation:
If the data is 32 bit aligned we can side-step the long type
version and use int instead.

The change brings a modest but significant improvement in
32 bit workloads.

Relnotes:	yes

PR:		135718
Taken from:	ache
2015-03-05 17:00:39 +00:00
Dimitry Andric
ca65be80fd Merge ^/head r279313 through r279595. 2015-03-04 19:47:33 +00:00
Kenneth D. Merry
5090c893b7 Add density code for DAT-72, and notes on DAT-160.
As it turns out, the density code for DAT-160 (0x48) is the same
as for SDLT220.  Since the SDLT values are already in the table,
we will leave them in place.

Thanks to Harald Schmalzbauer for confirming the DAT-72 density code.

lib/libmt/mtlib.c:
	Add DAT-72 density code, and commented out DAT-160 density
	code.  Explain why DAT-160 is commented out.  Add notes
	explaining where the bpi values for these formats came from.

usr.bin/mt/mt.1:
	Add DAT-72 density code, and add a note explaining that
	the SDLTTapeI(110) density code (0x48) is the same as
	DAT-160.

Sponsored by:	Spectra Logic
MFC after:	3 weeks
2015-03-03 22:49:07 +00:00
Baptiste Daroussin
a094e084f4 Lower warnings to please gcc 4.2 2015-03-03 07:51:36 +00:00
Baptiste Daroussin
8e3b1ab2b5 Update libucl to git version 8d3b186 2015-03-02 21:41:09 +00:00
Steve Kargl
a737ef56ab Give compilers a stronger hint to inline the functions
pzero[f], qzero[f], pone[f], and qone[f].  While here
fix the function declarations in accordance with style(9).
2015-03-01 20:32:47 +00:00
Steve Kargl
8192c85cb3 When j0() and j1() were converted to j0f() and j1f(), the threshold
values for the different invervals were not converted correctly.
Adjust the threshold values to values, which should agree with the
comments.

Reported by:	cognet (j1f only)
Discussed with: pfg, bde
Reviewed by:	bde
2015-03-01 20:26:03 +00:00
Ryan Stone
081abde45c Fix build of nv_tests.cc
nv_tests.cc managed to get two copies of several functions due to me
applying a patch in an unclean working tree.  My kingdom for an
"svn clean" command.

MFC after:	1 month
X-MFC-With:	r279424
2015-03-01 00:37:23 +00:00
Ryan Stone
4d6a976e37 Move libnv into the kernel and hook it into the kernel build
Differential Revision:		https://reviews.freebsd.org/D1883
Reviewed by:			jfv
MFC after:			1 month
Sponsored by:			Sandvine Inc.
2015-03-01 00:34:27 +00:00
Ryan Stone
814f9a1824 Add macros to make code compile in kernel
Make it possible to compile libnv in the kernel.  Mostly this
involves wrapping functions that have a different signature in
the kernel and in userland (e.g. malloc()) in a macro that will
conditionally expand to the right API depending on whether the
code is being compiled for the kernel or not.

I have also #ifdef'ed out all of file descriptor-handling code,
as well as the unsafe varargs functions.

Differential Revision:		https://reviews.freebsd.org/D1882
Reviewed by:			jfv
MFC after:			1 month
Sponsored by:			Sandvine Inc
2015-03-01 00:22:53 +00:00
Ryan Stone
19a4afb3e6 Prevent creation of an invalid nvlist
If an nvlist is set as a child of another nvlist with
nvlist_move_nvlist then fail the operation and set the parent
nvlist to the error state.

Differential Revision:		https://reviews.freebsd.org/D1880
Reviewers:			jfv
MFC after:			1 month
Sponsored by:			Sandvine Inc
2015-03-01 00:22:38 +00:00
Ryan Stone
ed007c94ba Don't allocate memory for operations that do not insert
Almost every operation performed on an nvlist was allocating a
new string to hold the key name.  The nvlist_exists* family of
functions would always return false if they failed to allocate
the string.  The rest of the functions would outright abort().
Fix the non-varargs variants of the functions to perform the
requested operations directly and the varargs versions to
allocate the string and call into the non-varargs versions.
The varargs versions are still broken and really can't be fixed,
so we might consider axing them entirely.  However, now the non-
varargs functions are always safe to call.

Differential Revision:		https://reviews.freebsd.org/D1879
Reviewed by:			pjd, jfv
MFC after:			1 month
Sponsored by:			Sandvine Inc.
2015-03-01 00:22:31 +00:00
Ryan Stone
a87e516267 Add function to force an nvlist into the error state
Add an nvlist_set_error() function that can be used to force an
nvlist into the error state.  This is useful both for writing
tests and for writing APIs that use nvlists internally.

Differential Revision:		https://reviews.freebsd.org/D1878
Reviewed by:			pjd, jfv
MFC After:			1 month
Sponsored by:			Sandvine Inc.
2015-03-01 00:22:23 +00:00
Ryan Stone
2dfd9979d8 Extend the unit test to fix the bug caught in r277925
Differential Revision:		https://reviews.freebsd.org/D1888
MFC After:			1 month
Sponsored by:			Sandvine Inc.
2015-03-01 00:22:09 +00:00
Ryan Stone
7e15db629c Add tests for dnvlist_take_*
Differential Revision:		https://reviews.freebsd.org/D1876
Reviewed by:			jfv, pjd
MFC after:			1 month
Sponsored by:			Sandvine Inc.
2015-03-01 00:22:03 +00:00
Ryan Stone
3d1b7ccbd3 Add tests for dnv_get_*
Differential Revision:		https://reviews.freebsd.org/D1875
Reviewed by:			jfv, pjd
MFC after:			1 month
Sponsored by:			Sandvine Inc.
2015-03-01 00:21:56 +00:00
Ryan Stone
339bcfc7f8 Add tests for nvlist_free* functions
Differential Revision:		https://reviews.freebsd.org/D1874
Reviewed by:			jfv, pjd
MFC after:			1 month
Sponsored by:			Sandvine Inc.
2015-03-01 00:21:50 +00:00
Ryan Stone
fad0a26408 Add tests for nvlist_take_*
Differential Revision:		https://reviews.freebsd.org/D1873
Reviewed by:			jfv, pjd
MFC after:			1 month
Sponsored by:			Sandvine Inc.
2015-03-01 00:21:43 +00:00
Ryan Stone
71637d76b1 Add test cases for nvlist_move_*
Differential Revision:		https://reviews.freebsd.org/D1872
Reviewed by:			jfv, pjd
MFC after:			1 month
Sponsored by:			Sandvine Inc.
2015-03-01 00:21:37 +00:00
Ryan Stone
6c721f8217 Add tests for nvlist_pack/unpack
Differential Revision:		https://reviews.freebsd.org/D1871
Reviewed by:			jfv, pjd
MFC after:			1 month
Sponsored by:			Sandvine Inc.
2015-03-01 00:21:30 +00:00
Ryan Stone
6e623ffd77 Add tests for nvlist_clone
Differential Revision:		https://reviews.freebsd.org/D1870
Reviewed by:			pjd, jfv
MFC after:			1 month
Sponsored by:			Sandvine Inc
2015-03-01 00:21:24 +00:00
Ryan Stone
3075c896f0 Tests of basic nvlist add functions
Differential Revision:		https://reviews.freebsd.org/D1869
Reviewed by:			jfv, pjd
MFC after:			1 month
Sponsored by:			Sandvine Inc.
2015-03-01 00:20:57 +00:00
Ryan Stone
c58da4beb1 Revert r279422. My "apply patch and commit" script wasn't adding
new files properly.

Pointy hat to: rstone
2015-03-01 00:05:45 +00:00
Ryan Stone
65d1148aa6 Tests of basic nvlist add functions
Differential Revision:		https://reviews.freebsd.org/D1869
Reviewed by:			jfv, pjd
MFC after:			1 month
Sponsored by:			Sandvine Inc.
2015-03-01 00:01:44 +00:00
Ryan Stone
da8c9a4fb0 Make libnv headers includable from C++
Differential Revision:		https://reviews.freebsd.org/D1868
Reviewed by:			jfv, pjd
MFC after:			1 month
Sponsored by:			Sandvine Inc.
2015-03-01 00:01:36 +00:00
Alexander Kabaev
3956b1013e Avoid lookup of CODESET aliases using uninitialized path
We do not use iconv.alias file, so avoid using the vestiges
of the code that do.

Differential Revision:	https://reviews.freebsd.org/D1729
Reviewed by: emaste
MFC after: 2 weeks
2015-02-28 20:30:25 +00:00
Jilles Tjoelker
c317cb51b2 nice(): Put back old return value, keeping [EPERM] error.
Commit r279154 changed the API and ABI significantly, and {NZERO} is still
wrong.

Also, preserve errno on success instead of setting it to 0.

PR:		189821
Reported by:	bde
Relnotes:	yes
2015-02-28 18:22:10 +00:00
Dimitry Andric
4104449570 Update generated include/llvm/Support/DataTypes.h. 2015-02-28 00:31:01 +00:00
Konstantin Belousov
eb75dcc07b Fix typo. Note that this is mostly innocent, since libthr no longer
interposes the symbol.

Noted by:	rpaulo
MFC after:	3 days
2015-02-27 19:23:01 +00:00
Pedro F. Giffuni
726b99f9f9 eui64_line(): plug memory leak.
CID:		978412
Reviewed by:	brooks, delphij
CodeReview:	https://reviews.freebsd.org/D1976
2015-02-27 18:13:06 +00:00
Kenneth D. Merry
999efd901b Remove an obsolete comment in devstat(3) about the accuracy of the
milliseconds per transaction (DSM_MS_PER_TRANSACTION) calculation.

The comment was accurate many years ago when the kernel didn't
record I/O times on a per-I/O basis, but now that we do collect
that information in most areas, it isn't correct.

The milliseconds per transaction values are correct, assuming the
I/O duration has been recorded.

Sponsored by:	Spectra Logic
MFC after:	3 days
2015-02-27 02:44:12 +00:00
Pedro F. Giffuni
7c498a0950 Hint out check for unsigned negative values.
On FreeBSD socklen_t is unsigned so the check negative len
in inet6_opt_append() is redundant and likely to be optimized
away by the compiler.

On other operating systems this is not necessarily so, and
in the future we may want to sign it so leave the check in
but place it in a secondary position as a subtle indication
that the bogus check is intentional.

Discussed with:	rpaulo

CID:	1017783
2015-02-27 01:59:29 +00:00
Dimitry Andric
09de9530e4 Minor updates to llvm's pregenerated config headers. 2015-02-26 22:46:01 +00:00
Konstantin Belousov
85e7eba604 Use pthread_mutex_trylock(3) to implement mtx_trylock(3).
Noted and tested by:	Vineela <vineela_17@yahoo.com>
PR:	198050
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-02-26 16:39:57 +00:00
Konstantin Belousov
3b2cc6d44e Check that the pointer to the thread return value is not NULL before
dereferencing. NULL is allowed by C11 and must be handled.

Reported and tested by:	Vineela <vineela_17@yahoo.com>
PR:	198038
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-02-26 09:42:03 +00:00
Dimitry Andric
0d56a8cba1 Merge ^/head r279163 through r279308. 2015-02-26 07:26:56 +00:00
Dimitry Andric
cef93a3d52 Merge llvm 3.6.0 final from ^/vendor/llvm/dist, merge clang 3.6.0 final
from ^/vendor/clang/dist, and resolve conflicts.
2015-02-25 18:50:24 +00:00
Dimitry Andric
624e91b063 Vendor import of clang RELEASE_360/final tag r230434 (effectively, 3.6.0 release):
https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_360/final@230434
2015-02-25 18:26:53 +00:00
Dimitry Andric
b6bcb9a905 Vendor import of llvm RELEASE_360/final tag r230434 (effectively, 3.6.0 release):
https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_360/final@230434
2015-02-25 18:25:34 +00:00
Konstantin Belousov
3e6d2e9b4e Propagate errors from _thr_umutex_unlock2 through mutex_unlock_common.
Errors from _thr_umutex_unlock2 should "never happen" in normal
circumstances.  If they do, however, return them to the application
so it can fail early and loudly.  Hiding the errors will only delay
the inevitable failure, making it harder to find and diagnose.

Submitted by:	Eric van Gyzen <eric_van_gyzen@dell.com>
Obtained from:	Dell Inc.
PR:	198914
MFC after:	1 week
2015-02-25 16:18:26 +00:00
Colin Percival
eb51316b50 Adjust wording slightly to emphasize that random(3) should not be used for
any applications which need unpredictable random numbers, not merely those
which are cryptographic in nature.

If you work for a lottery and you're using random(3) to select the winning
numbers, please let me know.
2015-02-25 07:49:15 +00:00
Kenneth D. Merry
7b7c7a0533 Fix several problems found by Coverity.
lib/libmt/mtlib.c:
	In mt_start_element(), make sure we don't overflow the
	cur_sb array.  CID 1271325

usr.bin/mt/mt.c:
	In main(), bzero the mt_com structure so that we aren't
	using any uninitialized stack variables.  CID 1271319

	In mt_param(), only allow one -s and one -p argument.  This
	will prevent a memory leak caused by overwriting the
	param_name and/or param_value variables.  CID 1271320 and
	CID 1271322

	To make things simpler in mt_param(), make sure there
	there is only one exit path for the function.  Make sure
	the arguments are explicitly freed.

Sponsored by:	Spectra Logic
Pointed out by:	emaste
MFC after:	1 month
2015-02-25 04:30:23 +00:00
Pedro F. Giffuni
d300dc2302 msun: drop unnecessary checks (part 2).
Drop an unnecessary check in some calculations. The check
would have Coverity falsely conclude that a variable could
be left undefined.
2015-02-24 16:45:16 +00:00
Kenneth D. Merry
43518607b2 Significant upgrades to sa(4) and mt(1).
The primary focus of these changes is to modernize FreeBSD's
tape infrastructure so that we can take advantage of some of the
features of modern tape drives and allow support for LTFS.

Significant changes and new features include:

 o sa(4) driver status and parameter information is now exported via an
   XML structure.  This will allow for changes and improvements later
   on that will not break userland applications.  The old MTIOCGET
   status ioctl remains, so applications using the existing interface
   will not break.

 o 'mt status' now reports drive-reported tape position information
   as well as the previously available calculated tape position
   information.  These numbers will be different at times, because
   the drive-reported block numbers are relative to BOP (Beginning
   of Partition), but the block numbers calculated previously via
   sa(4) (and still provided) are relative to the last filemark.
   Both numbers are now provided.  'mt status' now also shows the
   drive INQUIRY information, serial number and any position flags
   (BOP, EOT, etc.) provided with the tape position information.
   'mt status -v' adds information on the maximum possible I/O size,
   and the underlying values used to calculate it.

 o The extra sa(4) /dev entries (/dev/saN.[0-3]) have been removed.

   The extra devices were originally added as place holders for
   density-specific device nodes.  Some OSes (NetBSD, NetApp's OnTap
   and Solaris) have had device nodes that, when you write to them,
   will automatically select a given density for particular tape drives.

   This is a convenient way of switching densities, but it was never
   implemented in FreeBSD.  Only the device nodes were there, and that
   sometimes confused users.

   For modern tape devices, the density is generally not selectable
   (e.g. with LTO) or defaults to the highest availble density when
   the tape is rewritten from BOT (e.g. TS11X0).  So, for most users,
   density selection won't be necessary.  If they do need to select
   the density, it is easy enough to use 'mt density' to change it.

 o Protection information is now supported.  This is either a
   Reed-Solomon CRC or CRC32 that is included at the end of each block
   read and written.  On write, the tape drive verifies the CRC, and
   on read, the tape drive provides a CRC for the userland application
   to verify.

 o New, extensible tape driver parameter get/set interface.

 o Density reporting information.  For drives that support it,
   'mt getdensity' will show detailed information on what formats the
   tape drive supports, and what formats the tape drive supports.

 o Some mt(1) functionality moved into a new mt(3) library so that
   external applications can reuse the code.

 o The new mt(3) library includes helper routines to aid in parsing
   the XML output of the sa(4) driver, and build a tree of driver
   metadata.

 o Support for the MTLOAD (load a tape in the drive) and MTWEOFI
   (write filemark immediate) ioctls needed by IBM's LTFS
   implementation.

 o Improve device departure behavior for the sa(4) driver.  The previous
   implementation led to hangs when the device was open.

 o This has been tested on the following types of drives:
	IBM TS1150
	IBM TS1140
	IBM LTO-6
	IBM LTO-5
	HP LTO-2
	Seagate DDS-4
	Quantum DLT-4000
	Exabyte 8505
	Sony DDS-2

contrib/groff/tmac/doc-syms,
share/mk/bsd.libnames.mk,
lib/Makefile,
	Add libmt.

lib/libmt/Makefile,
lib/libmt/mt.3,
lib/libmt/mtlib.c,
lib/libmt/mtlib.h,
	New mt(3) library that contains functions moved from mt(1) and
	new functions needed to interact with the updated sa(4) driver.

	This includes XML parser helper functions that application writers
	can use when writing code to query tape parameters.

rescue/rescue/Makefile:
	Add -lmt to CRUNCH_LIBS.

src/share/man/man4/mtio.4
	Clarify this man page a bit, and since it contains what is
	essentially the mtio.h header file, add new ioctls and structure
	definitions from mtio.h.

src/share/man/man4/sa.4
	Update BUGS and maintainer section.

sys/cam/scsi/scsi_all.c,
sys/cam/scsi/scsi_all.h:
	Add SCSI SECURITY PROTOCOL IN/OUT CDB definitions and CDB building
	functions.

sys/cam/scsi/scsi_sa.c
sys/cam/scsi/scsi_sa.h
	Many tape driver changes, largely outlined above.

	Increase the sa(4) driver read/write timeout from 4 to 32
	minutes.  This is based on the recommended values for IBM LTO
	5/6 drives.  This may also avoid timeouts for other tape
	hardware that can take a long time to do retries and error
	recovery.  Longer term, a better way to handle this is to ask
	the drive for recommended timeout values using the REPORT
	SUPPORTED OPCODES command.  Modern IBM and Oracle tape drives
	at least support that command, and it would allow for more
	accurate timeout values.

	Add XML status generation.  This is done with a series of
	macros to eliminate as much duplicate code as possible.  The
	new XML-based status values are reported through the new
	MTIOCEXTGET ioctl.

	Add XML driver parameter reporting, using the new MTIOCPARAMGET
	ioctl.

	Add a new driver parameter setting interface, using the new
	MTIOCPARAMSET and MTIOCSETLIST ioctls.

	Add a new MTIOCRBLIM ioctl to get block limits information.

	Add CCB/CDB building routines scsi_locate_16, scsi_locate_10,
	and scsi_read_position_10().

	scsi_locate_10 implements the LOCATE command, as does the
	existing scsi_set_position() command.  It just supports
	additional arguments and features.  If/when we figure out a
	good way to provide backward compatibility for older
	applications using the old function API, we can just revamp
	scsi_set_position().  The same goes for
	scsi_read_position_10() and the existing scsi_read_position()
	function.

	Revamp sasetpos() to take the new mtlocate structure as an
	argument.  It now will use either scsi_locate_10() or
	scsi_locate_16(), depending upon the arguments the user
	supplies.  As before, once we change position we don't have a
	clear idea of what the current logical position of the tape
	drive is.

	For tape drives that support long form position data, we
	read the current position and store that for later reporting
	after changing the position.  This should help applications
	like Bacula speed tape access under FreeBSD once they are
	modified to support the new ioctls.

	Add a new quirk, SA_QUIRK_NO_LONG_POS, that is set for all
	drives that report SCSI-2 or older, as well as drives that
	report an Illegal Request type error for READ POSITION with
	the long format.  So we should automatically detect drives
	that don't support the long form and stop asking for it after
	an initial try.

	Add a partition number to the sa(4) softc.

	Improve device departure handling. The previous implementation
	led to hangs when the device was open.

	If an application had the sa(4) driver open, and attempted to
	close it after it went away, the cam_periph_release() call in
	saclose() would cause the periph to get destroyed because that
	was the last reference to it.  Because destroy_dev() was
	called from the sa(4) driver's cleanup routine (sacleanup()),
	and would block waiting for the close to happen, a deadlock
	would result.

	So instead of calling destroy_dev() from the cleanup routine,
	call destroy_dev_sched_cb() from saoninvalidate() and wait for
	the callback.

	Acquire a reference for devfs in saregister(), and release it
	in the new sadevgonecb() routine when all devfs devices for
	the particular sa(4) driver instance are gone.

	Add a new function, sasetupdev(), to centralize setting
	per-instance devfs device parameters instead of repeating the
	code in saregister().

	Add an open count to the softc, so we know how many
	peripheral driver references are a result of open
       	sessions.

	Add the D_TRACKCLOSE flag to the cdevsw flags so
	that we get a 1:1 mapping of open to close calls
	instead of a N:1 mapping.

	This should be a no-op for everything except the
	control device, since we don't allow more than one
	open on non-control devices.

	However, since we do allow multiple opens on the
	control device, the combination of the open count
	and the D_TRACKCLOSE flag should result in an
	accurate peripheral driver reference count, and an
	accurate open count.

	The accurate open count allows us to release all
	peripheral driver references that are the result
	of open contexts once we get the callback from devfs.

sys/sys/mtio.h:
	Add a number of new mt(4) ioctls and the requisite data
	structures.  None of the existing interfaces been removed
	or changed.

	This includes definitions for the following new ioctls:

	MTIOCRBLIM      /* get block limits */
	MTIOCEXTLOCATE	/* seek to position */
	MTIOCEXTGET     /* get tape status */
	MTIOCPARAMGET	/* get tape params */
	MTIOCPARAMSET	/* set tape params */
	MTIOCSETLIST	/* set N params */

usr.bin/mt/Makefile:
	mt(1) now depends on libmt, libsbuf and libbsdxml.

usr.bin/mt/mt.1:
	Document new mt(1) features and subcommands.

usr.bin/mt/mt.c:
	Implement support for mt(1) subcommands that need to
	use getopt(3) for their arguments.

	Implement a new 'mt status' command to replace the old
	'mt status' command.  The old status command has been
	renamed 'ostatus'.

	The new status function uses the MTIOCEXTGET ioctl, and
	therefore parses the XML data to determine drive status.
	The -x argument to 'mt status' allows the user to dump out
	the raw XML reported by the kernel.

	The new status display is mostly the same as the old status
	display, except that it doesn't print the redundant density
	mode information, and it does print the current partition
	number and position flags.

	Add a new command, 'mt locate', that will supersede the
	old 'mt setspos' and 'mt sethpos' commands.  'mt locate'
	implements all of the functionality of the MTIOCEXTLOCATE
	ioctl, and allows the user to change the logical position
	of the tape drive in a number of ways.  (Partition,
	block number, file number, set mark number, end of data.)
	The immediate bit and the explicit address bits are
	implemented, but not documented in the man page.

	Add a new 'mt weofi' command to use the new MTWEOFI ioctl.
	This allows the user to ask the drive to write a filemark
	without waiting around for the operation to complete.

	Add a new 'mt getdensity' command that gets the XML-based
	tape drive density report from the sa(4) driver and displays
	it.  This uses the SCSI REPORT DENSITY SUPPORT command
	to get comprehensive information from the tape drive about
	what formats it is able to read and write.

	Add a new 'mt protect' command that allows getting and setting
	tape drive protection information.  The protection information
	is a CRC tacked on to the end of every read/write from and to
	the tape drive.

Sponsored by:	Spectra Logic
MFC after:	1 month
2015-02-23 21:59:30 +00:00
Dimitry Andric
7ff616029d Update compiler-rt to trunk r228651. This enables using Address
Sanitizer and Undefined Behavior Sanitizer with clang 3.6.0.
2015-02-22 22:31:36 +00:00
Pedro F. Giffuni
e382e86bb4 setmode(3): Make sure that setmode sets errno on failure.
Our man page already documented this partially but now
we have some consistent behavior.

PR:		136669
Obtained from:	NetBSD (CVS rev. 1.31, 1.33)
Relnotes:	yes
MFC after:	3 weeks
2015-02-22 20:16:44 +00:00
Dimitry Andric
9b2a0d91b8 Merge ^/head r279023 through r279162. 2015-02-22 16:04:37 +00:00
Jilles Tjoelker
e220ce08ef nice(): Correct return value and [EPERM] error.
PR:		189821
Obtained from:	NetBSD
Relnotes:	yes
2015-02-22 13:36:44 +00:00
Pedro F. Giffuni
8617260a03 msun: drop unnecessary checks.
Drop an unnecessary check in some calculations. The check
would have Coverity falsely conclude that variables could
be left undefined.

Discussed with:	kargl, bde
Reviewed by:	bde
2015-02-22 01:15:09 +00:00
Pedro F. Giffuni
cc3a001f1c Prevent NULL pointer de-reference.
As a follow up to r279090, if dp hasn't been defined, we
shouldn't attempt to do an optimization here.
2015-02-21 15:02:27 +00:00
Pedro F. Giffuni
d58abbfe0f regex(3): Fix uninitialized pointer values.
CID:	405582	(also clang static checker)
CID:	1018724
2015-02-20 21:21:38 +00:00
Pedro F. Giffuni
0b7361b3e3 tab vs spaces. 2015-02-20 20:27:53 +00:00
Pedro F. Giffuni
a9a4a706eb dbm_delete(3) correct man page to match current behaviour.
"The dbm_store() and dbm_delete() functions shall return 0 when they
succeed and a negative value when they fail."

Reference:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/dbm_clearerr.html

PR:		42422
Suggested by:	delphij
MFC after:	3 days
2015-02-20 01:31:10 +00:00
Pedro F. Giffuni
a69a20fa13 Fix small memleaks in nis_passwd() and nis_group().
These only occur upon error.

Code Review:	https://reviews.freebsd.org/D1849
Reviewed by:	delphij

CID:	1016715
CID:	1016717
2015-02-20 01:02:32 +00:00
Dimitry Andric
b09980d164 Merge llvm 3.6.0rc4 from ^/vendor/llvm/dist, merge clang 3.6.0rc4 from
^/vendor/clang/dist, resolve conflicts, and update patches.
2015-02-19 22:20:19 +00:00
Dimitry Andric
0d36d957d3 Merging ^/head r278916 through r279022. 2015-02-19 21:10:01 +00:00
Dimitry Andric
bda3d40718 Vendor import of clang RELEASE_360/rc4 tag r229772 (effectively, 3.6.0 RC4):
https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_360/rc4@229772
2015-02-19 20:57:58 +00:00
Dimitry Andric
8af9f2019d Vendor import of llvm RELEASE_360/rc4 tag r229772 (effectively, 3.6.0 RC4):
https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_360/rc4@229772
2015-02-19 20:55:17 +00:00
John-Mark Gurney
b759b8aa44 fix spelling, add comma and remove BUGS section.. it provided no useful
information, and is not really bugs, but limitations for other reasons...
2015-02-19 01:51:17 +00:00
Pedro F. Giffuni
2b1474fdde libc: clean some set-but-not-used errors.
These were found by gcc 5.0 on Dragonfly BSD, however I
made no attempt to silence the false positives.

Obtained from:	DragonFly (cf515c3a6f3a8964ad592e524442bc628f8ed63b)
2015-02-18 03:33:17 +00:00
Dimitry Andric
714e3c812d Merge ^/head r278756 through r278915. 2015-02-17 19:53:41 +00:00
Pedro F. Giffuni
d2f783303b ulimit(3): simplify.
rlim_t is at least as large as long, so we don't need the
extra variable to keep the intermediate step. We don't
need the volatile either.

The code was tested on i386 and amd64.

Suggested by:	bde
X-MFC with:	r278803
2015-02-17 16:01:00 +00:00
Ed Maste
71a0c925ce Update elftoolchain to upstream revision 3163
Most of our changes have now been committed upstream, so this change is
largely bookkeeping.

Sponsored by:	The FreeBSD Foundation
2015-02-17 15:19:58 +00:00
Jilles Tjoelker
d6b3ef634c compress,gzip,xz: Preserve timestamps with nanosecond precision. 2015-02-17 13:12:54 +00:00
Konstantin Belousov
5aed3effa4 Restore the extern qualifier on __cleanup.
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2015-02-17 08:54:03 +00:00
Marius Strobl
aed116911d Unbreak sparc64 after r276630 by calling __sparc_sigtramp_setup signal
trampoline as part of the MD __sys_sigaction again.

Submitted by:	kib (initial versions)
MFC after:	3 days
2015-02-16 22:13:03 +00:00
Pedro F. Giffuni
46bf2f5317 rexec(3): prevent uninitialized access to "port" variable.
CID:	1018716 (and clang static checker)
2015-02-16 21:35:29 +00:00
Pedro F. Giffuni
78a452c36e Replace strcpy() with strlcpy()
The risk of an overrun here is very low but check the
length, JIC.

CID:	1019039
2015-02-15 21:11:07 +00:00
Pedro F. Giffuni
1a4161a15d Reverse one of the initializations from r278804.
It does no harm but this is not needed after the
correction in r278805 and I prefer to keep this
code very similar to it's original state.
2015-02-15 21:03:49 +00:00
Pedro F. Giffuni
b78ceb0a58 Mismatch in r278804. 2015-02-15 18:02:05 +00:00
Pedro F. Giffuni
09cc2762fa More tidy-ups on uninitialized scalar variable
As a followup to r278363, there is one more case where
stayopen can be accessed uninitialized, but even after
swapping arguments, access is possible in some other
cases so prevent it completely by initializing stayopen.

CID:	1018729
CID:	1018732
2015-02-15 16:50:21 +00:00
Pedro F. Giffuni
e291429c5b ulimit(3): Fix broken check.
The existing implementation had a broken comparison that could
overflow and return confusing values.  Replace this with a check
that avoids the overflow before it happens.

Consistently return a maximum value also on the case of negative
arguments since negative is considered an overflow and means
infinity for our current setrlimit().

New revamped version is credited to Bruce Evans.

CID:		1199295
MFC after:	1 week
2015-02-15 14:31:50 +00:00
Tijl Coosemans
dac0a53840 The ld(1) flag is -Bsymbolic not -Wsymbolic. 2015-02-14 15:14:41 +00:00
Dimitry Andric
44f7b0dcc5 Merge llvm 3.6.0rc3 from ^/vendor/llvm/dist, merge clang 3.6.0rc3 from
^/vendor/clang/dist, resolve conflicts, and update patches README.
2015-02-14 14:13:00 +00:00
Dimitry Andric
569e61a4fc Merge ^/head r278499 through r278755. 2015-02-14 13:12:03 +00:00
Dimitry Andric
ec12bbe359 Vendor import of clang RELEASE_360/rc3 tag r229040 (effectively, 3.6.0 RC3):
https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_360/rc3@229040
2015-02-14 12:18:48 +00:00
Dimitry Andric
608e665946 Vendor import of llvm RELEASE_360/rc3 tag r229040 (effectively, 3.6.0 RC3):
https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_360/rc3@229040
2015-02-14 12:17:42 +00:00
Konstantin Belousov
45468c5356 Properly interpose libc spinlocks, was missed in r276630. In
particular, stdio locking was affected.

Reported and tested by:	"Matthew D. Fuller" <fullermd@over-yonder.net>
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2015-02-14 11:47:40 +00:00
Xin LI
a89629abd9 Disallow pattern spaces which would cause intermediate calculations to
overflow size_t.

Obtained from:	DragonFly (2841837793bd095a82f477e9c370cfe6cfb3862c dillon)
Security:	CERT VU#695940
MFC after:	3 days
2015-02-14 00:23:53 +00:00
Bryan Drewery
0de5632c91 Remove disconnected (and broken) directory libiconv. It was added in the
initial citrus import in r219019 but never used as iconv is just built with
libc.  A libiconv.so was handled by lib/libiconv_compat for a while but removed
in r257583.
2015-02-13 23:35:58 +00:00
Rui Paulo
eda94c07de Teach libproc how to find debugging symbols in /usr/lib/debug.
MFC after:	1 week
2015-02-13 03:18:29 +00:00
Pedro F. Giffuni
09d73a0662 Revert 278634: This broke the build due to the compiler being too clever.
Will be back, with proper compiler workarounds.
2015-02-13 00:21:54 +00:00
Pedro F. Giffuni
0b44c6cc6e ulimit(3): Fix broken check.
The existing implementation had a broken comparison that could overflow.
Replace this with a check that avoids the overflow before it happens.

Consistently return a maximum value also on the case of negative
arguments since negative is considered an overflow and means
infinity for our current setrlimit().

Discussed with:	bde (rather extensively)

CID:		1199295
MFC after:	1 week
2015-02-12 21:07:42 +00:00
Konstantin Belousov
e50def75bd Update libthr(3) man page to reflect the work done to support dlopen.
Noted and reviewed by:	bdrewery
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-02-12 17:16:54 +00:00
Bryan Drewery
1bb3a25f07 When catopen(3) returns an error, it caches the result of that error
from r202992. The refcount on the cache entry is not initialized, so
any attempt to clean the cache will skip over this item since it likely
has a >0 value.

This change is currently a NOP. There is work in progress to support
freeing the cache which requires this change to avoid a memory leak.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-02-10 20:45:40 +00:00
George V. Neville-Neil
fcb5606706 Initial version of DTrace on ARM32.
Submitted by:	Howard Su based on work by Oleksandr Tymoshenko
Reviewed by:	ian, andrew, rpaulo, markj
2015-02-10 19:41:30 +00:00
Dimitry Andric
93466fc60f Merge ^/head r278351 through r278498. 2015-02-10 07:56:14 +00:00
Dimitry Andric
476c4db3dc Import compiler-rt trunk r228651.
https://llvm.org/svn/llvm-project/compiler-rt/trunk@228651
2015-02-10 07:45:43 +00:00
Rui Paulo
532000256b Merge xz 5.2.0.
This brings support for multi-threaded compression.  This brings close
N times faster compression where N is the number of CPU cores.
Because of this, liblzma now depends on libthr.

Soon libarchive will be modified to use the new lzma API.

Thanks to antoine@ for the exp-run.

Differential Revision:	 https://reviews.freebsd.org/D1786
Reviewed by:	bapt
2015-02-09 06:20:34 +00:00
Baptiste Daroussin
0f638f5385 revert r278414
Reported by:	bz
2015-02-08 23:03:41 +00:00
Baptiste Daroussin
6062b7ccd9 Reapply r255891 2015-02-08 22:24:18 +00:00
Ed Maste
9d984acfb7 Update FreeBSD LLDB build for 3.6 update
Sponsored by:	DARPA, AFRL
2015-02-08 17:26:41 +00:00
Pedro F. Giffuni
eb77fbdcec Protect uninitialized scalar variable from being accessed
In a couple of cases a variable "stayopen" can be checked
unitialized. This is of no danger as the complementary
condition is false but prevent the access by switching
the checks.

CID:	1018729
CID:	1018732
2015-02-07 19:51:34 +00:00
Edward Tomasz Napierala
6c316535e2 Remove useless comment.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-02-07 13:11:45 +00:00
Dimitry Andric
b40d827331 Merging ^/head r278298 through r278350. 2015-02-07 12:57:40 +00:00
Steve Kargl
dc98c00464 Truncate the exponent 'n' of type long to a domain contained
within [INT_MIN, INT_MAX] where the magnitude of the lower
and upper bounds are sufficiently large to span the range of
scalbn[fl].

While here, remove the GNU style bug in the function declarations.

Reviewed by:	bde, pfg
2015-02-07 00:38:18 +00:00
John Baldwin
64de80195b Add a new device control utility for new-bus devices called devctl. This
allows the user to request administrative changes to individual devices
such as attach or detaching drivers or disabling and re-enabling devices.
- Add a new /dev/devctl2 character device which uses ioctls for device
  requests.  The ioctls use a common 'struct devreq' which is somewhat
  similar to 'struct ifreq'.
- The ioctls identify the device to operate on via a string.  This
  string can either by the device's name, or it can be a bus-specific
  address.  (For unattached devices, a bus address is the only way to
  locate a device.)  Bus drivers register an eventhandler to claim
  unrecognized device names that the driver recognizes as a valid address.
  Two buses currently support addresses: ACPI recognizes any device
  in the ACPI namespace via its full path starting with "\" and
  the PCI bus driver recognizes an address specification of
  'pci[<domain>:]<bus>:<slot>:<func>' (identical to the PCI selector
  strings supported by pciconf).
- To make it easier to cut and paste, change the PnP location string
  in the PCI bus driver to output a full PCI selector string rather
  than 'slot=<slot> function=<func>'.
- Add a devctl(3) interface in libdevctl which provides a wrapper around
  the ioctls and is the preferred interface for other userland code.
- Add a devctl(8) program which is a simple wrapper around the requests
  supported by devctl(3).
- Add a device_is_suspended() function to check DF_SUSPENDED.
- Add a resource_unset_value() function that can be used to remove a
  hint from the kernel environment.  This is used to clear a
  hint.<driver>.<unit>.disabled hint when re-enabling a boot-time
  disabled device.

Reviewed by:	imp (parts)
Requested by:	imp (changing PCI location string)
Relnotes:	yes
2015-02-06 16:09:01 +00:00
Pedro F. Giffuni
02aa7d7b57 Update comment and NetBSD ID tag.
The NetBSD revisions correspond to changes we have already done
like __P() removal and ANSI-fication of definitions.
2015-02-06 14:22:00 +00:00
Pedro F. Giffuni
24ef1d7ab6 Drop cgetclose() from getdiskbyname().
This was a local addition to the original change from NetBSD.
Being this libc there is some chance for it to interfere with
user's cget*() functions usage. The memory leak was finely
plugged by r278300.

Pointed out by:	ache
2015-02-06 14:07:01 +00:00
Konstantin Belousov
83d74204c8 Fully initialize allocated memory for the new barrier. The
b_destroying member was left uninitialized, which caused spurious
EBUSY.

PR:	197365
Noted by:	Florent Guiliani <fguiliani@verisign.com>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-02-06 12:18:38 +00:00
Alexander Motin
78a786f909 Some NetGraph debug polishing.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	2 weeks
2015-02-06 09:41:16 +00:00
Justin Hibbits
4656c46d63 Add a comment explaining why gcc is needed.
X-MFC-With:	278231
MFC after:	2 weeks
2015-02-06 02:35:29 +00:00
Pedro F. Giffuni
b20592de1b tdelete(3): don't delete the node we are about to return.
CID:		272528
Obtained from:	NetBSD (CVS rev. 1.4)
MFC after:	2 weeks
2015-02-05 23:02:43 +00:00
Pedro F. Giffuni
5262b957d4 getdiskbyname(): plug resource leak
Variable cq going out of scope leaks the storage it points to.

CID:		270511
Phabric:	D1775
Reviewed by:	imp
Obtained from:	NetBSD (CVS rev. 1.34)
MFC after:	2 weeks
2015-02-05 22:54:31 +00:00
John Baldwin
94f0eafcd2 Expose the constants for internal new-bus device flags to userland. The
flag value is already exposed via dv_flags, just not the meaning of the
flags themselves.  Use these constants to annotate devices that are
disabled or suspended in devinfo output.
2015-02-05 22:42:44 +00:00
Dimitry Andric
bd9cc051b3 Merging ^/head r278224 through r278297. 2015-02-05 22:34:29 +00:00
Justin Hibbits
35eeacca92 powerpc64 csu needs to be built by gcc, so enforce that.
With this change, world is one step closer to being clang-able.

MFC after:	2 weeks
2015-02-05 03:56:49 +00:00
Dimitry Andric
5ecbbe6415 Followup to r278223, by only using -stdlib=libc++ when the compiler is
clang; not even recent versions of gcc support the -stdlib flag.

Noticed by:	ngie
2015-02-04 21:48:50 +00:00
Dimitry Andric
a403ab7f64 Merge ^/head r278110 through r278223. 2015-02-04 21:08:28 +00:00
Dimitry Andric
35a08a4403 For now, add -stdlib=libc++ to the flags for building clang, since that
makes it easier to build head on stable/9, where libstdc++ is still the
default.  We can revisit this when somebody will try to build base with
gcc 4.8.1 or higher, and its included libstdc++.

Reported by:	rpaulo
2015-02-04 21:00:29 +00:00
Enji Cooper
c7b6816fa9 Add MK_FILE to control whether or not to build file(1), libmagic(3), etc
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
2015-02-04 10:24:40 +00:00
Enji Cooper
31a741f473 Conditionalize building radius support into libpam, ppp, etc via
MK_RADIUS_SUPPORT

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
2015-02-04 06:53:45 +00:00
Pedro F. Giffuni
5b3ddf0928 scanblnl: drop extra braces.
Pointed out by:	bde
2015-02-03 16:16:52 +00:00
Pedro F. Giffuni
73c031c5d4 Reduce confusion in scalbnl() family of functions.
The changes unrelated to the bug in r277948 made
the code very difficult to understand to both
coverity and regular humans so take a step back
to something that is much easier to understand
for both and follows better the original code.

CID:	1267992, 1267993, 1267994
Discussed with:	kargl
2015-02-03 14:17:29 +00:00
Dimitry Andric
0f0f2bfa77 Pull in r227752 from upstream llvm trunk (by Michael Kuperstein):
[X86] Convert esp-relative movs of function arguments to pushes, step 2

  This moves the transformation introduced in r223757 into a separate MI pass.
  This allows it to cover many more cases (not only cases where there must be a
  reserved call frame), and perform rudimentary call folding. It still doesn't
  have a heuristic, so it is enabled only for optsize/minsize, with stack
  alignment <= 8, where it ought to be a fairly clear win.

  (Re-commit of r227728)

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

This helps to get sys/boot/i386/boot2 below the required size again,
when optimizing with -Oz.
2015-02-02 20:34:40 +00:00
Dimitry Andric
73ee00cef5 Merge ^/head r278005 through r278109. 2015-02-02 20:18:47 +00:00
Pedro F. Giffuni
e742fdff32 rpc: Uninitialized pointer read
Initialize *xprt to avoid exposing a random value
in cleanup_svc_vc_create.

CID:		1018723
Phabric:	D1749
Reviewed by:	alfred
2015-02-02 00:21:34 +00:00
Pedro F. Giffuni
81cb3b156b Resource leak
CID:	1016703
Reviewed by:	alfred
2015-02-01 23:19:06 +00:00
Jilles Tjoelker
424c16b2ce ttyname_r(): Return actual error, not always [ENOTTY].
Adjust the test that used to fail because of this bug.

PR:		191936
MFC after:	1 week
2015-02-01 22:50:33 +00:00
Dimitry Andric
3de688eb16 Merge llvm 3.6.0rc2 from ^/vendor/llvm/dist, merge clang 3.6.0rc2 from
^/vendor/clang/dist, resolve conflicts, and cleanup patches.
2015-01-31 21:57:38 +00:00
Dimitry Andric
9e435806aa Vendor import of clang RELEASE_360/rc2 tag r227651 (effectively, 3.6.0 RC2):
https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_360/rc2@227651
2015-01-31 19:28:59 +00:00
Dimitry Andric
ec304151b7 Vendor import of llvm RELEASE_360/rc2 tag r227651 (effectively, 3.6.0 RC2):
https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_360/rc2@227651
2015-01-31 19:27:28 +00:00
Dimitry Andric
6a0fc39710 Merge ^/head r277956 through r277974. 2015-01-31 14:31:12 +00:00
Mark Johnston
c7fa6f0bb0 Stop iterating and return if the caller-supplied callback function returns
a non-zero value.

MFC after:	1 week
2015-01-31 03:22:00 +00:00
Dimitry Andric
174411efe9 Merge ^/head r277945 through r277955. 2015-01-30 23:57:39 +00:00
Pedro F. Giffuni
311449a4e3 msun: use previously ignored value.
This fixes evaluation of exceptional values in scalblnl().
While here, simplify the code as suggested by Bruce Evans.

Reported by:	clang static analyzer
MFC after:	1 week
2015-01-30 19:19:03 +00:00
Dimitry Andric
f72f83dcae Merge ^/head r277902 through r277944. 2015-01-30 18:34:56 +00:00
Pawel Jakub Dawidek
33c380b096 Make gcc happy.
Reported by:	bz
2015-01-30 13:03:36 +00:00
Pawel Jakub Dawidek
b4b884751b Add missing nvlist_get_parent(3) link.
Submitted by:	Mariusz Zaborski <oshogbo@FreeBSD.org>
2015-01-30 12:57:35 +00:00
Pawel Jakub Dawidek
c06165279d Handle empty nvlists correctly.
Submitted by:	Mariusz Zaborski <oshogbo@FreeBSD.org>
2015-01-30 12:31:29 +00:00
Pawel Jakub Dawidek
aa2e2bdaf2 Modify nvlist_get_parent() API to take additional cookie argument.
This allow for non-recursive iteration over nested nvlists, as in documented
example.

Submitted by:	Mariusz Zaborski <oshogbo@FreeBSD.org>
2015-01-30 10:08:38 +00:00
Pawel Jakub Dawidek
00294559aa If moving descriptor or binary data to an nvlist fails, we need to close the
descriptor or free the memory before returning.

Submitted by:	Mariusz Zaborski <oshogbo@FreeBSD.org>

While here, protect errno, so it won't be overwritted by close(2) or free(3).
2015-01-30 09:44:29 +00:00
Dimitry Andric
7aeb836a3b Merge ^/head r277861 through r277895. 2015-01-29 19:21:21 +00:00
Ed Maste
7a47d65d5d Use zero register instead of immediate 0x0 in MIPS assembly
It seems GAS makes the substitution automatically, but Clang's
integrated assembler does not (yet). It fails with "invalid operand for
instruction."

Reported by:	sbruno
2015-01-29 15:30:04 +00:00
Jilles Tjoelker
49ba8a68f0 sem_post(): Fix and document semaphore value overflow error.
The error code is per Austin Group issue #315.

I provided different wording for the manual page change.

Submitted by:	pluknet
MFC after:	1 week
2015-01-28 22:42:56 +00:00
Dimitry Andric
6402890244 Merge ^/head r277804 through r277843. 2015-01-28 18:45:40 +00:00
Ruslan Bukin
6411d14d62 Add ARMv7 performance monitoring counters.
Differential Revision:	https://reviews.freebsd.org/D1687
Reviewed by:	rpaulo
Sponsored by:	DARPA, AFRL
2015-01-28 16:08:07 +00:00
Dimitry Andric
2c1a63f2b1 Instead of hardcoding /usr/lib, as in r277803, use ${LIBDIR} for the
private header location, since this Makefile (and everything under
lib/clang) is not processed for the 32-bit compat stages anyway.

Noticed by:	bjk
2015-01-27 19:58:02 +00:00
Dimitry Andric
76f411ce48 Merging ^/head r277777 through r277803. 2015-01-27 19:40:08 +00:00
Dimitry Andric
0616204eb2 Change the path to clang's private headers. Upstream has always stored
these in $LIBDIR/clang/$VERSION/include, instead of our previous custom
location in /usr/include/clang/$VERSION.  This allows us to drop yet
another FreeBSD-specific patch.
2015-01-27 19:25:39 +00:00
Dimitry Andric
c7d7e597b4 Constify a struct savexmm pointer in pt_ucontext_to_fpreg(), to silence
a -Wcast-qual warning from clang 3.6.0.
2015-01-27 18:56:46 +00:00
Dimitry Andric
8179004eba Merge ^/head r277719 through 277776. 2015-01-26 21:41:54 +00:00
Dimitry Andric
47125b4272 Add new internal clang headers, relating to AVX2 and ADX intrinsics. 2015-01-26 19:37:02 +00:00
Dimitry Andric
1ae6788e51 Update llvm and clang library and binary Makefiles for 3.6.0 rc1. 2015-01-26 18:48:27 +00:00
Enji Cooper
02629e469f Add MK_BHYVE knob for building and installing bhyve(4), et al
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
2015-01-26 06:44:48 +00:00
Enji Cooper
3b09bf5e55 Build lib/libgpio if MK_GPIO != no
Fill in corresponding entries for MK_GPIO == no in OptionalObsoleteFiles.inc

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
2015-01-25 05:37:06 +00:00
Mark Johnston
f8c8839091 gr_equal(): Fix a crash that could occur if the first group's member list
was longer than the second's. There is no need to compute and compare the
member list lengths in a separate pass, since we now just return false when
comparing member names if the list lengths are not equal.

MFC after:	2 weeks
2015-01-25 00:47:06 +00:00
Mark Johnston
cd9c993950 Ensure that we don't try to demangle a symbol name if we failed to look
up the symbol. Add a test to exercise this code path.

Reviewed by:	adrian
2015-01-25 00:34:43 +00:00
Jilles Tjoelker
8dd985befe Enable utimensat tests from NetBSD.
As with other tests from c063, a required #include <sys/stat.h> was missing.
2015-01-24 15:49:40 +00:00
Jilles Tjoelker
2205e0d1bd Add futimens and utimensat system calls.
The core kernel part is patch file utimes.2008.4.diff from
pluknet@FreeBSD.org. I updated the code for API changes, added the manual
page and added compatibility code for old kernels. There is also audit and
Capsicum support.

A new UTIME_* constant might allow setting birthtimes in future.

Differential Revision:	https://reviews.freebsd.org/D1426
Submitted by:	pluknet (partially)
Reviewed by:	delphij, pluknet, rwatson
Relnotes:	yes
2015-01-23 21:07:08 +00:00
Alexey Dokuchaev
c5f282daad Fix usage example in kvprintf(9) and its copy in libstand(3): trailing '\n'
in bitfield argument is wrong, as it will be treated as bit 10, causing any
code printing >=10 bits with bit 10 on as having a trailing comma.

Newline (intended one) should be part of the format string (already present
in the examples).

Also fix grammar and kill EOL whitespace in comment while here.

PR:		195005
Approved by:	bdrewery
2015-01-23 07:30:57 +00:00
Ed Maste
e9c93198bc Update reported elftoolchain version
The last elftoolchain update is upstream rev 3136. Update our reported
version and add M (Modified) suffix as our elftoolchain contains
additional fixes not yet committed upstream.

Sponsored by:	The FreeBSD Foundation
2015-01-22 17:53:30 +00:00
Andrew Turner
20fe2c9465 Merge all the copies of _tcb_ctor and _tcb_dtor.
The amd64, i386, and sparc64 versions were identical, with the one
difference where the former two used inline asm instead of _tcb_get. I
have compared the function before and after replacing the asm with _tcb_get
and found the object files to be identical.

The arm, mips, and powerpc versions were almost identical. The only
difference was the powerpc version used an alignment of 1 where arm and
mips used 16. As this is an increase in alignment is will be safe.

Along with this arm, mips, and powerpc all passed, when initial was true,
the value returned from _tcb_get as the first argument to
_rtld_allocate_tls. This would then return this pointer back to the caller.
We can remove these extra calls by checking if initial is set and setting
the thread control block directly. As this is what the sparc64 code does
we can use it directly.

As after these observations all the architectures can now have identical
code we can merge them into a common file.

Differential Revision:	https://reviews.freebsd.org/D1556
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
2015-01-21 16:41:05 +00:00
Konstantin Belousov
9e8bff64cb Fix bug in r276630. Do not allow pthread_sigmask() to block SIGCANCEL.
Reported and tested by:	royger
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2015-01-21 16:13:37 +00:00
Neel Natu
009e2acba6 Fix a bug in libvmmapi 'vm_copy_setup()' where it would return success even if
the 'gpa' was in the guest MMIO region. This would manifest as a segmentation
fault in 'vm_map_copyin()' or 'vm_map_copyout()' because 'vm_map_gpa()' would
return NULL for this 'gpa'.

Fix this by calling 'vm_map_gpa()' in 'vm_copy_setup' and returning a failure
if the 'gpa' cannot be mapped. This matches the behavior of 'vm_copy_setup()'
in vmm.ko.

MFC after:	1 week
2015-01-19 06:51:04 +00:00
Marcel Moolenaar
545ddfbe7d Upgrade libxo to 0.2.0.
Obtained from:	https://github.com/Juniper/libxo
Requested by: Phil Shafer <phil@juniper.net>

Revisions 276253 & 276273 were incorporated into 0.2.0.
Revision 276260 has been merged-in.
2015-01-19 02:22:03 +00:00
Dimitry Andric
06d4ba3888 Vendor import of clang RELEASE_360/rc1 tag r226102 (effectively, 3.6.0 RC1):
https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_360/rc1@226102
2015-01-18 16:23:48 +00:00
Dimitry Andric
67c32a9831 Vendor import of llvm RELEASE_360/rc1 tag r226102 (effectively, 3.6.0 RC1):
https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_360/rc1@226102
2015-01-18 16:17:27 +00:00
Konstantin Belousov
677258f7e7 Add procctl(2) PROC_TRACE_CTL command to enable or disable debugger
attachment to the process.  Note that the command is not intended to
be a security measure, rather it is an obfuscation feature,
implemented for parity with other operating systems.

Discussed with:	jilles, rwatson
Man page fixes by:	rwatson
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-01-18 15:13:11 +00:00
Dimitry Andric
9cac79b378 Upgrade our copy of clang and llvm to 3.5.1 release. This is a bugfix
only release, no new features have been added.

Please note that this version requires C++11 support to build; see
UPDATING for more information.

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

MFC after:	1 month
X-MFC-With:	276479
2015-01-18 14:14:47 +00:00
Neel Natu
d087a39935 Simplify instruction restart logic in bhyve.
Keep track of the next instruction to be executed by the vcpu as 'nextrip'.
As a result the VM_RUN ioctl no longer takes the %rip where a vcpu should
start execution.

Also, instruction restart happens implicitly via 'vm_inject_exception()' or
explicitly via 'vm_restart_instruction()'. The APIs behave identically in
both kernel and userspace contexts. The main beneficiary is the instruction
emulation code that executes in both contexts.

bhyve(8) VM exit handlers now treat 'vmexit->rip' and 'vmexit->inst_length'
as readonly:
- Restarting an instruction is now done by calling 'vm_restart_instruction()'
  as opposed to setting 'vmexit->inst_length' to 0 (e.g. emulate_inout())
- Resuming vcpu at an arbitrary %rip is now done by setting VM_REG_GUEST_RIP
  as opposed to changing 'vmexit->rip' (e.g. vmexit_task_switch())

Differential Revision:	https://reviews.freebsd.org/D1526
Reviewed by:		grehan
MFC after:		2 weeks
2015-01-18 03:08:30 +00:00
Will Andrews
7a37b5fc17 Add a ${CP} alias for copying files in the build.
Some users build FreeBSD as non-root in Perforce workspaces.  By default,
Perforce sets files read-only unless they're explicitly being edited.
As a result, the -f argument must be used to cp in order to override the
read-only flag when copying source files to object directories.  Bare use of
'cp' should be avoided in the future.

Update all current users of 'cp' in the src tree.

Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	Spectra Logic
2015-01-16 21:39:08 +00:00
Hans Petter Selasky
8778569724 Add more USB request definitions. The values are described in section
9.4.11 and 9.4.12 of the "Universal Serial Bus 3.0 Specification"

Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	1 week
2015-01-16 12:11:01 +00:00
Dag-Erling Smørgrav
f8b83996fe If PAM_RHOST is non-NULL, pass it in the Calling-Station-ID attribute of
the RADIUS access request.

MFC after:	1 week
2015-01-16 09:07:31 +00:00
Dimitry Andric
30d791273d Vendor import of clang RELEASE_351/final tag r225668 (effectively, 3.5.1 release):
https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_351/final@225668
2015-01-15 22:31:35 +00:00
Dimitry Andric
9f61947910 Vendor import of llvm RELEASE_351/final tag r225668 (effectively, 3.5.1 release):
https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_351/final@225668
2015-01-15 22:30:16 +00:00
Dimitry Andric
d72607e9e2 Import libc++ trunk r224926. This fixes a number of bugs, completes
C++14 support[1], adds more C++1z features[2], and fixes the following
LWG issues[3]:

1450: Contradiction in regex_constants
2003: String exception inconsistency in erase.
2075: Progress guarantees, lock-free property, and scheduling
      assumptions
2104: unique_lock move-assignment should not be noexcept
2112: User-defined classes that cannot be derived from
2132: std::function ambiguity
2135: Unclear requirement for exceptions thrown in
      condition_variable::wait()
2142: packaged_task::operator() synchronization too broad?
2182: Container::[const_]reference types are misleadingly specified
2186: Incomplete action on async/launch::deferred
2188: Reverse iterator does not fully support targets that overload
      operator&
2193: Default constructors for standard library containers are explicit
2205: Problematic postconditions of regex_match and regex_search
2213: Return value of std::regex_replace
2240: Probable misuse of term "function scope" in [thread.condition]
2252: Strong guarantee on vector::push_back() still broken with C++11?
2257: Simplify container requirements with the new algorithms
2258: a.erase(q1, q2) unable to directly return q2
2263: Comparing iterators and allocator pointers with different
      const-character
2268: Setting a default argument in the declaration of a member
      function assign of std::basic_string
2271: regex_traits::lookup_classname specification unclear
2272: quoted should use char_traits::eq for character comparison
2278: User-defined literals for Standard Library types
2280: begin / end for arrays should be constexpr and noexcept
2285: make_reverse_iterator
2288: Inconsistent requirements for shared mutexes
2291: std::hash is vulnerable to collision DoS attack
2293: Wrong facet used by num_put::do_put
2299: Effects of inaccessible key_compare::is_transparent type are not
      clear
2301: Why is std::tie not constexpr?
2304: Complexity of count in unordered associative containers
2306: match_results::reference should be value_type&, not const
      value_type&
2308: Clarify container destructor requirements w.r.t. std::array
2313: tuple_size should always derive from integral_constant<size_t, N>
2314: apply() should return decltype(auto) and use decay_t before
      tuple_size
2315: weak_ptr should be movable
2316: weak_ptr::lock() should be atomic
2317: The type property queries should be UnaryTypeTraits returning
      size_t
2320: select_on_container_copy_construction() takes allocators, not
      containers
2322: Associative(initializer_list, stuff) constructors are
      underspecified
2323: vector::resize(n, t)'s specification should be simplified
2324: Insert iterator constructors should use addressof()
2329: regex_match()/regex_search() with match_results should forbid
      temporary strings
2330: regex("meow", regex::icase) is technically forbidden but should
      be permitted
2332: regex_iterator/regex_token_iterator should forbid temporary
      regexes
2339: Wording issue in nth_element
2341: Inconsistency between basic_ostream::seekp(pos) and
      basic_ostream::seekp(off, dir)
2344: quoted()'s interaction with padding is unclear
2346: integral_constant's member functions should be marked noexcept
2350: min, max, and minmax should be constexpr
2356: Stability of erasure in unordered associative containers
2357: Remaining "Assignable" requirement
2359: How does regex_constants::nosubs affect basic_regex::mark_count()?
2360: reverse_iterator::operator*() is unimplementable

[1] http://libcxx.llvm.org/cxx1y_status.html
[2] http://libcxx.llvm.org/cxx1z_status.html
[3] http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html

Exp-run:	antoine
MFC after:	1 month
2015-01-15 21:17:36 +00:00
Randall Stewart
d95b3509e1 Update the hwpmc driver to have the new type HASWELL_XEON. Also
go back through HASWELL, IVY_BRIDGE, IVY_BRIDGE_XEON and SANDY_BRIDGE
to straighten out all the missing PMCs. We also add a new pmc tool
pmcstudy, this allows one to run the various formulas from
the documents "Using Intel Vtune Amplifier XE on XXX Generation platforms" for
IB/SB and Haswell. The tool also allows one to postulate your own
formulas with any of the various PMC's. At some point I will enahance
this to work with Brendan Gregg's flame-graphs so we can flamegraph
various PMC interactions. Note the manual page also needs some
work (lots of work) but gnn has committed to help me with that ;-)
Reviewed by: gnn
MFC after:1 month
Sponsored by:	Netflix Inc.
2015-01-14 12:46:58 +00:00
Hans Petter Selasky
930a420683 Fix spelling. 2015-01-14 06:46:25 +00:00
Dimitry Andric
39a9ae0f39 Since the merge of file 5.21 in r276415 and r276416, stable/9 and
stable/10 cannot be built from FreeBSD 8.x.  This is because the
build-tools stage requires libmagic, but lib/libmagic/config.h was
generated on head, and it now enables using the xlocale.h APIs, which
are not supported on 8.x (and on 9.x before __FreeBSD_version 900506).

See also the start of this thread on -stable:
https://lists.freebsd.org/pipermail/freebsd-stable/2015-January/081521.html

To fix this, conditionalize the use of xlocale.h APIs to make
bootstrapping from older FreeBSD versions work correctly.

Reviewed by:	delphij
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D1518
2015-01-13 20:37:57 +00:00
Dimitry Andric
8028b78dbf Connect libclang_rt to the build, for specific architectures. This
contains the libraries for Address Sanitizer (asan), Undefined Behavior
Sanitizer (ubsan) and Profile Guided Optimization.

ASan is a fast memory error detector. It can detect the following types
of bugs:

    Out-of-bounds accesses to heap, stack and globals
    Use-after-free
    Use-after-return (to some extent)
    Double-free, invalid free
    Memory leaks (experimental)

Typical slowdown introduced by AddressSanitizer is 2x.

UBSan is a fast and compatible undefined behavior checker. It enables a
number of undefined behavior checks that have small runtime cost and no
impact on address space layout or ABI.

PLEASE NOTE: the sanitizers still have some rough edges on FreeBSD,
particularly on i386.  These will hopefully be smoothed out in the
coming time.

Differential Revision: https://reviews.freebsd.org/D1505
2015-01-13 19:54:47 +00:00
Ed Maste
4b12fb6103 Remove duplicate copies of trivial getcontextx.c
Only i386 and amd64 provide a non-trivial __getcontextx(). Use a common
trivial implementation in gen/ for other architectures, rather than
copying the file to each MD subdirectory.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D1472
2015-01-12 18:13:38 +00:00
Konstantin Belousov
397d851d66 Reduce the size of the interposing table and amount of
cancellation-handling code in the libthr.  Translate some syscalls
into their more generic counterpart, and remove translated syscalls
from the table.

List of the affected syscalls:
creat, open -> openat
raise -> thr_kill
sleep, usleep -> nanosleep
pause -> sigsuspend
wait, wait3, waitpid -> wait4

Suggested and reviewed by:	jilles (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-01-11 22:16:31 +00:00
Baptiste Daroussin
910824cea4 Do not regenerate and install liblzma.pc when only build libraries
aka do not regenerate while generating 32bits libs

Reported by:	antoine
2015-01-11 09:25:01 +00:00
Baptiste Daroussin
8606363bf9 Install the liblzma pkg-config file
MFC after:	1 week
2015-01-10 00:11:10 +00:00
Andrew Turner
d6a052e0e6 With the update of compiler-rt we try to build a number of files that
don't build on some ARM platforms, provide symbols we already provide in
libc, or don't exist. Remove these from the build. Some of these may
return later on specific targets.

Differential Revision:	https://reviews.freebsd.org/D1468
Reviewed by:	dim, imp
2015-01-09 20:00:37 +00:00
Baptiste Daroussin
7c5c8a589b Remove junk added during testing phase 2015-01-09 07:48:22 +00:00
Baptiste Daroussin
c1a66a97f9 Synchronize libedit with NetBSD and activate UTF-8 support [1]
Differences with NetBSD
Reapply our local patches on top of it
Fix Unicode environement detection
Fix reading a line in unicode environment.
It allows /bin/sh to works in UTF-8 envs

Differential Revision:	https://reviews.freebsd.org/D1455
Reviewed by:	jilles, pfg
Obtained from:	NetBSD [1]
MFC after:	1 month
Relnotes:	yes
2015-01-09 07:40:56 +00:00
Ed Maste
2d4f9ccd88 Remove extraneous period
Reported by:	rodrigc
2015-01-09 01:57:11 +00:00
Dimitry Andric
91d03e2e18 Now compiler-rt has been updated in r276851, bring in the various
sanitizer libraries that already work on FreeBSD:

* asan:    Address Sanitizer
* ubsan:   Undefined Behavior Sanitizer
* profile: Profile Guided Optimization support

Please note that these libraries are *experimental* at this stage, so
the main Makefile is not yet connected to the build.

Since I didn't want to needlessly edit BSD.usr.dist, you will also have
to create the install directory /usr/lib/clang/3.5.0/lib/freebsd
manually for now.
2015-01-08 22:40:56 +00:00
Dimitry Andric
18ecc14c78 Apparently more Makefiles use stuff from compiler-rt, so fix them up
too.  (This did not show during a make universe, strangely.)
2015-01-08 20:11:38 +00:00
Dimitry Andric
28f42739a5 Follow up to r276851 by also committing a necessary update to
lib/libblocksruntime.

Pointy hat to:	dim
2015-01-08 20:08:00 +00:00
Dimitry Andric
f4341a5a66 Update compiler-rt to trunk r224034. This brings a number of new
builtins, and also the various sanitizers.  Support for these will be
added in a later commit.
2015-01-08 19:47:10 +00:00
John Baldwin
e275993995 Document CPU_WHICH_DOMAIN and bump Dd for cpuset.1.
Missed in:	r276829
2015-01-08 18:53:11 +00:00
Ed Maste
a1b50624be Fix WITH_LLDB build
A build with WITH_LLDB and not WITH_CLANG_EXTRAS failed after r276783.

Reported by:	rodrigc
2015-01-08 14:26:49 +00:00
Craig Rodrigues
9cebfb86a7 Clarify text to be consistent with nanosleep(2),
since sleep(3) is implemented in terms of nanosleep(2).

This is similar to the sleep(3) man page for Darwin.
2015-01-08 01:27:43 +00:00
Dimitry Andric
ca9211ecde Import compiler-rt trunk r224034.
https://llvm.org/svn/llvm-project/compiler-rt/trunk@224034
2015-01-07 19:55:37 +00:00
Dimitry Andric
47a80b9264 Add the AArch64 llvm backend to the build to allow for early testing and
to ease any rework of how clang is built to take arm64 in to account.

Submitted by:	andrew
Reviewed by:	andrew, emaste
Differential Revision: https://reviews.freebsd.org/D1446
2015-01-07 19:06:27 +00:00
Xin LI
681ed54caa MFV r276759: libpcap 1.6.2.
MFC after:	1 month
2015-01-06 22:29:12 +00:00
Justin Hibbits
85eda151ff Avoid use of register variables. Clang 3.5 treats this as undefined behavior,
and bad things happen.

MFC after:	1 week
2015-01-06 03:50:43 +00:00
Konstantin Belousov
1a744fefc2 Avoid calling internal libc function through PLT or accessing data
though GOT, by staticizing and hiding.  Add setter for
__error_selector to hide it as well.

Suggested and reviewed by:	jilles
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-01-05 01:06:54 +00:00
Joel Dahl
f636caf195 mdoc: paragraph improvements. 2015-01-04 12:49:24 +00:00
Joel Dahl
73461c24c4 mdoc: sort SEE ALSO. 2015-01-04 12:38:00 +00:00
Konstantin Belousov
8495e8b1e9 Fix known issues which blow up the process after dlopen("libthr.so")
(or loading a dso linked to libthr.so into process which was not
linked against threading library).

- Remove libthr interposers of the libc functions, including
  __error(). Instead, functions calls are indirected through the
  interposing table, similar to how pthread stubs in libc are already
  done.  Libc by default points either to syscall trampolines or to
  existing libc implementations.  On libthr load, libthr rewrites the
  pointers to the cancellable implementations already in libthr.  The
  interposition table is separate from pthreads stubs indirection
  table to not pull pthreads stubs into static binaries.

- Postpone the malloc(3) internal mutexes initialization until libthr
  is loaded.  This avoids recursion between calloc(3) and static
  pthread_mutex_t initialization.

- Reinstall signal handlers with wrapper on libthr load.  The
  _rtld_is_dlopened(3) is used to avoid useless calls to sigaction(2)
  when libthr is statically referenced from the main binary.

In the process, fix openat(2), swapcontext(2) and setcontext(2)
interposing.  The libc symbols were exported at different versions
than libthr interposers.  Export both libc and libthr versions from
libc now, with default set to the higher version from libthr.

Remove unused and disconnected swapcontext(3) userspace implementation
from libc/gen.

No objections from:	deischen
Tested by:	pho, antoine (exp-run) (previous versions)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-01-03 18:38:46 +00:00
Konstantin Belousov
0e521992a4 Add rtld private interface for dso to detect dynamic loading
vs. static linking.

Tested by:	pho, antoine (exp-run)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2015-01-03 18:09:53 +00:00
Dag-Erling Smørgrav
ff8258499c Upgrade to Unbound 1.5.1. Almost all our local changes to date have been
adopted upstream, greatly reducing the diff.
2015-01-03 02:40:51 +00:00
Jilles Tjoelker
d79f904ad2 Link lib/libc/c063 tests to the build.
Some files lack required #include <sys/stat.h>. The #ifdef is per ngie's
request; the includes are clearly necessary for struct stat.

The faccessat test fails because it tries to use AT_SYMLINK_NOFOLLOW with
faccessat(), which is not specified by POSIX.1-2008.

Differential Revision:	https://reviews.freebsd.org/D1411
Reviewed by:	ngie
2015-01-02 22:49:05 +00:00
Xin LI
4460e5b02d MFV r276568:
Update file to 5.22.

MFC after:	2 weeks
2015-01-02 21:20:02 +00:00
Baptiste Daroussin
2d2813618c Remove GNU texinfo from base along with all info pages.
To be able to info pages consider installing texinfo from ports print/texinfo or
via pkg: pkg install texinfo

Differential Revision:	https://reviews.freebsd.org/D1409
Reviewed by:	emaste, imp (previous version)
Relnotes:	yes
2015-01-02 18:45:03 +00:00