Commit Graph

7399 Commits

Author SHA1 Message Date
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
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
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
Joel Dahl
cfaa96f327 Minor mdoc nit. 2014-09-09 14:34:54 +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
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
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
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
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
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
Pedro F. Giffuni
6804aa1b68 Add missing break.
CID:	603368
2014-08-20 14:58:25 +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
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
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
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
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
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
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
Nick Hibma
500e59c62d Fix the example: free the memory that was allocated by getline(). 2014-07-31 08:28:42 +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
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
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
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