Commit Graph

1587 Commits

Author SHA1 Message Date
Poul-Henning Kamp
c05bafc566 Deorbit the IEEE-488/GPIB support. 2014-12-25 20:15:13 +00:00
Simon J. Gerraty
c0b2d894be update dependencies 2014-11-30 18:48:57 +00:00
Enji Cooper
0341ccf227 Clean up more usb related files when MK_USB == no when dealing with
manpages, libraries, and binaries
2014-11-26 21:18:52 +00:00
Enji Cooper
046cc7b93e Account for /usr/include/protocols/r{outed,whod}.h with their respective build knobs 2014-11-26 12:54:58 +00:00
Enji Cooper
12de3059d0 Fix some accidentally inverted logic 2014-11-26 12:49:37 +00:00
Enji Cooper
466046ec0d Conditionalize a number of components in the tree
- bootparamd
- bootpd
- finger/fingerd
- ftp/ftpd
- hastctl/hastd
- iscsid, et al
- rbootd
- talk/talkd
- tcpd, et al
- tftp/tftpd

Add src.conf entries for the various components and do a best effort
at adding components to tools/build/mk/OptionalObsoleteFiles.inc
2014-11-26 08:44:05 +00:00
Simon J. Gerraty
9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Rui Paulo
6bd000838c Fix the build by installing acpi_hpet.h correctly.
Submitted by:	jase
MFC after:	1 week
2014-10-24 23:25:11 +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
Rui Paulo
3149cc9df6 HPET: create /dev/hpetN as a way to access HPET from userland.
In some cases, TSC is broken and special applications might benefit
from memory mapping HPET and reading the registers to count time.
Most often the main HPET counter is 32-bit only[1], so this only gives
the application a 300 second window based on the default HPET
interval.
Other applications, such as Intel's DPDK, expect /dev/hpet to be
present and use it to count time as well.

Although we have an almost userland version of gettimeofday() which
uses rdtsc in userland, it's not always possible to use it, depending
on how broken the multi-socket hardware is.

Install the acpi_hpet.h so that applications can use the HPET register
definitions.

[1] I haven't found a system where HPET's main counter uses more than
32 bit.  There seems to be a discrepancy in the Intel documentation
(claiming it's a 64-bit counter) and the actual implementation (a
32-bit counter in a 64-bit memory area).

MFC after:	1 week
Relnotes:	yes
2014-10-24 18:39:15 +00:00
Baptiste Daroussin
7cec355b9b Fix build with rpcgen using a recent (tested with gcc 4.9.1) GNU cpp 2014-10-09 06:58:33 +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
Pedro F. Giffuni
749cd43178 unistd: drop argument names from setpgrp(3) prototype.
They are useless and don't match the style of the header.
While here adjust the comment with tabs.

Suggested by:	kevinlo
2014-09-19 18:13:56 +00:00
Pedro F. Giffuni
d9446691c8 unistd: move setpgrp(2) to the __BSD_VISIBLE section
Our setpgrp(2) differs from the specified by POSIX, which
only has one argument, and is only meant for compatibility
with BSD.

Reference:
http://pubs.opengroup.org/onlinepubs/009695399/functions/setpgrp.html

Pointed-out in:	openbsd-tech (2014-09-16)
MFC after:	6 weeks
2014-09-18 17:18:42 +00:00
Ed Schouten
b58aba6b66 Roll back r271012 even more aggressively.
I've looked at the GCC sources and I now understand what's going wrong.
THe C11 keywords are simply nonexistent when using C++ mode. They are
marked as C-only in the parser. This is absolutely impractical for
multiple reasons:

- The C11 keywords do not conflict with C++ naming rules. They all start
  with _[A-Z]. There is no reason to make them C-only.

- It makes it practically impossible for people to use these keywords in
  C header files and expect them to work from within C++ sources.

As I said in my previous commit message: GCC is by far the weirdest
compiler that I've ever used.
2014-09-05 05:36:32 +00:00
Ed Schouten
62b7f85d47 Leave the C11 keywords alone when we have a recent version of GCC.
As GCC also gained support for the C11 keywords over time, we can patch
up <sys/cdefs.h> to not define these anymore. This has the advantage
that error messages for static assertions are printed natively and that
_Alignas() will work with even a type outside of C11 mode.

All C11 keywords are supported with GCC 4.7 and higher, with the
exception of _Thread_local and _Generic. These are only supported as of
GCC 4.9.
2014-09-03 09:35:38 +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
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
Alexander Kabaev
7935fd6ef1 Add guards to ptrdiff_t definition in include/stddef.h
Back in 2011 obrien has added the #define macro in sys/sys/stddef.h to
guard ptrdiff_t. Add similar protection to the identical code in
include/stddef.h.

Submitted by:   Mariusz Zaborski <oshogbo@FreeBSD.org>
MFC after:      1 week
2014-08-21 15:10:10 +00:00
Simon J. Gerraty
ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +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
e3c3754c06 We don't use these files. 2014-08-09 20:03:40 +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
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
1d717f206a Revert r268826:
The current ordering of this header is a feature as it
is more consistent with POSIX.
Also adding gratuitous newlines is not elegant.

Pointed out by:	bde
2014-07-18 16:21:15 +00:00
Pedro F. Giffuni
7bd26d4567 Minor sorting to match the NetBSD header
MFC after:	3 days
Obtained from:	NetBSD
2014-07-18 02:49:41 +00:00
John Baldwin
9f72c0322c Fix some edge cases with rewinddir():
- In the unionfs case, opendir() and fdopendir() read the directory's full
  contents and cache it.  This cache is not refreshed when rewinddir() is
  called, so rewinddir() will not notice updates to a directory.  Fix this
  by splitting the code to fetch a directory's contents out of
  __opendir_common() into a new _filldir() function and call this from
  rewinddir() when operating on a unionfs directory.
- If rewinddir() is called on a directory opened with fdopendir() before
  any directory entries are fetched, rewinddir() will not adjust the seek
  location of the backing file descriptor.  If the file descriptor passed
  to fdopendir() had a non-zero offset, the rewinddir() will not rewind to
  the beginning.  Fix this by always seeking back to 0 in rewinddir().
  This means the dd_rewind hack can also be removed.

While here, add missing locking to rewinddir().

CR:   	    	https://phabric.freebsd.org/D312
Reviewed by:	jilles
MFC after:	1 week
2014-07-11 16:16:26 +00:00
Tijl Coosemans
dd98737278 Don't install GSS-API headers when the GSSAPI option has been disabled.
Some ports assume GSS-API is supported when they find the headers.

PR:		189156
Submitted by:	Garrett Cooper <yanegomi@gmail.com>
2014-06-13 10:08:18 +00:00
Pedro F. Giffuni
1bb07edbd4 Fix strcasecmp_l() and strncasecmp_l() POSIX 2008 compliance.
POSIX.1-2008 specifies that those two functions should be declared by
including <strings.h>, not <string.h> (the latter only has strcoll_l()
and strxfrm_l()):

http://pubs.opengroup.org/onlinepubs/9699919799/functions/strcasecmp.html

Obtained from:	DragonFlyBSD
Reviewed by:	theraven
MFC after:	2 weeks
2014-05-30 01:09:07 +00:00
Hans Petter Selasky
fa0f6e62c6 Initial import of character device in userspace support for FreeBSD.
The CUSE library is a wrapper for the devfs kernel functionality which
is exposed through /dev/cuse . In order to function the CUSE kernel
code must either be enabled in the kernel configuration file or loaded
separately as a module. Currently none of the committed items are
connected to the default builds, except for installing the needed
header files. The CUSE code will be connected to the default world and
kernel builds in a follow-up commit.

The CUSE module was written by Hans Petter Selasky, somewhat inspired
by similar functionality found in FUSE. The CUSE library can be used
for many purposes. Currently CUSE is used when running Linux kernel
drivers in user-space, which need to create a character device node to
communicate with its applications. CUSE has full support for almost
all devfs functionality found in the kernel:
 - kevents
 - read
 - write
 - ioctl
 - poll
 - open
 - close
 - mmap
 - private per file handle data

Requested by several people. Also see "multimedia/cuse4bsd-kmod" in
ports.
2014-05-23 08:46:28 +00:00
Simon J. Gerraty
0a117278be Actually avoid stage_includes target 2014-05-16 16:21:17 +00:00
Simon J. Gerraty
1a682d2cea We want to use stage_includes as a hook, so use NO_STAGE_INCLUDES
in include/Makefile to suppress normal behavior
2014-05-16 14:47:18 +00:00
Simon J. Gerraty
a5e980ce95 use mv -f to avoid questions 2014-05-16 14:43:24 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Jilles Tjoelker
76902266ae include: Don't expose L_cuserid in strict C standard compliance mode.
L_cuserid is supposed to be exposed only for old POSIX, or in the default
(expose everything) environment.
2014-05-11 16:34:17 +00:00
Jilles Tjoelker
448f5f73dc include: Remove checks for __BSD_VISIBLE where redundant with __XSI_VISIBLE
or __POSIX_VISIBLE.

Whenever <sys/cdefs.h> sets __BSD_VISIBLE to non-zero, it also sets
__POSIX_VISIBLE and __XSI_VISIBLE to the newest version supported.

No functional change is intended.
2014-05-11 13:48:21 +00:00
Simon J. Gerraty
cc3f4b9965 Merge from head 2014-05-08 23:54:15 +00:00
Warner Losh
c6063d0da8 Use src.opts.mk in preference to bsd.own.mk except where we need stuff
from the latter.
2014-05-06 04:22:01 +00:00
Simon J. Gerraty
3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
Jilles Tjoelker
160c0c65d7 langinfo.h: Hide YESSTR and NOSTR in strict POSIX mode.
YESSTR and NOSTR are obsolete and are only in old SUS.
2014-04-19 12:38:01 +00:00
David Chisnall
46cdc14062 Add support for some block functions that come from OS X. These are
intended to build with any C compiler.

Reviewed by:	pfg
MFC after:	3 weeks
2014-04-02 16:07:48 +00:00
Tijl Coosemans
0a4c54d606 Rename __wchar_t so it no longer conflicts with __wchar_t from clang 3.4
-fms-extensions.

MFC after:	2 weeks
2014-04-01 14:46:11 +00:00
Gleb Smirnoff
45c203fce2 Remove AppleTalk support.
AppleTalk was a network transport protocol for Apple Macintosh devices
in 80s and then 90s. Starting with Mac OS X in 2000 the AppleTalk was
a legacy protocol and primary networking protocol is TCP/IP. The last
Mac OS X release to support AppleTalk happened in 2009. The same year
routing equipment vendors (namely Cisco) end their support.

Thus, AppleTalk won't be supported in FreeBSD 11.0-RELEASE.
2014-03-14 06:29:43 +00:00
Gleb Smirnoff
2c284d9395 Remove IPX support.
IPX was a network transport protocol in Novell's NetWare network operating
system from late 80s and then 90s. The NetWare itself switched to TCP/IP
as default transport in 1998. Later, in this century the Novell Open
Enterprise Server became successor of Novell NetWare. The last release
that claimed to still support IPX was OES 2 in 2007. Routing equipment
vendors (e.g. Cisco) discontinued support for IPX in 2011.

Thus, IPX won't be supported in FreeBSD 11.0-RELEASE.
2014-03-14 02:58:48 +00:00
Jason Evans
f921d10f48 Update jemalloc to version 3.5.0. 2014-01-23 02:47:36 +00:00
Nathan Whitehorn
0894229871 Add a new flag to /etc/ttys: onifconsole. This is equivalent to "on" if the
device is an active kernel console and "off" otherwise. This is designed to
allow serial-booting x86 systems to provide a login prompt on the serial line
by default without providing one on all systems by default.

Comments and suggestions by:	grehan, dteske, jilles
MFC after:	1 month
2014-01-20 18:15:06 +00:00
Hiroki Sato
8785398f8a Replace Sun RPC license with a 3-clause BSD license. This license change
was approved in 2010 by Wim Coekaerts, Senior Vice President, Linux and
Virtualization at Oracle Corporation.
2013-12-09 04:26:50 +00:00
Aleksandr Rybalko
4874c0802c Install teken.h for userland.
Part of VT(9) project merge.
Reviewed by:	nwhitehorn
MFC_to_10_after:	re approval

Sponsored by:	The FreeBSD Foundation
2013-12-05 22:56:37 +00:00
Hiroki Sato
44443e425f Replace Sun Industry Standards Source License for Sun RPC code with a
3-clause BSD license as specified by Oracle America, Inc. in 2010.
This license change was approved by Wim Coekaerts, Senior Vice
President, Linux and Virtualization at Oracle Corporation.
2013-11-25 19:08:38 +00:00
Hiroki Sato
2e322d3796 Replace Sun RPC license in TI-RPC library with a 3-clause BSD license,
with the explicit permission of Sun Microsystems in 2009.
2013-11-25 19:04:36 +00:00
Hiroki Sato
7c5b23111c Add ICONV_{GET,SET}_ILSEQ_INVALID iconvctl. GNU iconv returns EILSEQ
when there is an invalid character in the output codeset while it is
valid in the input.  However, POSIX requires iconv() to perform an
implementation-defined conversion on the character.  So, Citrus iconv converts
such a character to a special character which means it is invalid in the
output codeset.

This is not a problem in most cases but some software like libxml2 depends
on GNU's behavior to determine if a character is output as-is or another form
such as a character entity (&#NNN;).
2013-11-25 01:26:06 +00:00
Peter Wemm
091b8336ae Attempt to move the POSIX iconv* symbols out of runtime linker space.
FreeBSD systems usually implemented this as a third party module and
our implementation hasn't played as nicely with the old way as it could
have.

To that end:
* Rename the iconv* symbols in libc.so.7 to have a __bsd_ prefix.
* Provide .symver compatability with existing 10.x+ binaries that
  referenced the iconv symbols. All existing binaries should work.
* Like on Linux/glibc systems, add a libc_nonshared.a to the ldscript
  at /usr/lib/libc.so.
* Move the "iconv*" wrapper symbols to libc_nonshared.a

This should solve the runtime ambiguity about which symbols resolve
to where.  If you compile against the iconv in libc, your runtime
dependencies will be unambiguous.

Old 9.x libraries and binaries will always resolve against their
libiconv.so.3 like they did on 9.x.  They won't resolve against libc.

Old 10.x binaries will be satisified by the .symver helpers.

This should allow ports to selectively compile against the libiconv
port if needed and it should behave without ambiguity now.

Discussed with:	 kib
2013-11-17 22:52:17 +00:00
Peter Wemm
912ce912e1 Remove the WITH_LIBICONV_COMPAT hack that seems to do more harm than
good.  This caused libc to spoof the ports libiconv namespace and
provide a colliding libiconv.so.3 to fool rtld.  This should have
been removed some time ago.
2013-11-03 19:04:57 +00:00
Sean Bruno
b68831134f Install include files for netpfil/pf when requested by the Makefile
Reviewed by:	glebius
2013-11-01 00:32:26 +00:00
Gleb Smirnoff
75bf2db380 Move new pf includes to the pf directory. The pfvar.h remain
in net, to avoid compatibility breakage for no sake.

The future plan is to split most of non-kernel parts of
pfvar.h into pf.h, and then make pfvar.h a kernel only
include breaking compatibility.

Discussed with:		bz
2013-10-27 16:25:57 +00:00
Tijl Coosemans
23bbf7fa70 Add a dummy statement to the beginning of the pthread_cleanup_pop() macro
to allow a call of the macro to be labelled as in:

label:
  pthread_cleanup_pop();

Reviewed by:	imp
MFC after:	3 days
2013-10-22 19:53:52 +00:00
Simon J. Gerraty
3caf0790a8 Merge head@256284 2013-10-13 02:35:19 +00:00
Simon J. Gerraty
43425d65d2 In meta mode touch targets like copies so we don't needlessly repeat them. 2013-10-12 23:37:47 +00:00
Ian Lepore
98c636be78 Set proper permissions on the generated osreldate.h file; a file readable
only by root can cause install problems, especially over nfs.

Submitted by:	jilles@
Approved by:	re (gjb)
2013-09-30 21:01:04 +00:00
Dag-Erling Smørgrav
56b72efe82 Remove BIND.
Approved by:	re (gjb)
2013-09-30 17:23:45 +00:00
Ian Lepore
0210509acd Allow the path to the system source directory to be passed in to
newvers.sh.  Pass it in from include/Makefile.  If it isn't passed in,
fall back to the old logic of using dirname $0.

Using dirname $0 does not yield the path to the script if it was
sourced in from another script in another directory; you end up with
the parent script's path.  That was causing newvers.sh to look one
level below the FreeBSD src/ directory when building osreldate.h and it
may find something like a git or svn repo there that has nothing to do
with FreeBSD.

PR:		174422
Approved by:	re ()
MFC after:	2 weeks
2013-09-28 16:39:46 +00:00
Nathan Whitehorn
36ddc86874 Prevent the set -e from mk-osreldate.sh from propagating into newvers.sh.
This would cause detection of old versions of SVN to cause fatal errors
instead of being caught and handled, which would make the build fail if
the tree had been checked out with an older version of SVN (e.g. 1.6).

Discussed with:	gjb
Approved by:	re (marius)
2013-09-28 16:25:20 +00:00
Ian Lepore
dd5f1297c6 Launch the bourne shell using "sh" rather than "${SHELL}", as the latter
may come in from the environment and reflect the user's interactive shell.
Using bare "sh" is the dominant pattern in existing makefiles.

MFC this together with r255775.

Approved by:	re ()
MFC after:	2 weeks
2013-09-23 00:04:36 +00:00
Ian Lepore
16b0ad07ab Launch the shell, passing it the path to the mk-osreldate script, rather
than launching the script directly and relying on #! to launch the shell.
This avoids problems when the source is mounted with the noexec flag.

MFC this together with r255775.

Approved by:	re (kib)
MFC after:	2 weeks
2013-09-22 19:15:24 +00:00
Ian Lepore
bfe5c479c0 Create a separate script to generate osreldate.h rather than sourcing
newvers.sh into a temporary subshell with inline make rules.

Using a separate script fixes a variety of problems, including establishing
the correct dependencies in the makefiles.  It also eliminates a problem
with the way newvers.sh uses `realpath $0`, because $0 expands differently
within a script sourced into a rule in a makefile depending on the version
of make and of /bin/sh being used.  The latter can cause build breakage in a
cross-build environment, and can also make it difficult to compile 10.0 on
older pre-10.0 systems.

PR:		160646 174422
Submitted by:	Garrett Cooper <yaneurabeya@gmail.com>
Approved by:	re (gjb)
MFC after:	2 weeks
2013-09-21 22:36:07 +00:00
Sean Bruno
22e3858c24 Assume that the -f argument is /dev/gpioc0 if it is not passed.
hrs@ provided this verison of the patch and showed me where all the needed
changes were to be made outside of gpioctl.c

Approved by:	re (hrs)
MFC after:	2 weeks
2013-09-17 11:48:47 +00:00
Simon J. Gerraty
d466a5b069 Merge head 2013-09-11 18:16:18 +00:00
David Chisnall
b49c0d5878 Fix the namespace pollution caused by iconv.h including stdbool.h
This broke any C89 ports that defined bool themselves, including things
like gcc, gtk, and so on.
2013-09-06 09:46:44 +00:00
Simon J. Gerraty
d1d0158641 Merge from head 2013-09-05 20:18:59 +00:00
Pawel Jakub Dawidek
50079a51bb Implement fdclosedir(3) function, which is equivalent to the closedir(3)
function, but returns directory file descriptor instead of closing it.

Submitted by:	Mariusz Zaborski <oshogbo@FreeBSD.org>
Sponsored by:	Google Summer of Code 2013
2013-08-18 20:11:34 +00:00
Jilles Tjoelker
67560dcfb5 Add dup3(), based on F_DUP2FD and F_DUP2FD_CLOEXEC fcntls.
I removed functionality not proposed for POSIX in Austin group issue #411.
A man page (my own) and test cases will follow in later commits.

PR:		176233
Submitted by:	Jukka Ukkonen
2013-08-16 13:10:30 +00:00
Peter Wemm
0ff204bbd1 The iconv in libc did two things - implement the standard APIs, the GNU
extensions and also tried to be link time compatible with ports libiconv.
This splits that functionality and enables the parts that shouldn't
interfere with the port by default.

WITH_ICONV (now on by default) - adds iconv.h, iconv_open(3) etc.
WITH_LIBICONV_COMPAT (off by default) adds the libiconv_open etc API, linker
symbols and even a stub libiconv.so.3 that are good enough to be able
to 'pkg delete -f libiconv' on a running system and reasonably expect it
to work.

I have tortured many machines over the last few days to try and reduce
the possibilities of foot-shooting as much as I can.  I've successfully
recompiled to enable and disable the libiconv_compat modes, ports that use
libiconv alongside system iconv etc.  If you don't enable the
WITH_LIBICONV_COMPAT switch, they don't share symbol space.

This is an extension of behavior on other system.  iconv(3) is a standard
libc interface and libiconv port expects to be able to run alongside it on
systems that have it.

Bumped osreldate.
2013-08-13 07:15:01 +00:00
Jilles Tjoelker
65ba8dff5f Add mkostemp() and mkostemps().
These are like mkstemp() and mkstemps() but allow passing open(2) flags like
O_CLOEXEC.
2013-08-09 17:24:23 +00:00
Jilles Tjoelker
e45e1f2730 stdlib.h: Add correct POSIX version for POSIX extensions to C. 2013-07-05 14:16:04 +00:00
Andrey A. Chernov
476d9314d6 1) POSIX requires rand(3) return values to be in the [0, RAND_MAX] range,
but ACM formula we use have internal state (and return value) in the
[1, 0x7ffffffe] range, so our RAND_MAX (0x7fffffff) is never reached
because it is off by one, zero is not reached too.

Correct both RAND_MAX and rand(3) return value, shifting last one
to the 0 by 1 subtracted, resulting POSIXed [0, 0x7ffffffd(=new RAND_MAX)]
range.

2) Add a checks for not overflowing on too big seeds. It may happens on
the machines, where sizeof(unsigned int) > 32 bits.

Reviewed by:    bde [1]
MFC after:      2 weeks
2013-07-03 21:21:54 +00:00
Peter Wemm
19dfd82d81 Replace the #define for "iconv" so it is for the function name instead of
a macro with parameters.  Remove a __DECONST hack and add consts instead
for gnu libiconv API compatability.  This makes it work with things like
devel/boost-libs that expects to use "iconv" as though it were a pointer.
2013-07-03 07:03:19 +00:00
Hiroki Sato
3fbceebb4a Fix gssapi/gssapi_krb5.h after Heimdal 1.5.1 import.
Reviewed by:	dfr
2013-06-30 07:46:22 +00:00
Davide Italiano
237abf0c56 - Trim an unused and bogus Makefile for mount_smbfs.
- Reconnect with some minor modifications, in particular now selsocket()
internals are adapted to use sbintime units after recent'ish calloutng
switch.
2013-06-28 21:00:08 +00:00
Hiroki Sato
268a55bc98 - Add vnode-backed swap space specification support. This is enabled when
device names "md" or "md[0-9]*" and a "file" option are specified in
  /etc/fstab like this:

  md    none    swap    sw,file=/swap.bin       0       0

- Add GBDE/GELI encrypted swap space specification support, which
  rc.d/encswap supported.  The /etc/fstab lines are like the following:

  /dev/ada1p1.bde       none    swap    sw      0       0
  /dev/ada1p2.eli       none    swap    sw      0       0

  .eli devices accepts aalgo, ealgo, keylen, and sectorsize as options.

  swapctl(8) can understand an encrypted device in the command line
  like this:

  # swapctl -a /dev/ada2p1.bde

- "-L" flag is added to support "late" option to defer swapon until
  rc.d/mountlate runs.

- rc.d script change:

    rc.d/encswap -> removed
    rc.d/addswap -> just display a warning message if $swapfile is defined
    rc.d/swap1 -> renamed to rc.d/swap
    rc.d/swaplate -> newly added to support "late" option

These changes alleviate a race condition between device creation/removal
and swapon/swapoff.

MFC after:	1 week
Reviewed by:	wblock (manual page)
2013-06-27 18:28:45 +00:00
Ed Schouten
06bee445d4 Move <stdatomic.h> into sys/sys/.
This will allow us to use C11 atomics in kernelspace, although it will
need to be included as <sys/stdatomic.h>.
2013-06-01 21:02:26 +00:00
Ed Schouten
636d7fea2f Fix misspelling of structure field name. 2013-05-31 20:07:26 +00:00
David Schultz
e4afa19c33 I'm happy to finally commit stephen@'s implementations of cacos,
cacosh, casin, casinh, catan, and catanh. Thanks to stephen@ and bde@
for working on these.

Submitted by:	stephen@
Reviewed by:	bde
2013-05-30 04:49:26 +00:00
Marcel Moolenaar
9dfba391d6 Make the malloc(3) family of functions weak and make their non-weak
implementations visible for use by applications. The functions $F that
are now weak symbols are:
	allocm, calloc, dallocm, free, malloc, malloc_usable_size,
	nallocm, posix_memalign, rallocm, realloc, sallocm

The non-weak implementations of $F are exported as __$F.

Submitted by:	stevek@juniper.net
Reviewed by:	jasone@, kib@
Approved by:	jasone@ (jemalloc)
Obtained from:	juniper Networks, Inc
2013-05-25 18:59:11 +00:00
Ed Schouten
e814330de1 Add C11 macros CMPLX(), CMPLXF() and CMPLXL().
Clang allows us to initialize complex numbers using an array
initializer, casted to a complex type. GCC has a builtin called
__builtin_complex().
2013-05-25 18:55:55 +00:00
Ed Schouten
74b6b2bb99 Fix <uchar.h> in for C++11.
It turns out that in C++11, char16_t and char32_t are built-in types;
language keywords. Just fix this by putting traditional _*_T_DECLARED
blocks around the definitions. We'll just predefine these in
<sys/_types.h>.

This also opens up the possibility to define char16_t in other header
files, if ever needed (e.g. if we would gain a <ctype.h> for
char16_t/char32_t).
2013-05-25 16:58:12 +00:00
Ed Schouten
553f17daf9 Add proper prerequisites for even two more headers.
Spotted by:   http://hacks.owlfolio.org/header-survey/
2013-05-21 21:50:11 +00:00
Ed Schouten
6ed0f50f78 Allow certain headers to be included more easily.
Spotted by:	http://hacks.owlfolio.org/header-survey/
2013-05-21 21:20:10 +00:00
Ed Schouten
50c77c6e8b Add <uchar.h>.
The <uchar.h> header, part of C11, adds a small number of utility
functions for 16/32-bit "universal" characters, which may or may not be
UTF-16/32. As our wchar_t is already ISO 10646, simply add light-weight
wrappers around wcrtomb() and mbrtowc().

While there, also add (non-yet-standard) _l functions, similar to the
ones we already have for the other locale-dependent functions.

Reviewed by:	theraven
2013-05-21 19:59:37 +00:00
Jilles Tjoelker
dc570d5e56 Add pipe2() system call.
The pipe2() function is similar to pipe() but allows setting FD_CLOEXEC and
O_NONBLOCK (on both sides) as part of the function.

If p points to two writable ints, pipe2(p, 0) is equivalent to pipe(p).

If the pointer is not valid, behaviour differs: pipe2() writes into the
array from the kernel like socketpair() does, while pipe() writes into the
array from an architecture-specific assembler wrapper.

Reviewed by:	kan, kib
2013-05-01 22:42:42 +00:00
Ed Schouten
5a1d14ca78 Enable improved <tgmath.h> for Clang even when not using C11.
By using __has_extension(c_generic_selections), we can explicitly test
whether we're dealing with a version of Clang that supports _Generic().
That way we can use the improved <tgmath.h> code, even when not using
-std=c11. This massively reduces the compilation time when invoking
these functions.
2013-04-27 21:18:34 +00:00
Eitan Adler
d001beb260 - sl_find does not modify 'name'
- make the prototype of sl_find match NetBSD

Reviewed by:	jilles
Approved by:	cperciva (mentor)
MFC After:	3 days
2013-04-23 13:03:03 +00:00
Simon J. Gerraty
fb0cb80846 Add stage-install.sh so we can do away with the need to have
$STAGE_OBJTOP/include for src/include.
2013-04-19 18:45:03 +00:00
Gabor Kovesdan
a2098fea6d - Correct mispellings of the word necessary
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de> (via private mail)
2013-04-17 11:42:40 +00:00
Simon J. Gerraty
69e6d7b75e sync from head 2013-04-12 20:48:55 +00:00
Ed Schouten
7c99b6764e Add static/const keywords to the arrays.
This theoretically allows a compiler to optimize (parts of) the array
away if unused.

While there, make the array size implicit and use a _Static_assert() to
ensure that the definition matches up with the number of elements in the
list.
2013-04-09 16:16:34 +00:00
John Baldwin
9240031ac6 Add an implementation of open_memstream() and open_wmemstream(). These
routines provide write-only stdio FILE objects that store their data in a
dynamically allocated buffer.  They are a string builder interface somewhat
akin to a completely dynamic sbuf.

Reviewed by:	bde, jilles (earlier versions)
MFC after:	1 month
2013-02-27 19:50:46 +00:00
Simon J. Gerraty
ea7315fe66 Cleanup 2013-02-17 23:46:17 +00:00
Simon J. Gerraty
b068afb4a2 Avoid problems with read-only osreldate.h 2013-02-16 01:36:14 +00:00
Simon J. Gerraty
ddafe92543 ftpd needs telnet.h so install it regardless 2013-02-16 01:32:03 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00