Commit Graph

16176 Commits

Author SHA1 Message Date
Devin Teske
964b46aaea Fix build-error (pointy hat; didn't merge full up-to-date code)
MFC after:	21 days
X-MFC-to:	stable/10 stable/9
X-MFC-with:	274116
2014-11-05 01:47:25 +00:00
Devin Teske
041394f38a Add new libraries/utilities for data throughput visualization.
dpv(3): dialog progress view library
dpv(1): stream data from stdin or multiple paths with dialog progress view
figpar(3): configuration file parsing library

Reviews:	D714
Reviewed by:	jelischer, shurd
Discussed at:	MeetBSD California 2014 Vendor/Dev Summit
Discussed on:	-current
MFC after:	21 days
X-MFC-to:	stable/10 stable/9
2014-11-04 23:46:01 +00:00
Enji Cooper
e51a35a50c Commit missing header for sys/time.h compat on NetBSD to unbreak the amd64/i386
build

Pointyhat to: me (forgot to svn add it sooner)
2014-11-04 02:00:07 +00:00
Enji Cooper
2f1217877e Add reachover Makefiles for contrib/netbsd-tests/lib/libc; this adds approximately
500 new testcases

Various TODOs have been sprinkled around the Makefiles for items that even need
to be ported (missing features), testcases have issues with building/linking, or
issues at runtime.

A variant of this code has been tested extensively on amd64 and i386
10-STABLE/11-CURRENT for several months without issue. It builds on other
architectures, but the code will remain off until I have prove it works on
virtual hardware or real hardware on other architectures

In collaboration with: pho, Casey Peel <casey.peel@isilon.com>
Sponsored by: EMC / Isilon Storage Division
2014-11-04 00:56:25 +00:00
Martin Matuska
0ac327af11 Add pkg-config file for libarchive
Requested by:	bapt
MFC after:	1 week
2014-11-02 09:37:45 +00:00
Julio Merino
0677dfd1c4 MFV: Import atf-0.21. 2014-11-01 11:17:54 +00:00
Dag-Erling Smørgrav
4b52e0d84f <sys/param.h> is a superset of <sys/types.h> and must always come
first.  Coincidentally, today is the 11th anniversary of this man
page's (and this bug's) first appearance in FreeBSD.

MFC after:	3 days
2014-11-01 09:10:21 +00:00
Edward Tomasz Napierala
62bf353355 Update acl(3) to expand on NFSv4 ACL support.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-10-30 10:56:38 +00:00
Edward Tomasz Napierala
02c55812ad Make it clear that ACL flags are NFSv4-only.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-10-30 10:49:50 +00:00
Dimitry Andric
b149798e50 Fix a clang 3.5 warning about abs(3) being given an argument of type
quad_t in setusercontext().  While here, sanitize the clamping of the
priority value, and use the correct type for the return value of
login_getcapnum().

Reviewed by:	kib
MFC after:	3 days
2014-10-29 20:18:37 +00:00
Baptiste Daroussin
6e6c53f063 Fix renaming a group via the gr_copy function
Add a regression test to pw(8) because the bug was discovered via using:
pw groupmod

PR:		187189
Reported by:	mcdouga9@egr.msu.edu
Tested by:	mcdouga9@egr.msu.edu
Patch by:	Marc de la Gueronniere
2014-10-28 16:27:29 +00:00
Kevin Lo
dbf11b2466 Fix prototypes. 2014-10-28 02:05:57 +00:00
John-Mark Gurney
89ca4e2de0 only install .pc files when we are not installing 32bit compat libs...
This fixes the problem of installing the .pc files multiple times...
2014-10-27 23:43:25 +00:00
John-Mark Gurney
55edfde154 fix typo, properly install a link to nv for nvlist_freev... 2014-10-27 23:03:17 +00:00
Mark Johnston
20cc9ac42f getgrouplist(3) was reimplemented in terms of getgrent_r(3) in r174547, so
this bug is no longer valid.

MFC after:	3 days
2014-10-27 04:09:23 +00:00
Brooks Davis
052260fe0a Use the __DECONST macro rather than hand rolling the same thing.
Sponsored by:	DARPA, AFRL
2014-10-24 23:25:44 +00:00
Brooks Davis
e7254647bf Remove an unused variable that would be better spelled __func__.
Sponsored by:	DARPA, AFRL
2014-10-24 23:24:47 +00:00
Mark Johnston
f53b045631 Eliminate conf_lock and instead rely on the NSS write lock to protect
NSS configuration state.

As a side effect, this fixes a race condition which can occur if multiple
threads call nsdispatch(3) concurrently before nsswitch.conf has been
parsed. Previously, the thread holding conf_lock could cause other threads
to return from nss_configure() before nsswitch.conf had been parsed, forcing
them to fall back to the default sources for their NSS methods.

Reviewed by:		jhb
Differential Revision:	https://reviews.freebsd.org/D994
MFC after:		1 month
Sponsored by:		EMC / Isilon Storage Division
2014-10-24 20:29:14 +00:00
John Baldwin
53e1ffbbce The current POSIX semaphore implementation stores the _has_waiters flag
in a separate word from the _count.  This does not permit both items to
be updated atomically in a portable manner.  As a result, sem_post()
must always perform a system call to safely clear _has_waiters.

This change removes the _has_waiters field and instead uses the high bit
of _count as the _has_waiters flag.  A new umtx object type (_usem2) and
two new umtx operations are added (SEM_WAIT2 and SEM_WAKE2) to implement
these semantics.  The older operations are still supported under the
COMPAT_FREEBSD9/10 options.  The POSIX semaphore API in libc has
been updated to use the new implementation.  Note that the new
implementation is not compatible with the previous implementation.
However, this only affects static binaries (which cannot be helped by
symbol versioning).  Binaries using a dynamic libc will continue to work
fine.  SEM_MAGIC has been bumped so that mismatched binaries will error
rather than corrupting a shared semaphore.  In addition, a padding field
has been added to sem_t so that it remains the same size.

Differential Revision:	https://reviews.freebsd.org/D961
Reported by:	adrian
Reviewed by:	kib, jilles (earlier version)
Sponsored by:	Norse
2014-10-24 20:02:44 +00:00
John Baldwin
15096da3f4 Don't reference sem(4) from the POSIX semaphore pages. POSIX semaphores
were reimplemented using umtx in FreeBSD 9 and no longer use sem(4).
2014-10-24 19:55:49 +00:00
Marcel Moolenaar
d7790611c1 Hook libxo to the build.
Sponsored by:	Juniper Networks, Inc.
2014-10-23 23:14:23 +00:00
Enji Cooper
481e594b9b The NetBSD libc tests use several definitions/macros that aren't available in
FreeBSD

Add the missing compat definitions/macros to lib/libnetbsd so the testcases
can be compiled with libnetbsd without having to invent ad hoc #define's, or
having to convert things over to FreeBSD idioms

Reviewed by: brooks
Phabric: D993
Sponsored by: EMC / Isilon Storage Division
2014-10-22 21:04:54 +00:00
Warner Losh
b55e8e6e0d My previous commit exposed an issue as it fixed a different
issue. lib/atf isn't a prereq_lib, since it isn't required for other
libraries to build. Remove it. The old kludge of always building it
had effectively been retired. Since we don't want to build the
libraries with the tests when we're bootstrapping, invent
MK_TESTS_SUPPORT which normally defaults to the current MK_TESTS
value, except when explicitly defined. Make lib/atf depend on it being
yes. When building the libraries set MK_TESTS to no, and
MK_TESTS_SUPPORT to the current value of MK_TESTS so that later stages
of the build work correctly. This should fix (and does for me)
people's issues with parallel builds racing between lib/atf and
libexec/atf. Since lib/atf is built during the libraries phase, the
race disappears.
2014-10-22 03:39:11 +00:00
Baptiste Daroussin
aa7703be9c When using an external gcc 4.8+ and not building libstdc++ then create in the objectdir a
fake libstdc++.so and libstdc++.a which is a symlink on libc++ that allow g++ to satisfy
its links dependencies in the least hackish way.
Please note that this hacky libstds++ never get installed on the final system

Reviewed by:	imp
2014-10-21 20:04:05 +00:00
Baptiste Daroussin
726f4cd580 Add support for __cxa_throw_bad_array_new_length in libcxxrt
It is required for use with newer g++49

Differential Revision:	https://reviews.freebsd.org/D982
Reviewed by:	theraven
Approved by:	theraven
MFC after:	3 weeks
2014-10-21 10:19:45 +00:00
Andrew Turner
58c47a70a3 Allow libkvm to get the kernel va to pa delta without the need for
physaddr. This should allow for a kernel where PHYSADDR and KERNPHYSADDR
are both undefined.

For now libkvm will use the old method of reading physaddr and kernaddr
to allow it to work with old kernels. This could be removed in the future
when enough time has passed.

Differential Revision:	https://reviews.freebsd.org/D939
MFC after:	1 week
2014-10-19 20:23:31 +00:00
Adrian Chadd
e77f9fed15 Update the ULE scheduler + thread and kinfo structs to use int for cpuid
rather than u_char.

To try and play nice with the ABI, the u_char CPU ID values are clamped
at 254.  The new fields now contain the full CPU ID, or -1 for no cpu.

Differential Revision:	D955
Reviewed by:	jhb, kib
Sponsored by:	Norse Corp, Inc.
2014-10-18 19:36:11 +00:00
Xin LI
d427f43c25 Remove duplicated code.
Suggested by:	jmg
2014-10-16 22:04:07 +00:00
Andrew Turner
89184254a4 Fix the type of pte_pa as when it is passed into _kvm_pa2off it is either
a uint64_t or a pointer to an off_t. With it being a u_long can result in
incorrect values being returned.
2014-10-16 13:49:54 +00:00
Gavin Atkinson
ff8d5270bc Slightly improve grammar in EAGAIN description.
PR:		176806
Submitted by:	Jeremy Chadwick
MFC after:	3 days
2014-10-15 23:39:47 +00:00
Dag-Erling Smørgrav
767207650c As pointed out by several people, r273114 was incorrect: it unconditionally
disabled everything except TLS 1.0.  Replace it with a more carefully
wrought patch:

 - Switch the default for SSLv3 from on to off
 - Add environment variables to control TLS 1.1 and 1.2
 - In verbose mode, report which version is used
 - Update the man page to reflect these changes.

MFC after:	1 week
2014-10-15 07:35:50 +00:00
Dag-Erling Smørgrav
d75ca0c1fd Drop support for SSLv3.
MFC after:	1 week
2014-10-15 02:34:26 +00:00
Andrew Turner
cb8bcafa71 Add support for the __aeabi_c*cmp* functions. These are similar to the
existing functions with the exception they use the condition flags to
store the result.

Differential Revision:	https://reviews.freebsd.org/D872
Silence from:	current@ and numerics@
MFC after:	1 week
2014-10-14 14:27:51 +00:00
Xin LI
f972197651 Promote libevent to lib/ level and fold ftp-proxy into its parent Makefile.
This allows us to use libevent for other application in the future.

For now libevent is still INTERNALLIB and no shared library is installed.

MFC after:	1 month
2014-10-13 22:15:26 +00:00
Hans Petter Selasky
fc6e35c65c Fix compiler locking diagnostic warnings.
PR:	194289
2014-10-13 19:05:18 +00:00
Xin LI
b888b86e6f accept(2) may and can return EAGAIN, document it.
MFC after:	1 week
2014-10-10 03:05:55 +00:00
Ed Maste
a6897b9320 Update dl_iterate_phdr(3) to follow r272842
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
2014-10-09 22:58:33 +00:00
Steve Kargl
a4e4b355f4 The value small=2**-(p+3), where p is the precision, can be determine from
lgamma(x) = -log(x) - log(1+x) + x*(1-g) + x**2*P(x) with g = 0.57...
being the Euler constant and P(x) a polynomial.  Substitution of small
into the RHS shows that the last 3 terms are negligible in comparison to
the leading term.  The choice of 3 may be conservative.

The value large=2**(p+3) is detemined from Stirling's approximation
lgamma(x) = x*(log(x)-1) - log(x)/2 + log(2*pi)/2 + P(1/x)/x
Again, substitution of large into the RHS reveals the last 3 terms
are negligible in comparison to the leading term.

Move the x=+-0 special case into the |x|<small block.

In the ld80 and ld128 implementaion, use fdlibm compatible comparisons
involving ix, lx, and llx.  This replaces several floating point
comparisons (some involving fabsl()) and also fixes the special cases
x=1 and x=2.

While here
  . Remove unnecessary parentheses.
  . Fix/improve comments due to the above changes.
  . Fix nearby whitespace.

* src/e_lgamma_r.c:
  . Sort declaration.
  . Remove unneeded explicit cast for type conversion.
  . Replace a double literal constant by an integer literal constant.

* src/e_lgammaf_r.c:
  . Sort declaration.

* ld128/e_lgammal_r.c:
  . Replace a long double literal constant by a double literal constant.

* ld80/e_lgammal_r.c:
  . Remove unused '#include float.h'
  . Replace a long double literal constant by a double literal constant.

Requested by:	bde
2014-10-09 22:39:52 +00:00
Pawel Jakub Dawidek
8018334b70 Fix problem on big endian systems introduced in r271579 - when we were
returning from handling a nested nvlist we were resetting big-endian flag.

Reported by:	Kuleshov Aleksey @ yandex.ru
Tested by:	Kuleshov Aleksey @ yandex.ru
2014-10-09 20:55:05 +00:00
Dag-Erling Smørgrav
e4978d34f2 Change the hardcoded default back from SHA512 to DES.
PR:		192277
MFC after:	3 days
2014-10-09 16:45:11 +00:00
Andrey A. Chernov
097c578c1e 1) Fix the case we have less arguments for format string than we expected.
2) Return error on unsupported format specs.
(both according to POSIX)

PR:     93197
2014-10-07 06:34:05 +00:00
Andrey A. Chernov
e15d3f3c09 Back out timegm error check from r272562.
POSIX treats negative time_t as undefined (i.e. may be valid too,
depends on system's policy we don't have) and we don't set EOVERFLOW
in mktime/timegm as POSIX requires to surely distinguish -1 return
as valid negative time from -1 as error return.
2014-10-07 06:02:08 +00:00
Xin LI
af1360206c Add MLINK for explicit_bzero(3) and bump .Dd date.
MFC after:	2 weeks
2014-10-07 04:59:11 +00:00
Xin LI
78b59024b5 Add explicit_bzero(3) and its kernel counterpart.
Obtained from:	OpenBSD
MFC after:	2 weeks
2014-10-07 04:54:11 +00:00
Luigi Rizzo
86f82ef946 Add netmap support to libpcap. Tcpdump and other native pcap application can now
run directly on netmap ports using netmap:foo or valeXX:YY device names.
Modifications to existing code are small and trivial, the netmap-specific
code is all in a new file.

Please be aware that in netmap mode the physical interface is disconnected from
the host stack, so libpcap will steal the traffic not just make a copy.

For the full version of the code (including linux and autotools support) see
	https://code.google.com/p/netmap-libpcap/

MFC after:	3 days
2014-10-06 15:48:28 +00:00
Andrey A. Chernov
420bc6cee4 1) For %Z format, understand "UTC" name too.
2) Return NULL if timegm() fails, because it means we can convert
what we have in GMT to local time needed.
2014-10-05 07:29:50 +00:00
Pedro F. Giffuni
79ec4cf466 Minor doc format fix.
Submitted by:	Yonghyeon PYUN
2014-10-04 18:00:15 +00:00
Mark Johnston
ec04549052 Remove an incorrect and useless debug print.
X-MFC-With:	r272488
2014-10-04 02:34:30 +00:00
Mark Johnston
41da933c87 Hook up support for userland CTF support in DTrace. This required some
modifications to libproc to support fetching the CTF info for a given file.

With this change, dtrace(1) is able to resolve type info for function and
USDT probe arguments, and function return values. In particular, the args[n]
syntax should now work for referencing arguments of userland probes,
provided that the requisite CTF info is available.

The uctf tests pass if the test programs are compiled with CTF info. The
current infrastructure around the DTrace test suite doesn't support this
yet.

Differential Revision:	https://reviews.freebsd.org/D891
MFC after:		1 month
Relnotes:		yes
Sponsored by:		EMC / Isilon Storage Division
2014-10-03 23:20:37 +00:00
Steve Kargl
3fbe079a34 Remove whitespace and 2 blank lines. 2014-10-02 23:08:36 +00:00
Pedro F. Giffuni
27d6eee170 strptime(3): Update manpage for %U and %W.
%U and %W were implemented as part of r272273 so take them
out of the BUGS section and mention them in the SYNOPSIS.

MFC after:	1 month
2014-10-02 18:52:29 +00:00
Pedro F. Giffuni
eff6f4441a strptime: %s format fix.
Almost never needed in real life because %s is tends to be
only one format spec.
1) Return code of gmtime_r() is checked.
2) All flags are set.

Submitted by:	ache
MFC after:	3 weeks
2014-10-02 18:33:58 +00:00
Pedro F. Giffuni
1a6804c649 strptime: fix bug introduced in r272273.
Reported by:	portmgr (antoine)
Fix by:		Andrey Chernov, David Carlier
PR:		137307 (follow up)
2014-10-01 22:18:07 +00:00
Andrew Turner
eabf853d8d Clean up detection of hard-float ABIs. As with big-endian in r272368 we
can check against arm*hf*.
2014-10-01 16:08:19 +00:00
Baptiste Daroussin
ad9bbe9854 Ensure that every ENTRY(foo) has a matching END(foo).
It allows to build with newer binutils

Differential Revision:	https://reviews.freebsd.org/D877
Reviewed by:	jhibbits
2014-10-01 15:00:21 +00:00
Andrew Turner
3dde11c478 Fix the TARGET_ABI value clang uses. It shpuld be gnueabi on all ARM
soft-float architectures, and gnueabihf for hard-float.
2014-10-01 12:47:25 +00:00
Andrew Turner
6d4766c1b8 Remove MK_ARM_EABI, the armeb issues have been fixed. The code to support
the oabi is still in the tree, but it is expected this will be removed
as developers work on surrounding code.

With this commit the ARM EABI is the only supported supported ABI by
FreeBSD on ARMa 32-bit processors.

X-MFC after:	never
Relnotes:	yes
Differential Revision: https://reviews.freebsd.org/D876
2014-10-01 08:26:51 +00:00
Dag-Erling Smørgrav
1628e293fd Consistently cast tty and user to const char * in printf()-like contexts. 2014-10-01 07:15:02 +00:00
Bryan Drewery
c1efb88730 Document [EPERM] for UNIX sockets.
MFC after:	2 weeks
2014-09-30 00:06:53 +00:00
Bjoern A. Zeeb
5e24ef8793 Hopefully fix build breakage with gcc passing void * instead of char *
to "%s" format string after r272280.

PR:		83099 193927
MFC after:	3 days
X-MFC with:	r272280
2014-09-29 10:36:14 +00:00
Dag-Erling Smørgrav
4c37ae3065 Instead of failing when neither PAM_TTY nor PAM_RHOST are available, call
login_access() with "**unknown**" as the second argument.  This will allow
"ALL" rules to match.

Reported by:	Tim Daneliuk <tundra@tundraware.com>
Tested by:	dim@
PR:		83099 193927
MFC after:	3 days
2014-09-29 08:57:36 +00:00
Pedro F. Giffuni
2e46558755 Add strptime(3) support for %U and %W (take 2)
Add support for the missing POSIX-2001 %U and %W features: the
existing FreeBSD strptime code recognizes both directives and
validates that the week number lies in the permitted range,
but then simply discards the value.

Initial support for the feature was written by Paul Green.
David Carlier added the initial handling of tm_wday/tm_yday.
Major credit goes to Andrey Chernov for detecting much of the
brokenness, and rewriting/cleaning most of the code, making it
much more robust.

Tested independently with the strptime test from the GNU C
library.

PR:		137307
MFC after:	1 month
Relnotes:	yes
2014-09-28 21:20:20 +00:00
Sergey Kandaurov
663222b9f6 Fix description of mutex acquisition.
Reviewed by:	kib
X-MFC with:	r272070
Sponsored by:	Nginx, Inc.
2014-09-26 04:33:27 +00:00
Pedro F. Giffuni
c1cd488caf Revert r272122
The patch still needs to be more robust and it broke the
build on MIPS so revert it for now while all the issues
are fixed.

Reported by:	ache, davide
PR:		137307
2014-09-25 23:04:37 +00:00
Steve Kargl
dde47d8bbc * Whitespace. 2014-09-25 22:15:10 +00:00
Mark Johnston
540cc663b1 Factor out some of the duplicated code in the symbol lookup functions, in
preparation for adding userland CTF support to DTrace.

MFC after:	1 month
Sponsored by:	EMC / Isilon Storage Division
2014-09-25 19:08:06 +00:00
Pedro F. Giffuni
ce1d331eee Add strptime(3) support for %U and %W
Add support for the missing POSIX-2001 %U and %W features: the
existing  FreeBSD strptime code recognizes both directives and
validates that the week number lies in the permitted range,
but then simply discards the value.

Initial support for the feature was written by Paul Green with
important fixes by Andrey Chernov. Additional support for
handling tm_wday/tm_yday was written by David Carlier.

PR:		137307
MFC after:	1 month
2014-09-25 18:52:17 +00:00
Pawel Jakub Dawidek
19a5e7fede Document the new nvlist_get_parent() function.
Submitted by:	Mariusz Zaborski
2014-09-25 10:59:01 +00:00
Konstantin Belousov
2f02abc196 Expand the libthr(3) manpage to document knobs accepted by libthr.so
and explain some internal working of the library, neccessary to
understand the knobs effects.

Reviewed by:	bjk, pluknet
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2014-09-24 12:41:39 +00:00
Konstantin Belousov
36bcb07ab5 Switch the defaults to not split the RLIMIT_STACK-sized initial thread
stack into the stacks of the created threads.  Add knob
LIBPTHREAD_SPLITSTACK_MAIN to restore the older behaviour.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2014-09-24 12:39:12 +00:00
Mark Johnston
9351ac6d69 Add some ATF tests for libproc.
Differential Revision:	D710
Reviewed by:	jmmv, ngie, rpaulo
2014-09-21 21:25:41 +00:00
Pawel Jakub Dawidek
d3c24fcffe Don't use nvl in case of a failure.
Reported by:	Coverity
CID:		1238922
2014-09-18 22:34:52 +00:00
Will Andrews
ce2dea2a6a Fix incremental builds involving non-root users with read-only source files.
This is a followup commit to r271771.

MFC after:	1 month
2014-09-18 14:54:20 +00:00
Will Andrews
76479f1d3f Fix incremental builds involving non-root users with read-only source files.
Makefiles should not assume that source files can be overwritten.  This is the
common case for Perforce source trees.

This is a followup commit to r211243 in the same vein.

MFC after:	1 month
Sponsored by:	Spectra Logic
MFSpectraBSD:	r1036319 on 2014/01/29, r1046711 on 2014/03/06
2014-09-18 14:41:57 +00:00
Bryan Drewery
7eccb93c02 Explicitly set MAP_PRIVATE to avoid [EINVAL] after r271635.
X-MFC-With:	r271635
Reviewed by:	jhb
2014-09-17 20:26:27 +00:00
John Baldwin
7a9f047ba7 - Remove mention of MAP_INHERIT. It hasn't been implemented for thirteen
years.
- Remove mention of unimplemented MAP_SWAP.  There are no future plans to
  implement it.

Submitted by:	alc (2)
2014-09-17 19:45:34 +00:00
John Baldwin
2c2cd2c14c Explicitly specify MAP_SHARED when mapping the stats file descriptor.
Reviewed by:	kib
MFC after:	1 week
2014-09-17 19:37:58 +00:00
Steve Kargl
f382031d34 For targets that have a signed zero, lgamma_r(-0, &signgamp) should
set signgamp = -1.

Submitted by:	enh at google dot com (e_lgamma[f]_r.c)
2014-09-17 19:01:22 +00:00
Enji Cooper
2bcdab32c3 Bump .Dd for the content change done to access(2) in r271655
PR: 181155
Sponsored by: EMC / Isilon Storage Division
2014-09-16 00:59:08 +00:00
Enji Cooper
257597a434 Validate the mode argument in access, eaccess, and faccessat for optional
POSIX compliance and to improve compatibility with Linux and NetBSD

The issue was identified with lib/libc/sys/t_access:access_inval from
NetBSD

Update the manpage accordingly

PR: 181155
Reviewed by: jilles (code), jmmv (code), wblock (manpage), wollman (code)
MFC after: 4 weeks
Phabric: D678 (code), D786 (manpage)
Sponsored by: EMC / Isilon Storage Division
2014-09-16 00:56:47 +00:00
Steve Kargl
f7efd14df1 * Makefile:
. Hook e_lgammal[_r].c to the build.
  . Create man page links for lgammal[-r].3.

* Symbol.map:
  . Sort lgammal to its rightful place.
  . Add FBSD_1.4 section for the new lgamal_r symbol.

* ld128/e_lgammal_r.c:
  . 128-bit implementataion of lgammal_r().

* ld80/e_lgammal_r.c:
  . Intel 80-bit format implementation of lgammal_r().

* src/e_lgamma.c:
  . Expose lgammal as a weak reference to lgamma for platforms
    where long double is mapped to double.

* src/e_lgamma_r.c:
  . Use integer literal constants instead of real literal constants.
    Let compiler(s) do the job of conversion to the appropriate type.
  . Expose lgammal_r as a weak reference to lgamma_r for platforms
    where long double is mapped to double.

* src/e_lgammaf_r.c:
  . Fixed the Cygnus Support conversion of e_lgamma_r.c to float.
    This includes the generation of new polynomial and rational
    approximations with fewer terms.  For each approximation, include
    a comment on an estimate of the accuracy over the relevant domain.
  . Use integer literal constants instead of real literal constants.
    Let compiler(s) do the job of conversion to the appropriate type.
    This allows the removal of several explicit casts of double values
    to float.

* src/e_lgammal.c:
  . Wrapper for lgammal() about lgammal_r().

* src/imprecise.c:
  . Remove the lgamma.

* src/math.h:
  . Add a prototype for lgammal_r().

* man/lgamma.3:
  . Document the new functions.

Reviewed by:	bde
2014-09-15 23:21:57 +00:00
John-Mark Gurney
e2cc4003e2 document mqueuefs is required for mq_open... 2014-09-15 22:32:35 +00:00
John Baldwin
5fd3f8b3b6 Add stricter checking of some mmap() arguments:
- Fail with EINVAL if an invalid protection mask is passed to mmap().
- Fail with EINVAL if an unknown flag is passed to mmap().
- Fail with EINVAL if both MAP_PRIVATE and MAP_SHARED are passed to mmap().
- Require one of either MAP_PRIVATE or MAP_SHARED for non-anonymous
  mappings.

Reviewed by:	alc, kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D698
2014-09-15 17:20:13 +00:00
Dag-Erling Smørgrav
d64f404488 Upgrade to OpenPAM Ourouparia. 2014-09-15 13:40:09 +00:00
Dag-Erling Smørgrav
4c1d902bb2 r271256 fixed one segfault condition but introduced another due to the
wrong operator being used in the tty check.

Reported by:	avg@
MFH:		3 days
2014-09-15 11:32:08 +00:00
Dag-Erling Smørgrav
adf180b55c Vendor import of OpenPAM Ourouparia. 2014-09-15 09:40:30 +00:00
Pawel Jakub Dawidek
4c2f60df45 Use non-recursive algorithm for traversing nvlists. This also removes
the limit on number of nested nvlists.

Submitted by:	Mariusz Zaborski
2014-09-14 09:30:09 +00:00
Pawel Jakub Dawidek
586c5854a5 Remove the limit on descriptors that can be send in one nvlist.
Submitted by:	Mariusz Zaborski
2014-09-14 09:27:12 +00:00
Joel Dahl
cfaa96f327 Minor mdoc nit. 2014-09-09 14:34:54 +00:00
Dag-Erling Smørgrav
067268edfc Fail rather than segfault if neither PAM_TTY nor PAM_RHOST is set.
PR:		83099
MFC after:	3 days
2014-09-08 09:19:01 +00:00
Enji Cooper
1f771f4603 Include src.opts.mk after SHLIBDIR has been defined so libnv is installed to
/lib , not /usr/lib

MFC after: 3 days
Approved by: rpaulo (mentor)
Submitted by: antoine
Pointyhat to: me
Phabric: D739
2014-09-07 22:56:57 +00:00
Andrew Turner
954c837259 Add the fp{get,set}{mask,round} functions to the public symbols in the map.
These are only exported for armv6hf as the soft-float ABIs have these in
the softfloat Symbol.map file.
2014-09-05 18:11:36 +00:00
Steve Kargl
e85326216f Remove an initialized, but otherwise, unused variable. 2014-09-04 23:50:05 +00:00
Pedro F. Giffuni
9908eab82e libc/locale: Remove a wrong comma.
This only had some effect when debugging.

Obtained from:	DragonflyBSD
MFC after:	3 days
2014-09-04 17:36:21 +00:00
Benno Rice
39a8d9f3f0 Systems with lots of geom providers can end up with a kern.geom.confxml
value too large for the buffer allocated. Work around this by retrying
a few times with larger buffer sizes.

Submitted by:	Scott Ferris <scott.ferris@isilon.com>
Reviewed by:	mlaier, ngie
Sponsored by:	EMC Isilon Storage Division
2014-09-04 03:31:48 +00:00
John Baldwin
c3d1e48a6b Always seek back to the beginning of a regular directory, even if the
previous seek location was 0.  Without this, readdir() would see
dd_loc of zero and call getdirentries() which would start reading
entries at the current seek location of the directory ignoring the
first batch of entries.  Also, rewinddir() should always seek so that
it reads the directory from the beginning to get updated entries.

PR:		192935
Reported by:	iron@mail.ua
MFC after:	3 days
2014-09-03 19:01:34 +00:00
Pawel Jakub Dawidek
51d915e0d1 Use better type for i. 2014-09-03 15:08:33 +00:00
Pawel Jakub Dawidek
04cbbf596c Declare i.
Reported by:	sbruno
2014-09-03 15:06:47 +00:00
Pawel Jakub Dawidek
c7bf0f5006 Fix descriptors leak in case of nvlist_xunpack() failure.
Submitted by:	Mariusz Zaborski <oshogbo@FreeBSD.org>
2014-09-03 14:44:23 +00:00
Rui Paulo
585bf8ae67 Fix typo in a comment. 2014-09-02 18:21:19 +00:00
Pedro F. Giffuni
f4189cd649 Add bsearch_b to the libc map and the stdlib header.
bsearch_b is the Apple blocks enabled version of bsearch(3).
This was added to libc in Revision 264042 but the commit
missed the declaration required to make use of it.

While here move some other block-related functions to the
BSD_VISIBLE block as these are non-standard.

Phabric:	D638
Reviewed by:	theraven, wollman
2014-09-01 22:25:42 +00:00
Ed Schouten
8da5129816 Add lock annotations to libcuse.
- Add annotations to the lock/unlock function to indicate that the
  function is allowed to lock and unlock the underlying pthread mutex.

- Add __guarded_by() annotations to the global variables.

Approved by:	hselasky@
2014-09-01 19:56:28 +00:00
Steve Kargl
733331540a According to the ISO C standard, lgamma(-integer) returns
inf and raises the divided-by-zero exception.  Compilers
constant fold one/zero to inf but do not raise the exception.
Introduce a volatile vzero to prevent the constant folding.

Move the declaration of zero into the main declaration block.

While here, fix a nearby disordering of 'lx,ix'

Discussed with:	bde
2014-09-01 18:57:13 +00:00
Ed Schouten
49891e45d2 Add lock annotations to the header files of our threading libraries.
This change extends all of the functions present in the <pthread.h> and
<threads.h> headers to have lock annotations. This will allow Clang to
warn about the following:

- Locking a function twice,
- Unlocking a function without a mutex being locked,
- Forgetting to unlock a mutex before returning,
- Destroying or reinitializing a mutex that is currenty locked,
- Using an unlocked mutex in combination with a condition variable.

Enabling these annotations already allowed me to catch a bug in one of
our userspace tools (r270749).
2014-09-01 18:34:30 +00:00
Steve Kargl
e63062b5bf Fix a tab that somehow became 8 spaces.
Remove parentheses in a return statement to be consistent with the
rest of the file.

Rename sin_pi() in the float version to sin_pif().

Remove large comment that precedes sin_pif().  The comment
duplicates a comment in e_lgamma_r.c where the algorithm
is documented.

Requested by:	bde
2014-09-01 16:24:25 +00:00
Steve Kargl
795b92049d Compute sin(pi*x) without actually doing the pi*x multiplication.
sin_pi(x) is only called for x < 0 and |x| < 2**(p-1) where p is
the precision of x.  The new argument reduction is an optimization
compared to the old code, and it removes a chunk of dead code.
Accuracy tests in the intervals (-21,-20), (-20,-19), ... (-1,0)
show no differences between the old and new code.

Obtained from:	bde
2014-08-31 21:38:03 +00:00
Ian Lepore
f2e71517e0 In ARM asm code, ensure that every ENTRY(foo) has a matching END(foo).
The EABI unwind info requires a .fnend for every .fnstart, and newer
binutils will complain about seeing two .fnstart in a row.  This change
allows newer tools to compile our code.

Reported by:	bapt
Reviewed by:	imp
2014-08-31 17:21:51 +00:00
Steve Kargl
53c7f22849 Fix the order of "const volatile" to be consistent with
the rest of msun.
2014-08-30 17:31:53 +00:00
Steve Kargl
79c2e69a3f Make tiny volatile to prevent the compiler(s) from
constant folding expressions of the form "1 - tiny",
which are used to raise FE_INEXACT.
2014-08-30 17:14:47 +00:00
Roman Divacky
c71728dfaf The standard we compile libc++ with is called c++11 not c++0x. 2014-08-25 08:40:36 +00:00
Enji Cooper
3303bfc042 Fix "make checkdpadd" for lib/libc when MK_SSP != no
Add LIBSSP_NONSHARED to bsd.libnames.mk and append LIBSSP_NONSHARED to DPADD in
lib/libc when MK_SSP != no

Approved by: rpaulo (mentor)
MFC after: 3 days
Phabric: D675 (as part of a larger diff)
PR: 192728
2014-08-25 06:10:03 +00:00
Mark Johnston
24a08d303e Fix a bug in r265255: only return NULL if the requested map wasn't found.
Submitted by:	Luke Chang-Hsien Tsai <luke.tw@gmail.com>
MFC after:	1 week
2014-08-24 17:02:27 +00:00
Pedro F. Giffuni
6804aa1b68 Add missing break.
CID:	603368
2014-08-20 14:58:25 +00:00
Bryan Drewery
6855730b5c Use bsd.lib.mk here as all other csu Makefiles do.
This effectively reverts r124752.

There's no reason this should be different. It resulted in needing NO_PIE in
the original opt-out NO_PIE commit as this was not using the proper framework.

Reported by:	peter
2014-08-19 15:30:56 +00:00
Bryan Drewery
5608fd23c2 Revert r267233 for now. PIE support needs to be reworked.
1. 50+% of NO_PIE use is fixed by adding -fPIC to INTERNALLIB and other
   build-only utility libraries.
2. Another 40% is fixed by generating _pic.a variants of various libraries.
3. Some of the NO_PIE use is a bit absurd as it is disabling PIE (and ASLR)
   where it never would work anyhow, such as csu or loader. This suggests
   there may be better ways of adding support to the tree. Many of these
   cases can be fixed such that -fPIE will work but there is really no
   reason to have it in those cases.
4. Some of the uses are working around hacks done to some Makefiles that are
   really building libraries but have been using bsd.prog.mk because the code
   is cleaner. Had they been using bsd.lib.mk then NO_PIE would not have
   been needed.

We likely do want to enable PIE by default (opt-out) for non-tree consumers
(such as ports). For in-tree though we probably want to only enable PIE
(opt-in) for common attack targets such as remote service daemons and setuid
utilities. This is also a great performance compromise since ASLR is expected
to reduce performance. As such it does not make sense to enable it in all
utilities such as ls(1) that have little benefit to having it enabled.

Reported by:	kib
2014-08-19 15:04:32 +00:00
Enji Cooper
50671e8b4f Replace DPADD with DPSRCS to fix "make checkdpadd"
Phabric: D625
Approved by: jmmv (mentor)
Reviewed by: dim
PR: 192734
MFC after: 2 weeks
2014-08-18 17:38:50 +00:00
Enji Cooper
4207570add Add LIBCRYPT to DPADD, remove LDFLAGS from LDADD, and sort the Makefile variables
This fixes "make checkdpadd"

Phabric: D620
Approved by: jmmv (mentor)
PR: 192729
MFC after: 5 days
2014-08-18 17:35:39 +00:00
Hans Petter Selasky
1dfd04f70c Add more USB class codes.
Obtained from:	libusb project at SourceForge
MFC after:	1 week
2014-08-18 14:23:07 +00:00
Enji Cooper
46e6d5b7bf Fix typo in lib/atf/libatfc++/Makefile
LIBATFC should be LIBATF_C; this was missed in the initial import
(r241823)

PR: 192731
MFC after: 3 days
Phabric: D619
Approved by: rpaulo (mentor)
2014-08-17 23:30:45 +00:00
Hans Petter Selasky
f0f8856f68 Add missing DPADD to Makefile.
PR:	192733
2014-08-17 06:28:57 +00:00
Andrey A. Chernov
c8c5946a57 Bump version because challenge buffer size changed
MFC after:      1 week
2014-08-14 04:42:09 +00:00
Warner Losh
161fedb9cc From https://sourceware.org/ml/newlib/2014/msg00113.html
By Richard Earnshaw at ARM
>
>GCC has for a number of years provides a set of pre-defined macros for
>use with determining the ISA and features of the target during
>pre-processing.  However, the design was always somewhat cumbersome in
>that each new architecture revision created a new define and then
>removed the previous one.  This meant that it was necessary to keep
>updating the support code simply to recognise a new architecture being
>added.
>
>The ACLE specification (ARM C Language Extentions)
>(http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.set.swdev/index.html)
>provides a much more suitable interface and GCC has supported this
>since gcc-4.8.
>
>This patch makes use of the ACLE pre-defines to map to the internal
>feature definitions.  To support older versions of GCC a compatibility
>header is provided that maps the traditional pre-defines onto the new
>ACLE ones.

Stop using __FreeBSD_ARCH_armv6__ and switch to __ARM_ARCH >= 6 in the
couple of places in tree. clang already implements ACLE. Add a define
that says we implement version 1.1, even though the implementation
isn't quite complete.
2014-08-14 04:20:13 +00:00
Dimitry Andric
e60e641729 Stop telling people to directly report llvm or clang bugs upstream,
point them to the FreeBSD bug tracker instead, since we use our own
patches.

MFC after:	3 days
2014-08-13 21:38:29 +00:00
Michael Tuexen
f0396ad15e Add support for the SCTP_PR_STREAM_STATUS and SCTP_PR_ASSOC_STATUS
socket options. This includes managing the correspoing stat counters.
Add the SCTP_DETAILED_STR_STATS kernel option to control per policy
counters on every stream. The default is off and only an aggregated
counter is available. This is sufficient for the RTCWeb usecase.

MFC after: 1 week
2014-08-13 15:50:16 +00:00
Sergey Kandaurov
196d2103e6 Fixed ENOMEM description.
MFC after:	1 week
Sponsored by:	Nginx, Inc.
2014-08-13 14:49:51 +00:00
Konstantin Belousov
6c8ce3bfce Add a knob LIBPTHREAD_BIGSTACK_MAIN, which instructs libthr to leave
the whole RLIMIT_STACK-sized region of the kernel-allocated stack as
the stack of main thread.

By default, the main thread stack is clamped at 2MB (4MB on 64bit
ABIs) and the rest is used for other threads stack allocation.  Since
there is no programmatic way to adjust the size of the main thread
stack, pthread_attr_setstacksize() is too late, the knob allows user
to manage the main stack size both for single-threaded and
multi-threaded processes with the rlimit.

Reported by:	"Ivan A. Kosarev" <ivan@ivan-labs.com>
Tested by:	dim
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2014-08-13 05:53:41 +00:00
Konstantin Belousov
f6abec6c64 Style.
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2014-08-13 05:47:49 +00:00
Enji Cooper
5aa45fcb67 Integrate lib/libutil into the build/kyua
Remove the .t wrappers

Rename all of the TAP test applications from test-<test> to
<test>_test to match the convention described in the TestSuite
wiki page

humanize_number_test.c:

- Fix -Wformat warnings with counter variables
- Fix minor style(9) issues:
-- Header sorting
-- Variable declaration alignment/sorting in main(..)
-- Fit the lines in <80 columns
- Fix an off by one index error in the testcase output [*]
- Remove unnecessary `extern char * optarg;` (this is already provided by
  unistd.h)

Phabric: D555
Approved by: jmmv (mentor)
MFC after: 2 weeks
Obtained from: EMC / Isilon Storage Division [*]
Submitted by: Casey Peel <cpeel@isilon.com> [*]
Sponsored by: EMC / Isilon Storage Division
2014-08-13 04:56:27 +00:00
Pedro F. Giffuni
ef01caf5cb Minor style tweaks.
Obtained from:	OpenBSD (CVS rev. 1.7)
MFC after:	3 days
2014-08-13 03:44:30 +00:00
Andrey A. Chernov
412d134acc According to opie code and even direct mention in opie(4) challenge buffer
size must be OPIE_CHALLENGE_MAX + 1, not OPIE_CHALLENGE_MAX

Reviewed by:    des
MFC after:      1 week
2014-08-12 13:28:46 +00:00
Hajimu UMEMOTO
c397297cfe Fix broken pointer overflow check ns_name_unpack()
Many compilers may optimize away the overflow check `msg + l < msg',
where `msg' is a pointer and `l' is an integer, because pointer
overflow is undefined behavior in C.

Use a safe precondition test `l >= eom - msg' instead.

Reference:
https://android-review.googlesource.com/#/c/50570/

Requested by:	pfg
Obtained from:	NetBSD (CVS rev. 1.10)
2014-08-12 13:09:32 +00:00
Hajimu UMEMOTO
e45764721a Update our stub resolver to final version of libbind.
Obtained from:	ISC
2014-08-12 12:36:06 +00:00
Hajimu UMEMOTO
6f79a95b36 Bring the md5 functions into libc for internal use only.
It is required to support ID randomization for our stub
resolver.
2014-08-12 12:25:56 +00:00
Michael Tuexen
c79bec9c75 Add support for the SCTP_AUTH_SUPPORTED and SCTP_ASCONF_SUPPORTED
socket options. Add also a sysctl to control the support of ASCONF.

MFC after: 1 week
2014-08-12 11:30:16 +00:00
Hajimu UMEMOTO
08d41c70c1 We don't use these files. 2014-08-10 15:21:26 +00:00
Steve Kargl
55ad7cd740 When r255294 was committed, it exposed the symbols lgammal, powl,
and tgammal in libm.  These functions are part of ISO/IEC 9899:1999
and their prototypes should have been moved into the appropriate
__ISO_C_VISIBLE >= 1999 section.  After moving the prototypes,
remnants of r236148 can be removed.

PR:		standards/191754
Reviewed by:	bde
2014-08-09 15:53:40 +00:00
Dimitry Andric
96ec3cdd8e In r268463, I misplaced a return in demangle(), causing the function to
erroneously skip symbols that were not mangled at all.  Fix this by
moving the return into the preceding if block.

While here, simplify the code by letting __cxa_demangle() allocate the
needed space for the demangled symbol.  This also fixes a memory leak,
which would occur whenever __cxa_demangle() failed.

Reported by:	pgj
MFC after:	3 days
2014-08-09 12:25:06 +00:00
Pedro F. Giffuni
905dd80f80 Const-ify character string
Obtained from:  Apple Inc. (Libc 997.90.3)
MFC after:	3 days
2014-08-07 22:14:37 +00:00
Pedro F. Giffuni
a46361116a Fix broken pointer overflow check ns_name_unpack()
Many compilers may optimize away the overflow check `msg + l < msg',
where `msg' is a pointer and `l' is an integer, because pointer
overflow is undefined behavior in C.

Use a safe precondition test `l >= eom - msg' instead.

Reference:
https://android-review.googlesource.com/#/c/50570/

Obtained from:	NetBSD (CVS rev. 1.10)
MFC after:	3 weeks
2014-08-07 16:40:24 +00:00
Baptiste Daroussin
e806d5088b Make libohash a proper internallib instead of hidding it in m4
mandoc development seems to be also using ohash so prepare to share the code when
needed
2014-08-06 22:46:15 +00:00
Baptiste Daroussin
d029c3aa25 Rework privatelib/internallib
Make sure everything linking to a privatelib and/or an internallib does it directly
from the OBJDIR rather than DESTDIR.
Add src.libnames.mk so bsd.libnames.mk is not polluted by libraries not existsing
in final installation
Introduce the LD* variable which is what ld(1) is expecting (via LDADD) to link to
internal/privatelib
Directly link to the .so in case of private library to avoid having to complexify
LDFLAGS.

Phabric:	https://phabric.freebsd.org/D553
Reviewed by:	imp, emaste
2014-08-06 22:17:26 +00:00
Pedro F. Giffuni
046c3635cd Bring final version of libbind:
From
http://www.isc.org/downloads/libbind/

The libbind functions have been separated from the BIND suite as of BIND
9.6.0. Originally from older versions of BIND, they have been continually
maintained and improved but not installed by default with BIND 9. This
standard resolver library contains the same historical functions and
headers included with many Unix operating systems. In fact, most
implementations are based on the same original code.

At present, NetBSD maintains libbind code, now known as "netresolv".
2014-08-05 23:16:31 +00:00
Enji Cooper
b236bcf168 Integrate lib/libnv into the build/kyua
Rename all of the TAP test applications from <test> to <test>_test
to match the convention described in the TestSuite wiki page

Phabric: D538
Approved by: jmmv (mentor)
Sponsored by: EMC / Isilon Storage Division
2014-08-05 18:41:27 +00:00
Enji Cooper
dfed135e5c Integrate lib/libmp into the build/kyua
- Remove the .t wrapper
- Fix -Wreturn-type warnings with clang

This change has been tested on amd64/i386

Phabric: D530
Reviewed by: jmmv
Approved by: jmmv (co-mentor)
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
2014-08-04 22:10:07 +00:00
John-Mark Gurney
8029eb754a fix misordering...
Obtained from:	gjb
MFC after:	1 week
2014-08-04 21:12:38 +00:00
John-Mark Gurney
9c0b8e489d add xrefs for the other functions...
There should be more text in this page talking about each of these links,
but at least people know about them now...

MFC after:	1 week
2014-08-04 20:58:59 +00:00
Michael Tuexen
317e00ef86 Add support for the SCTP_RECONFIG_SUPPORTED and the corresponding
sysctl controlling the negotiation of the RE-CONFIG extension.

MFC after: 3 days
2014-08-04 20:07:35 +00:00
Michael Tuexen
cb9b8e6f7d Add support for the SCTP_PKTDROP_SUPPORTED socket option and
the corresponding sysctl variable.
The default is off, since the specification is not an RFC yet.

MFC after: 1 week
2014-08-03 18:12:55 +00:00
Michael Tuexen
caea98793f Add SCTP socket option SCTP_NRSACK_SUPPORTED to control the
NRSACK extension. The default will still be off, since it
it not an RFC (yet).
Changing the sysctl name will be in a separate commit.

MFC after: 1 week
2014-08-03 14:10:10 +00:00
Michael Tuexen
dd973b0e15 Add support for the SCTP_PR_SUPPORTED socket option as specified in
http://tools.ietf.org/html/draft-ietf-tsvwg-sctp-prpolicies
Add also a sysctl controlling the default of the end-points.

MFC after: 1 week
2014-08-02 21:36:40 +00:00
Michael Tuexen
f342355a0e Cleanup the ECN configuration handling and provide an SCTP socket
option for controlling ECN on future associations and get the
status on current associations.
A simialar pattern will be used for controlling SCTP extensions in
upcoming commits.
2014-08-02 17:35:13 +00:00
Marcel Moolenaar
e9759f8bd3 Add pkgfs, a file system implementation for reading files out of a
compressed tarball, aka package. The file system assumes that the
files are layed-out in the same order as needed to allow for the
package to be streamed. As such, it does not read an entire package
into memory first.

Some properties of the file system:
o   Files that start with '+' are silently skipped. These are found
    in FreeBSD package files.
o   Files smaller than or equal to 4KB will be cached in memory and
    as such allow for some flexibility in accessing files out of
    order.
o   Files with the .tgz suffix are assumed to be (sub-)packages and
    signal the end for a directory scan.

Obtained from:	Juniper Networks, Inc.
2014-07-31 23:25:13 +00:00
Nick Hibma
500e59c62d Fix the example: free the memory that was allocated by getline(). 2014-07-31 08:28:42 +00:00
Marcel Moolenaar
f2fb1d4531 Provide a means for loaders to control which file system to use. This
to counteract the default behaviour of always trying each and every
file system until one succeeds, or the open fails. The problem with the
loader is that we've implemented features based on this behavior. The
handling of compressed files is a good example of this. However, it is
in general highly undesirable to not have a one-time probe (or taste
in the geom lingo), followed by something similar to a mount whenever
we (first) read from a device. Everytime we go to the same device, we
can reasonably assume it (still) has the same file system. For file
systems that need to do far more that a trivial read of a super block,
not having something similar to a mount operation is disastrous from
a performance (and thus usability) perspective.

But, again, since we've implemented features based on this stateless
approach, things can get complicated quickly if and when we want to
change this. And yet, we sometimes do need stateful behaviour.

For this reason, this change simply introduces exclusive_file_system.
When set to the fsops of the file system to use, the open call will
only try this file system. Setting it to NULL restores the default
behaviour. It's a low-cost (low-brow?) approach to provide enough
control without re-implementing the guts of the loader.

A good example of when this is useful is when we're trying to load
files out of a container (say, a software packaga) that itself lives
on a file system or is fetched over the network. While opening the
container can be done in the normal stateless manner, once it is
opened, subsequent opens should only consider the container.

Obtained from:	Juniper Networks, Inc.
2014-07-30 16:08:16 +00:00
John Baldwin
18ae4fcc47 If telldir() is called immediately after a call to seekdir(), POSIX
requires the return value of telldir() to equal the value passed to
seekdir().  The current seekdir code with SINGLEUSE enabled breaks
this case as each call to telldir() allocates a new cookie.  Instead,
remove the SINGLEUSE code and change telldir() to look for an existing
cookie for the directory's current location rather than always creating
a new cookie.

CR:		https://phabric.freebsd.org/D490
PR:		121656
Reviewed by:	jilles
MFC after:	1 week
2014-07-29 00:16:33 +00:00
George V. Neville-Neil
56e397023c Update the list of cross references to include the more modern set of
processors that we now support.
2014-07-28 10:17:41 +00:00
Pietro Cerutti
adecd05bf0 Unbreak the ABI by reverting r268494 until the compat shims are provided 2014-07-28 07:20:22 +00:00
Dimitry Andric
02b6306fb0 In r232153, libarchive 3.0.3 was imported, replacing the archive_hash.h
header with archive_crypto_private.h, and its ARCHIVE_HASH_xxx macros
were renamed to ARCHIVE_CRYPTO_xxx.

Rename these macros in lib/libarchive/config_freebsd.h, to re-enable the
hashes for libarchive again.  This affects the mtree format writer, and
the xar format reader and writer modules.

This also requires changes in the library order for statically linking
rescue, otherwise ld would complain about redefined symbols.  Thanks to
jkim for pointing out the solution.

Reviewed by:	kientzle
MFC after:	1 week
2014-07-26 15:33:20 +00:00
Pedro F. Giffuni
e66c50c738 strftime() xlocale cleanups.
Replace fprintf_l with fputs when output is unformatted.
Use locale_t in _conv() since it was using sprintf (now sprintf_l)
Use locale_t on _yconv() sinci it calls _conv()

Obtained from:	Apple Inc. (Libc 997.90.3)
CR:		D482
Reviewed by:	theraven
MFC after:	1 week
2014-07-26 14:24:13 +00:00
Andrey A. Chernov
7922e2bb77 In the "Too many open files" edge cases don't try to preserve old
number for non-std* descriptors, but close old file and retry.

Obtained from:  inspired by Apple's change from pfg@
MFC after:      2 weeks
2014-07-26 08:41:03 +00:00
Dag-Erling Smørgrav
3cc381b09f Remove useless getpwnam() call.
Submitted by:	Arthur Mesh <amesh@juniper.net>
MFC after:	1 week
2014-07-26 07:40:31 +00:00
Simon J. Gerraty
5b6dc2efc9 Reviewed by: imp
LDFLAGS is supposed to be given to CC not LD.
Define _LDFLAGS as a filtered version of LDFLAGS safe to give to LD
2014-07-26 04:38:09 +00:00
John Baldwin
0708297e43 POSIX says that passing a location returned by telldir() to seekdir()
after an intervening call to rewinddir() is undefined, so reclaim any
pending telldir() cookies in the directory when rewinddir() is called.

CR:		D459
Reviewed by:	jilles
MFC after:	1 week
2014-07-24 20:44:30 +00:00
Sean Bruno
5f48d8fc26 libstand's qdivrem.c assumes that sizeof(int) == sizeof(long), this is not
true on amd64 I'm not quite positive this is the "correct" solution for
this but it does seem to compile and shut up the spew of warnings when
compiling libstand for userboot.

Add two _Static_asserts() so that in the future somebody will get a compile
failure if an architecture develops that violates the assumptions of this
code. (strongly suggested by jmg)

Change commetns to indicate int types instead of long.  (noted by ian in
phabric review)

Phabric:	https://phabric.freebsd.org/D443
2014-07-24 19:06:15 +00:00
Neel Natu
d37f2adb38 Fix fault injection in bhyve.
The faulting instruction needs to be restarted when the exception handler
is done handling the fault. bhyve now does this correctly by setting
'vmexit[vcpu].inst_length' to zero so the %rip is not advanced.

A minor complication is that the fault injection APIs are used by instruction
emulation code that is shared by vmm.ko and bhyve. Thus the argument that
refers to 'struct vm *' in kernel or 'struct vmctx *' in userspace needs to
be loosely typed as a 'void *'.
2014-07-24 01:38:11 +00:00
Pedro F. Giffuni
abcd8f4535 Fix mismatch.
MFC after:	3 days
2014-07-23 15:12:17 +00:00
Pedro F. Giffuni
1ab5381860 fparseln(3): Update from NetBSD sources.
-fix a condition so that fparseln() doesn't report spurious empty lines
 eg after 2 comment lines, or on EOF after a single comment line
-no escape character means no escaped characters

modify the previous fix so that no pointless realloc()s are done in
the case of multiple empty continuation lines, and comment the code
to make the logics obvious

fparseln is now part of libc in NetBSD so this changes the previous
revision numbering.

Obtained from:	NetBSD (CVS Rev. 1.6-1.7)
MFC after:	2 weeks
2014-07-23 14:57:15 +00:00
Neel Natu
d665d229ce Emulate instructions emitted by OpenBSD/i386 version 5.5:
- CMP REG, r/m
- MOV AX/EAX/RAX, moffset
- MOV moffset, AX/EAX/RAX
- PUSH r/m
2014-07-23 04:28:51 +00:00
Pedro F. Giffuni
86727cc9c6 Avoid possible cast degradation.
For consistency with r268985 for fputs.c, assign iov_len
first, avoiding the cast to uio_resid (int in stdio)
from degrading the value.

We currently don't support lengths higher than INT_MAX so
this change is little more than cosmetic.

MFC after:	3 days
2014-07-22 23:29:54 +00:00
Andrey A. Chernov
ecf84bf00a For "a"-mode files and rewind/fseek + fwrite combination return meaningful
value now, like Apple does, but avoid their __sflush physical write
performance degradation as much as possible.
2014-07-22 22:49:37 +00:00
Andrey A. Chernov
4099894921 Back the whole change out until I figure out how to obtain O_APPEND,
it can't be used in this field at all.
2014-07-22 20:13:46 +00:00
Andrey A. Chernov
44575f7350 Checking for __SAPP alone is not enough because it is emulated O_APPEND
only, so works for only special fdopen() case. Add real O_APPEND too.
2014-07-22 19:55:25 +00:00
Pedro F. Giffuni
a333236e63 Revert r268984:
Check for __SAPP flag before calling sflush.   This avoids
performance degradation compared to the previous approach.

Submitted by:	ache
MFC after:	2 weeks
2014-07-22 18:37:59 +00:00
Pedro F. Giffuni
6393bfdac8 Mostly cosmetic cleanups.
In fputs() avoid implcit casting on iov.iov_len.

MFC after:	3 days
2014-07-22 16:39:11 +00:00
Pedro F. Giffuni
4a4e32a81d ftello: return 1 when seeking offset on an append stream.
Obtained from:	Apple Inc. (Libc 997.90.3)
Phabric:	D442
MFC after:	2 weeks
2014-07-22 16:19:01 +00:00
Pedro F. Giffuni
c03225695d rewind: always clear error indicator.
Required by POSIX:
http://pubs.opengroup.org/onlinepubs/009695399/functions/rewind.html

Obtained from:	Apple Inc. (Libc 997.90.3)
MFC after:	1 week
2014-07-22 16:10:56 +00:00
Pedro F. Giffuni
e19f362e28 Fix hdestroy() compliance issue.
The hcreate(3) implementation and related functions we inherited
from NetBSD used to free() the key value, something that is not
supported by the standard implementation.

This would cause a segmentation fault when attempting to run
the examples from the opengroup and linux manpages.  NetBSD
has added non-standard calls to provide the previous
behaviour but hdestroy is not very commonly used so at this
time it seems excessive to bring those to FreeBSD.

Bump the __FreeBSD_version as this is an ABI change.

Reference:
http://bugs.dragonflybsd.org/issues/1398

MFC after:	2 weeks
2014-07-21 15:44:59 +00:00
Pedro F. Giffuni
47ccc0c84f Update license.
NetBSD has removed the advertisement clause from this file.

Obtained from:	NetBSD (CVS rev. 1,8)
2014-07-21 15:26:52 +00:00
Pedro F. Giffuni
9823a90c79 Add re-entrant versions of the hash functions based on the GNU api.
While testing this I found a conformance issue in hdestroy()
that will be fixed in a subsequent commit.

Obtained from:	NetBSD (hcreate.c, CVS Rev. 1.7)
2014-07-21 15:22:48 +00:00
Pedro F. Giffuni
450ead8668 Adjust errno on failed prepwrite.
Obtained from:	Apple Inc. (Libc 997.90.3)
Phabric:	D442
MFC after:	1 week
2014-07-20 21:24:29 +00:00
Pedro F. Giffuni
7ebc2c26a2 Const-ify a character string.
Obtained from:	Apple Inc. (Libc 997.90.3)
MFC after:	3 days
2014-07-20 20:29:28 +00:00
Pedro F. Giffuni
120d6dd50d Use a correct errno in freopen.
Use EBADF instead of EINVAL when working around incorrect O_ACCMODE.

Phabric:	D442
Obtained from:	Apple Inc. (Libc 997.90.3)
Reviewed by:	jilles
MFC after:	1 week
2014-07-20 20:14:15 +00:00
Pedro F. Giffuni
05c9304f58 Update fflush(3) to return success on a read-only stream.
This has small changes to what Apple uses for compliance
with SUSv3. The changes cause no secondary effects in the
gnulib tests (we pass them).

Obtained from:	Apple Inc. (Libc 997.90.3 with changes)
Reviewed by:	bde
Phabric:	D440
2014-07-20 20:05:39 +00:00
Ian Lepore
677a88cec2 Add dl_unwind_find_exidx() for ARM EABI, required for C++ exception
handling.  For statically linked apps this uses the __exidx_start/end
symbols set up by the linker.  For dynamically linked apps it finds the
shared object that contains the given address and returns the location and
size of the exidx section in that shared object.

The dl_unwind_find_exidx() name is used by other BSD projects and Android,
and is mentioned in clang 3.5 comments as "the BSD interface" for finding
exidx data.  GCC (in libgcc_s) expects the exact same API and functionality
to be provided by a function named __gnu_Unwind_Find_exidx(), so we provide
that with an alias ("strong reference").

Reviewed by:	kib@
MFC after:	1 week
2014-07-19 22:13:27 +00:00
Dag-Erling Smørgrav
16722cb2c1 Add support for the "account" facility.
PR:		115164
MFC after:	1 week
2014-07-19 21:04:21 +00:00
Neel Natu
091d453222 Handle nested exceptions in bhyve.
A nested exception condition arises when a second exception is triggered while
delivering the first exception. Most nested exceptions can be handled serially
but some are converted into a double fault. If an exception is generated during
delivery of a double fault then the virtual machine shuts down as a result of
a triple fault.

vm_exit_intinfo() is used to record that a VM-exit happened while an event was
being delivered through the IDT. If an exception is triggered while handling
the VM-exit it will be treated like a nested exception.

vm_entry_intinfo() is used by processor-specific code to get the event to be
injected into the guest on the next VM-entry. This function is responsible for
deciding the disposition of nested exceptions.
2014-07-19 20:59:08 +00:00
Dag-Erling Smørgrav
ec5622ad86 Check if the specified group is the user's primary group before
iterating over the (possibly empty) list of members.  Otherwise, we
get a false negative when the target group has no members listed in
/etc/group.  This went mostly unnoticed because root is explicitly
listed as a member of wheel, so the bug is never triggered in the most
common use case, which is su(8).

PR:		109416
MFC after:	1 week
2014-07-19 20:55:13 +00:00
Dag-Erling Smørgrav
e8263e185c Clean up the libunbound build to avoid accidentally regenerating the
configuration lexer and parser during buildworld.  Instead of being
included in the source as it is in the upstream distribution, the code is
now always generated (in ${.OBJDIR}) at build time.

PR:		190739
MFC after:	1 week
2014-07-19 18:38:48 +00:00
Pedro F. Giffuni
65227e53ce Clean r268867.
Proposed by:	bde
2014-07-19 14:34:06 +00:00
Pedro F. Giffuni
bef4f148b1 Use unsigned optlen in getsourcefilter()
Sizes can not be negative and the functions that use it
expect an unsigned value anyways.

Obtained from:	Apple (Libc-997.90.3)
MFC after:	1 week
2014-07-19 01:53:52 +00:00
Jilles Tjoelker
becf520163 ttyname(3): Fix EBADF/ENOTTY error descriptions.
Also, make sure to document the return values and errors for all three
functions in the man page.

PR:		191931
MFC after:	1 week
2014-07-18 21:29:59 +00:00
Baptiste Daroussin
42e62eca52 Extend kqueue's EVFILT_TIMER by adding precision unit flags support
Define the precision macros as bits sets to conform with XNU equivalent.
Test fflags passed for EVFILT_TIMER and return EINVAL in case an invalid flag
is passed.

Phabric:	https://phabric.freebsd.org/D421
Reviewed by:	kib
2014-07-18 14:27:04 +00:00
Baptiste Daroussin
3dcf5eb705 Update libucl to the 2014-07-16 snapshot
This update brings streamlined ucl emitter support
2014-07-18 06:58:01 +00:00
Brooks Davis
80189b3b09 Replace all uses of libncurses and libtermcap with their wide character
variants.  This allows usable file system images (i.e. those with both a
shell and an editor) to be created with only one copy of the curses library.

Exp-run:	antoine
PR:		189842
Discussed with:	bapt
Sponsored by:	DARPA, AFRL
2014-07-17 18:24:34 +00:00
Baptiste Daroussin
3674911c29 Add a comment to explain the EAGAIN is only there for POSIX compliance
Resquested by:	kib
Reviewed by:	des
2014-07-15 15:29:43 +00:00
Pedro F. Giffuni
8a29851f80 libc/stdlib: Minor cleanups to code originating in NetBSD
Mostly ANSIfication and typos.

Obtained from:	NetBSD
MFC after:	5 days
2014-07-15 03:28:37 +00:00
Kevin Lo
92511d108b Document that listen(2) can fail with EDESTADDRREQ. 2014-07-15 02:21:51 +00:00
Pedro F. Giffuni
dad64c978f libc/gen: small updates to code originating at OpenBSD
arc4random.c
- CVS rev. 1.22
Change arc4random_uniform() to calculate ``2**32 % upper_bound'' as
``-upper_bound % upper_bound''. Simplifies the code and makes it the
same on both ILP32 and LP64 architectures, and also slightly faster on
LP64 architectures by using a 32-bit remainder instead of a 64-bit
remainder.
- CVS rev. 1.23
Spacing

readpassphrase.c
-CVS rev. v 1.24
most obvious unsigned char casts for ctype

Obtained from:	OpenBSD
MFC after:	5 days
2014-07-15 02:21:35 +00:00
Julio Merino
b32cce1f82 Make generation of nslexer.c more robust.
Ensure that lex errors fail the build instead of being silently ignored
due to the piped call.  Also postpone the update of the nslexer.c file
until we are sure we have generated it properly.

These changes fix some very obscure build failures I encountered while
building FreeBSD within a chroot that did not have devfs mounted. The
specific errors looked like:

.../libc.so.7: undefined reference to `_nsyyerror'
.../libc.so.7: undefined reference to `_nsyyin'
.../libc.so.7: undefined reference to `_nsyylex'
.../libc.so.7: undefined reference to `_nsyylineno'
.../libc.so.7: undefined reference to `_nsyytext'

and were caused due to a mangled nslexer.c being linked into libc.
2014-07-14 13:53:10 +00:00
Steve Kargl
d781108453 * Update the comments to agree with commit r226595.
* While here, fix a nearby typo in a comment.
2014-07-13 23:10:39 +00:00