Commit Graph

1409 Commits

Author SHA1 Message Date
Pedro F. Giffuni
827396ba31 Complete revert of r239963:
The attempt to merge changes from the linux libtirpc caused
rpc.lockd to exit after startup under unclear conditions.

After many hours of selective experiments and inconsistent results
the conclusion is that it's better to just revert everything and
restart in a future time with a much smaller subset of the
changes.
____

MFC after:	3 days
Reported by:	David Wolfskill
Tested by:	David Wolfskill
2012-09-27 20:06:37 +00:00
Tijl Coosemans
a4b20c5eba - Make C11 atomic macros usable in expressions:
- Replace do-while statements with void expressions.
  - Wrap __asm statements in statement expressions.
- Make the macros function-like:
  - Evaluate all arguments exactly once.
  - Make sure there's a sequence point between evaluation of the arguments
    and the function body. Arguments should be evaluated before any memory
    barriers.
- Fix use of __atomic_is_lock_free built-in. It requires the address of
  an atomic variable as second argument. Use this built-in on clang as
  well because clang's __c11_atomic_is_lock_free only takes the size of the
  variable into account.
- In atomic_exchange_explicit put the barrier before instead of after the
  __sync_lock_test_and_set call.

Reviewed by:	theraven
2012-09-26 19:49:22 +00:00
Jim Harris
a724927cf3 Integrate nvmecontrol(8) into the amd64 and i386 builds.
This includes adding NVMe header files to /usr/include/dev/nvme.

Sponsored by:  Intel
2012-09-17 21:41:38 +00:00
Gleb Smirnoff
3b3a8eb937 o Create directory sys/netpfil, where all packet filters should
reside, and move there ipfw(4) and pf(4).

o Move most modified parts of pf out of contrib.

Actual movements:

sys/contrib/pf/net/*.c		-> sys/netpfil/pf/
sys/contrib/pf/net/*.h		-> sys/net/
contrib/pf/pfctl/*.c		-> sbin/pfctl
contrib/pf/pfctl/*.h		-> sbin/pfctl
contrib/pf/pfctl/pfctl.8	-> sbin/pfctl
contrib/pf/pfctl/*.4		-> share/man/man4
contrib/pf/pfctl/*.5		-> share/man/man5

sys/netinet/ipfw		-> sys/netpfil/ipfw

The arguable movement is pf/net/*.h -> sys/net. There are
future plans to refactor pf includes, so I decided not to
break things twice.

Not modified bits of pf left in contrib: authpf, ftp-proxy,
tftp-proxy, pflogd.

The ipfw(4) movement is planned to be merged to stable/9,
to make head and stable match.

Discussed with:		bz, luigi
2012-09-14 11:51:49 +00:00
David Xu
7fa52c2f45 POSIX requires sigevent to be visible after mqueue.h is included. 2012-09-10 05:12:45 +00:00
David Xu
c80e6375ea Process CPU-Time Clocks option is supported, define _POSIX_CPUTIME. 2012-09-10 05:09:39 +00:00
David Xu
224ee591e7 Add missing prototype for clock_getcpuclockid. 2012-09-10 05:00:29 +00:00
Pedro F. Giffuni
46f442e58a Revert r240060: (Partial)
__BEGIN_DECLS and __END_DECLS in cdefs.h take care of the
__cplusplus mangling issues so most of the definitions
were redundant.

In the few places where they were not redundant we should
use BSD style instead of the guards used upstream.

Reported by:	Yuri Pankov
2012-09-02 22:23:23 +00:00
Pedro F. Giffuni
370c6ad8ce Fix RPC headers for C++
C++ mangling will cause trouble with variables like __rpc_xdr
in xdr.h so rename this to XDR.
While here add proper C++ guards to RPC headers.

PR:		137443
MFC after:	2 weeks
2012-09-02 21:04:40 +00:00
Pedro F. Giffuni
43981b6c53 Bring some changes from Bull's NFSv4 libtirpc implementation.
We especifically ignored the glibc compatibility changes
but this should help interaction with Solaris and Linux.
____

Fixed infinite loop in svc_run()
author	Steve Dickson
Tue, 10 Jun 2008 12:35:52 -0500 (13:35 -0400)
Fixed infinite loop in svc_run()
____

__rpc_taddr2uaddr_af() assumes the netbuf to always have a
non-zero data. This is a bad assumption and can lead to a
seg-fault. This patch adds a check for zero length and returns
NULL when found.
author	Steve Dickson
Mon, 27 Oct 2008 11:46:54 -0500 (12:46 -0400)
____

Changed clnt_spcreateerror() to return clearer
and more concise error messages.
author	Steve Dickson
Thu, 20 Nov 2008 08:55:31 -0500 (08:55 -0500)
____

Converted all uid and gid variables of the type uid_t and gid_t.
author	Steve Dickson
Wed, 28 Jan 2009 12:44:46 -0500 (12:44 -0500)
____

libtirpc: set r_netid and r_owner in __rpcb_findaddr_timed

These fields in the rpcbind GETADDR call are being passed uninitialized
to CLNT_CALL. In the case of x86_64 at least, this usually leads to a
segfault. On x86, it sometimes causes segfaults and other times causes
garbage to be sent on the wire.

rpcbind generally ignores the r_owner field for calls that come in over
the wire, so it really doesn't matter what we send in that slot. We just
need to send something. The reference implementation from Sun seems to
send a blank string. Have ours follow suit.
author	Jeff Layton
Fri, 13 Mar 2009 11:44:16 -0500 (12:44 -0400)
____

libtirpc: be sure to free cl_netid and cl_tp

When creating a client with clnt_tli_create, it uses strdup to copy
strings for these fields if nconf is passed in. clnt_dg_destroy frees
these strings already. Make sure clnt_vc_destroy frees them in the same
way.

author	Jeff Layton
Fri, 13 Mar 2009 11:47:36 -0500 (12:47 -0400)

Obtained from:	Bull GNU/Linux NFSv4 Project
MFC after:	3 weeks
2012-09-01 02:56:17 +00:00
Ed Schouten
e4e74ba352 Properly enable Clang-style atomics when available.
In addition to testing against cxx_atomic, we must check c_atomic. The
former is only set when building C++ code. Also use __has_extension
instead of __has_feature. This allows us to use the atomics outside of
C11.

Reported by:	Ariane van der Steldt <ariane stack nl>
PR:		threads/170073
2012-08-31 22:22:14 +00:00
Doug Rabson
f261daf5fc Reduce namespace pollution from gssapi.h
MFC after:	2 weeks
2012-08-05 13:38:15 +00:00
Pawel Jakub Dawidek
988a521bf0 The register_printf_render_std() function expects regular string.
Change argument type from 'const unsigned char *' to 'const char *'.

MFC after:	2 weeks
2012-07-04 17:35:07 +00:00
Andrew Turner
74dc547e24 Make the wchar_t type machine dependent.
This is required for ARM EABI. Section 7.1.1 of the Procedure Call for the
ARM Architecture (AAPCS) defines wchar_t as either an unsigned int or an
unsigned short with the former preferred.

Because of this requirement we need to move the definition of __wchar_t to
a machine dependent header. It also cleans up the macros defining the limits
of wchar_t by defining __WCHAR_MIN and __WCHAR_MAX in the same machine
dependent header then using them to define WCHAR_MIN and WCHAR_MAX
respectively.

Discussed with:	bde
2012-06-24 04:15:58 +00:00
David E. O'Brien
2e0c6b7ac0 Install filemon.h into /usr/include for userland consumption. 2012-06-20 00:09:47 +00:00
Dag-Erling Smørgrav
7c5a921699 Finally nuke auth.conf, nine years after it was deprecated. The only
thing it was still used for was to set the "global default" password
hash.  Since the stock auth.conf contained nothing but comments, the
global default was actually the first algorithm in crypt(3)'s list,
which happens to be DES; I take the fact that nobody noticed as proof
that it was not used outside of crypt(3).

The only other use in our tree was in the Kerberos support code in
in tinyware's passwd(1).  I removed that code in an earlier commit;
it would not have compiled anyway, as it only supported Kerberos IV.

The auth_getval() function is now a stub that always returns NULL,
which has the same effect as a functional auth_getval() with an
empty auth.conf.

MFC after:	3 weeks
2012-06-12 17:02:53 +00:00
Ed Schouten
9b1ae08154 Fix a small typo. Fireware -> firmware.
MFC after:	2 weeks
2012-06-05 19:42:57 +00:00
Hartmut Brandt
7d0d2b0f86 Fix a compilation error with some compilers: __attribute__
requires two parenthesis for its argument, but instead of using
__attribute__ directly, use the appropriate __nonnull macro
from cdefs.h.
2012-05-22 09:59:49 +00:00
Gleb Kurtsou
0bb2aabf26 Hide DIR definition by making it an opaque struct typedef.
Introduce dirfd() libc exported symbol replacing macro with same name,
preserve _dirfd() macro for internal use.

Replace dirp->dd_fd with dirfd() call. Avoid using dirfd as variable
name to prevent shadowing global symbol.

Sponsored by:	Google Summer Of Code 2011
2012-05-19 12:44:27 +00:00
Gleb Kurtsou
788cefe2cb Don't use ino_t in dumprestore protocol definition.
Since ino_t size is about to change to 64-bits, replace ino_t used in
dump protocol definition with 32-bit dump_ino_t to preserve backward
compatibility.  At some point, it may be necessary to use spare fields
in struct in order to fully support 64-bit inode numbers.

Sponsored by:	Google Summer of Code 2011
2012-05-18 10:01:31 +00:00
Grzegorz Bernacki
7f725bcd5c Import work done under project/nand (@235533) into head.
The NAND Flash environment consists of several distinct components:
  - NAND framework (drivers harness for NAND controllers and NAND chips)
  - NAND simulator (NANDsim)
  - NAND file system (NAND FS)
  - Companion tools and utilities
  - Documentation (manual pages)

This work is still experimental. Please use with caution.

Obtained from: Semihalf
Supported by:  FreeBSD Foundation, Juniper Networks
2012-05-17 10:11:18 +00:00
David Chisnall
bdaa925cc7 Fix <stdatomic.h> after clang decided to rename all of its builtins to include
a c11 prefix to disambiguate them from the one provided by GCC.

Note: Clang 3.1 also supports the GCC builtins for libstdc++ 4.7 compatibility,
but I don't recommend using them because they are very poorly designed.

MFC after:	2 weeks
2012-05-03 15:54:06 +00:00
Dimitry Andric
460378bf13 Add a convenience macro for the returns_twice attribute, and apply it to
the prototypes of the appropriate functions (getcontext, savectx,
setjmp, sigsetjmp and vfork).

MFC after:	2 weeks
2012-04-29 11:04:31 +00:00
David Chisnall
e36c7d52b3 Fix a bug caused by some misplaced brackets.
Reported by:	das
2012-04-22 16:58:14 +00:00
Jason Evans
a4bd5210d5 Import jemalloc 9ef7f5dc34ff02f50d401e41c8d9a4a928e7c2aa (dev branch,
prior to 3.0.0 release) as contrib/jemalloc, and integrate it into libc.
The code being imported by this commit diverged from
lib/libc/stdlib/malloc.c in March 2010, which means that a portion of
the jemalloc 1.0.0 ChangeLog entries are relevant, as are the entries
for all subsequent releases.
2012-04-17 07:22:14 +00:00
David Chisnall
3ac9d65989 Correctly expose xlocale functions if people include the headers in the wrong
order (as some ports apparently do).

Approved by:	dim (mentor)
2012-03-28 12:11:54 +00:00
David Chisnall
79d09835dd Expose some C11 stuff that is also C++11 stuff in C++11 mode.
Approved by:	dim (mentor)
2012-03-14 14:39:07 +00:00
David Chisnall
c5c1d73960 And remove the duplicate inlines...
Approved by:	dim (mentor)
2012-03-13 18:53:28 +00:00
David Chisnall
9fa42222e8 Fix the other missing prototypes.
Approved by:	dim (mentor)
2012-03-13 17:32:55 +00:00
David Chisnall
3fad4c3494 Add missing prototypes.
Approved by:	dim (mentor)
2012-03-13 15:21:14 +00:00
David Chisnall
4d7815ecc4 More xlocale cleanups.
Approved by:	dim (mentor)
2012-03-13 14:14:13 +00:00
Konstantin Belousov
b80dcb55aa Remove fifo.h. The only used function declaration from the header is
migrated to sys/vnode.h.

Submitted by:	gianni
2012-03-11 12:19:58 +00:00
Dimitry Andric
b1e45245d1 After r232498, programs built with -ansi or -std=c89 including <ctype.h>
would not compile anymore, due to plain 'inline' keywords.  Fix this by
using __inline instead.

Reported by:	Jia-Shiun Li <jiashiun@gmail.com>
Discussed with:	theraven
2012-03-06 20:15:23 +00:00
David Chisnall
a8ed63bb3d Reapply 227753 (xlocale cleanup), plus some fixes so that it passes build
universe with gcc.

Approved by:	dim (mentor)
2012-03-04 15:31:13 +00:00
Dimitry Andric
b74cf6dcf1 Revert r231673 and r231682 for now, until we can run a full make
universe with them.  Sorry for the breakage.

Pointy hat to:	     me and brooks
2012-02-14 21:48:46 +00:00
David Chisnall
7780c181c5 Fix a misplaced __NO_TLS locations, and change a GNUism to a C11ism for
consistency.

Approved by:	brooks (mentor)
2012-02-14 14:24:37 +00:00
Tijl Coosemans
265f940acc Change some headers such that lang/gcc* ports no longer patch them.
The lang/gcc* ports patch headers where they think something is
non-standard. These patched headers override the system headers which means
you have to rebuild these ports whenever you do installworld to make sure
they contain the latest changes.
2012-02-14 12:50:20 +00:00
David Chisnall
82dd5016bd Cleanup of xlocale:
- Address performance regressions encountered by das@ by caching per-thread
  data in TLS where available.
- Add a __NO_TLS flag to cdefs.h to indicate where not available.
- Reorganise the xlocale.h definitions into xlocale/*.h so that they can be
  included from multiple places.
- Export the POSIX2008 subset of xlocale when POSIX2008 says it should be
  exported, independently of whether xlocale.h is included.
- Fix the bug where programs using ctype functions always assumed ASCII unless
  recompiled.
- Fix some style(9) violations.

Reviewed by:	brooks (mentor)
Approved by:	dim (mentor)
2012-02-14 12:03:23 +00:00
Dimitry Andric
5e0a19bdee Consistently set RPCGEN_CPP when running rpcgen, so the C preprocessor
set via ${CPP} is used, instead of always using hardcoded /usr/bin/cpp.

MFC after:	1 week
2012-02-07 09:27:07 +00:00
Ed Schouten
76f11d88aa Only use the static assertion when __generic is available.
Reported by:	tijl
2012-01-17 20:22:10 +00:00
David Chisnall
4ecabf31f3 Fix clang atomic to use for atomic_is_lock_free().
Reviewed by:	ed
Approved by:	dim (mentor)
2012-01-17 15:20:41 +00:00
David Chisnall
03c142e762 Use the signal fence builtin in stdatomic.h when using the clang atomic
builtins, rather than the __asm hack.  Somehow I missed the existence of this
builtin originally and only noticed that it was there when I went to implement
it...

Note: Trunk clang now has support for (most of) the C[++]11 atomics stuff.
Please test!

Approved by:	brooks (mentor)
2012-01-16 18:19:53 +00:00
Andriy Gapon
ea3282935d xlocale.h: consistently use __va_list
Plain 'va_list' in this header seems to cause troubles with non-base GCC
which creates and uses "tortured" versions of some sysem header files
including stdio.h (installed in a private 'include-fixed' directory).

Reviewed by:	theraven
X-MFC with:	r227753
2012-01-15 20:37:39 +00:00
Ed Schouten
a6a53dc8f7 Correct mistake in atomic_flag macros.
The _explicit versions only have two parameters, namely the object and
the order. There is no need to pass the values of the atomic variable.
2012-01-13 16:01:34 +00:00
Ed Schouten
9e16bab42a Add aligned_alloc(3).
The C11 folks reinvented the wheel by introducing an aligned version of
malloc(3) called aligned_alloc(3), instead of posix_memalign(3). Instead
of returning the allocation by reference, it returns the address, just
like malloc(3).

Reviewed by:	jasone@
2012-01-09 06:36:28 +00:00
Ed Schouten
5d8c5f69f1 Fix spelling of C11 and sort functions by name. 2012-01-08 12:03:46 +00:00
Ulrich Spörlein
2f98c0ba01 Spelling fixes for include/ 2012-01-07 16:10:15 +00:00
Konstantin Belousov
5d8aec9c02 Implement fdlopen(3), an rtld interface to load shared object by file
descriptor.

Requested and tested by:	des (previous version)
Reviewed by:  des, kan (previous version)
MFC after:    2 weeks
2012-01-07 10:33:01 +00:00
Ed Schouten
305bf119f8 Last attempt at <tgmath.h>: do enable the new code for C11 compilers.
I was thinking by myself, if the new code doesn't work with GCC 4.2, why
not simply turn it into an efficient version for C11 compilers? By
changing the code to use _Generic() directly in that case, I can build
the tgmath regression test in a matter of milliseconds with Clang,
instead of the 8 seconds it used to take.

So by the time C11 becomes the default, it will pick up the new code
automatically. And now I will refrain from making more changes to
<tgmath.h>.
2012-01-06 19:04:59 +00:00
Ed Schouten
81ec6b6b47 Add an even faster implementation of <tgmath.h> for the future.
Instead of using an exponential number of cases with respect to the
number of arguments, this version only uses a linear number.
Unfortunately, it works with Clang, GCC 4.6 and GCC 4.7, but not GCC
4.2. Therefore, leave it commented out.
2012-01-06 16:20:17 +00:00