summaryrefslogtreecommitdiffstats
path: root/lib/libc
Commit message (Collapse)AuthorAgeFilesLines
...
* In ARM asm code, ensure that every ENTRY(foo) has a matching END(foo).ian2014-08-3122-1/+36
| | | | | | | | | 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
* Fix "make checkdpadd" for lib/libc when MK_SSP != nongie2014-08-251-0/+1
| | | | | | | | | | 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
* Add missing break.pfg2014-08-201-0/+1
| | | | CID: 603368
* From https://sourceware.org/ml/newlib/2014/msg00113.htmlimp2014-08-141-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add support for the SCTP_PR_STREAM_STATUS and SCTP_PR_ASSOC_STATUStuexen2014-08-131-0/+6
| | | | | | | | | 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
* Fixed ENOMEM description.pluknet2014-08-131-1/+1
| | | | | MFC after: 1 week Sponsored by: Nginx, Inc.
* Minor style tweaks.pfg2014-08-131-7/+7
| | | | | Obtained from: OpenBSD (CVS rev. 1.7) MFC after: 3 days
* Fix broken pointer overflow check ns_name_unpack()ume2014-08-121-2/+3
| | | | | | | | | | | | | | 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)
* Update our stub resolver to final version of libbind.ume2014-08-1236-199/+909
| | | | Obtained from: ISC
* Bring the md5 functions into libc for internal use only.ume2014-08-122-0/+6
| | | | | It is required to support ID randomization for our stub resolver.
* Add support for the SCTP_AUTH_SUPPORTED and SCTP_ASCONF_SUPPORTEDtuexen2014-08-121-0/+7
| | | | | | socket options. Add also a sysctl to control the support of ASCONF. MFC after: 1 week
* Const-ify character stringpfg2014-08-071-1/+1
| | | | | Obtained from: Apple Inc. (Libc 997.90.3) MFC after: 3 days
* fix misordering...jmg2014-08-041-3/+3
| | | | | Obtained from: gjb MFC after: 1 week
* add xrefs for the other functions...jmg2014-08-041-1/+5
| | | | | | | 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
* Add support for the SCTP_RECONFIG_SUPPORTED and the correspondingtuexen2014-08-041-0/+3
| | | | | | sysctl controlling the negotiation of the RE-CONFIG extension. MFC after: 3 days
* Add support for the SCTP_PKTDROP_SUPPORTED socket option andtuexen2014-08-031-0/+3
| | | | | | | the corresponding sysctl variable. The default is off, since the specification is not an RFC yet. MFC after: 1 week
* Add SCTP socket option SCTP_NRSACK_SUPPORTED to control thetuexen2014-08-031-0/+3
| | | | | | | | 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
* Add support for the SCTP_PR_SUPPORTED socket option as specified intuexen2014-08-021-0/+3
| | | | | | | 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
* Cleanup the ECN configuration handling and provide an SCTP sockettuexen2014-08-021-0/+3
| | | | | | | 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.
* Fix the example: free the memory that was allocated by getline().n_hibma2014-07-311-0/+1
|
* If telldir() is called immediately after a call to seekdir(), POSIXjhb2014-07-292-28/+26
| | | | | | | | | | | | | | 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
* strftime() xlocale cleanups.pfg2014-07-261-37/+46
| | | | | | | | | | | 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
* In the "Too many open files" edge cases don't try to preserve oldache2014-07-261-0/+8
| | | | | | | number for non-std* descriptors, but close old file and retry. Obtained from: inspired by Apple's change from pfg@ MFC after: 2 weeks
* POSIX says that passing a location returned by telldir() to seekdir()jhb2014-07-241-0/+1
| | | | | | | | | 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
* Avoid possible cast degradation.pfg2014-07-222-2/+2
| | | | | | | | | | | 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
* For "a"-mode files and rewind/fseek + fwrite combination return meaningfulache2014-07-221-0/+18
| | | | | value now, like Apple does, but avoid their __sflush physical write performance degradation as much as possible.
* Back the whole change out until I figure out how to obtain O_APPEND,ache2014-07-221-6/+0
| | | | it can't be used in this field at all.
* Checking for __SAPP alone is not enough because it is emulated O_APPENDache2014-07-221-1/+2
| | | | only, so works for only special fdopen() case. Add real O_APPEND too.
* Revert r268984:pfg2014-07-221-2/+5
| | | | | | | | Check for __SAPP flag before calling sflush. This avoids performance degradation compared to the previous approach. Submitted by: ache MFC after: 2 weeks
* Mostly cosmetic cleanups.pfg2014-07-222-3/+3
| | | | | | In fputs() avoid implcit casting on iov.iov_len. MFC after: 3 days
* ftello: return 1 when seeking offset on an append stream.pfg2014-07-221-0/+2
| | | | | | Obtained from: Apple Inc. (Libc 997.90.3) Phabric: D442 MFC after: 2 weeks
* rewind: always clear error indicator.pfg2014-07-221-3/+2
| | | | | | | | Required by POSIX: http://pubs.opengroup.org/onlinepubs/009695399/functions/rewind.html Obtained from: Apple Inc. (Libc 997.90.3) MFC after: 1 week
* Fix hdestroy() compliance issue.pfg2014-07-211-1/+0
| | | | | | | | | | | | | | | | | | | 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
* Update license.pfg2014-07-211-7/+2
| | | | | | NetBSD has removed the advertisement clause from this file. Obtained from: NetBSD (CVS rev. 1,8)
* Add re-entrant versions of the hash functions based on the GNU api.pfg2014-07-214-41/+153
| | | | | | | 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)
* Adjust errno on failed prepwrite.pfg2014-07-203-3/+10
| | | | | | Obtained from: Apple Inc. (Libc 997.90.3) Phabric: D442 MFC after: 1 week
* Const-ify a character string.pfg2014-07-201-1/+1
| | | | | Obtained from: Apple Inc. (Libc 997.90.3) MFC after: 3 days
* Use a correct errno in freopen.pfg2014-07-201-1/+1
| | | | | | | | | 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
* Update fflush(3) to return success on a read-only stream.pfg2014-07-201-9/+16
| | | | | | | | | | 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
* Add dl_unwind_find_exidx() for ARM EABI, required for C++ exceptionian2014-07-193-1/+111
| | | | | | | | | | | | | | | | 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
* Clean r268867.pfg2014-07-191-1/+1
| | | | Proposed by: bde
* Use unsigned optlen in getsourcefilter()pfg2014-07-191-1/+2
| | | | | | | | 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
* ttyname(3): Fix EBADF/ENOTTY error descriptions.jilles2014-07-181-5/+21
| | | | | | | | Also, make sure to document the return values and errors for all three functions in the man page. PR: 191931 MFC after: 1 week
* Extend kqueue's EVFILT_TIMER by adding precision unit flags supportbapt2014-07-181-3/+20
| | | | | | | | | 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
* libc/stdlib: Minor cleanups to code originating in NetBSDpfg2014-07-153-22/+14
| | | | | | | Mostly ANSIfication and typos. Obtained from: NetBSD MFC after: 5 days
* Document that listen(2) can fail with EDESTADDRREQ.kevlo2014-07-151-1/+4
|
* libc/gen: small updates to code originating at OpenBSDpfg2014-07-152-19/+8
| | | | | | | | | | | | | | | | | | | 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
* Make generation of nslexer.c more robust.jmmv2014-07-141-3/+5
| | | | | | | | | | | | | | | | | | 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.
* strfmon: reduce unnecessary snprintf.pfg2014-07-121-5/+3
| | | | | | | No need for the snprintf/asprintf dance; use fixed width formats. Obtained from: NetBSD (CVS rev. 1.8) MFC after: 1 week
* Fix some edge cases with rewinddir():jhb2014-07-115-165/+225
| | | | | | | | | | | | | | | | | | | | | - 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
OpenPOWER on IntegriCloud