summaryrefslogtreecommitdiffstats
path: root/lib/libc
Commit message (Collapse)AuthorAgeFilesLines
* - Return NULL and set errno to EINVAL if size is 0 (as required by POSIX).gahr2014-06-022-8/+18
| | | | | | | | | | Update the manpage to reflect this change. - Always set the current position to the first null-byte when opening in append mode. This makes the implementation compatible with glibc's. Update the test suite. Reported by: pho Approved by: cognet
* Minor mdoc fixbjk2014-05-301-1/+1
| | | | | Submitted by: hrs Approved by: hrs (mentor, implicit)
* Fix strcasecmp_l() and strncasecmp_l() POSIX 2008 compliance.pfg2014-05-301-2/+2
| | | | | | | | | | | | 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
* mdoc: add missing paragraph macro.pluknet2014-05-291-0/+1
|
* Emphasis on 'do not' and 'complement' in the strcspn(3)allanjude2014-05-271-5/+6
| | | | | | Replace literal parentheses with .Po/.Pc Approved by: wblock (mentor)
* Merge strcspn.3 into strspn.3 and clarify the explaination of what they doallanjude2014-05-253-98/+37
| | | | | | | Detach strcspn.3 from the build Add strcspn.3 to MLINKS do it will be symlinked to strspn.3 Approved by: eadler (mentor), bcr (mentor)
* Correct documentation of the limit on how much memory can be mlock()edbjk2014-05-171-7/+14
| | | | | | | | | vm.max_wired is a system-wide limit, not per-process. Reword the section to make this more clear. PR: docs/189214 Submitted by: Lawrence Chen (original text) Approved by: hrs (mentor)
* Invalidate the cache for the named posix semaphore when opened andkib2014-05-101-29/+36
| | | | | | | | | | | | | | | | | | | actual file storing the semaphore object is different from the file created on the first open. Store the file st_dev and st_ino members of the struct stat in the semaphore structure on open, and compare them with the attributes of the opened file to detect unlink and re-creation. This fixes an issue of sem_unlink(3) failing to flush the named entry in the semaphore list for the current or remote process, making sem_unlink(3) not correctly operating if the unlinked semaphore is still opened. Reported by: Joris Giovannangeli <joris@giovannangeli.fr> PR: standards/189353 Reviewed by: jilles (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week
* Style.kib2014-05-101-2/+2
| | | | | Sponsored by: The FreeBSD Foundation MFC after: 1 week
* msync(2) must return ENOMEM and not EINVAL when the address is outside thepho2014-05-071-5/+7
| | | | | | | | | | | allowed range or when one or more pages are not mapped. This according to The Open Group Base Specifications Issue 7. Discussed with: attilio, Bruce Evans Reviewed by: alc, Garrett Cooper Reported by: ATF MFC after: 2 weeks Sponsored by: EMC / Isilon storage division
* Use src.opts.mk in preference to bsd.own.mk except where we need stuffimp2014-05-061-1/+1
| | | | from the latter.
* Revert r265367:pfg2014-05-051-1/+1
| | | | | | | | Use of calloc instead of malloc in regex (from OpenBSD). In this case the change makes no sense since we are using realloc() later. Reported by: ache
* regex: Use calloc instead of malloc.pfg2014-05-051-1/+1
| | | | | | | Mostly to reduce differences with OpenBSD. Obtained from: OpenBSD (CVS rev. 1.17) MFC after: 3 days
* Properly free resources in case of error.brueffer2014-05-021-8/+6
| | | | | | CID: 1007032 Found with: Coverity Prevent(tm) MFC after: 2 weeks
* regex: Remove some unreachable breaks.pfg2014-05-012-7/+1
| | | | | | | | | This is based on a much bigger cleanup done in Illumos. Reference: https://www.illumos.org/issues/2077 MFC after: 1 week
* citrus: Avoid invalid code points.pfg2014-05-011-2/+1
| | | | | | | | | | | | | From the OpenBSD log: The UTF-8 decoder should not accept byte sequences which decode to unicode code positions U+D800 to U+DFFF (UTF-16 surrogates), U+FFFE, and U+FFFF. http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 http://unicode.org/faq/utf_bom.html#utf8-4 Reported by: Stefan Sperling Obtained from: OpenBSD MFC after: 5 days
* citrus: Avoid invalid code points.pfg2014-04-291-0/+8
| | | | | | | | | | | | | From the OpenBSD log: The UTF-8 decoder should not accept byte sequences which decode to unicode code positions U+D800 to U+DFFF (UTF-16 surrogates), U+FFFE, and U+FFFF. http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 http://unicode.org/faq/utf_bom.html#utf8-4 Reported by: Stefan Sperling Obtained from: OpenBSD MFC after: 5 days
* Set the new floating point exception mask correctlyandrew2014-04-281-1/+1
| | | | Submitted by: Keith White <kwhite@site.uottawa.ca>
* libc/stdio: Fail fdopen() on an execute-only fd.jilles2014-04-212-3/+5
| | | | | | | | | An execute-only fd (opened with O_EXEC) allows neither read() nor write() and is therefore incompatible with all stdio modes. Therefore, the [EINVAL] error applies. Also adjust the similar check in freopen() with a NULL path, even though this checks an fd which is already from a FILE.
* Rename the fp{get,set}* files so they no longer conflict with the softfloatandrew2014-04-217-2/+2
| | | | | version of these files. Keep them within this directory so they can be used to implement the armv6 version of these functions.
* Add the deprecated fp{get,set}* functions, a few ports use them.andrew2014-04-207-0/+304
|
* Correct sorting.brueffer2014-04-151-1/+1
|
* Mention Capsicum.brueffer2014-04-151-1/+7
| | | | MFC after: 1 week
* realpath(): Properly fail "." or ".." components after non-directories.jilles2014-04-131-20/+6
| | | | | | | | | | | | | If realpath() is called on pathnames like "/dev/null/." or "/dev/null/..", it should fail with [ENOTDIR]. Pathnames like "/dev/null/" already failed as they should. Also, put the check for non-directories after lstatting the previous component instead of when the empty component (consecutive or trailing slashes) is detected, saving an lstat() call and some lines of code. PR: kern/82980 MFC after: 2 weeks
* Fix table alignment. EVFILT_PROCDESC is longer than the existing filters.ed2014-04-071-1/+1
|
* Implement kqueue(2) for procdesc(4).ed2014-04-072-2/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | kqueue(2) already supports EVFILT_PROC. Add an EVFILT_PROCDESC that behaves the same, but operates on a procdesc(4) instead. Only implement NOTE_EXIT for now. The nice thing about NOTE_EXIT is that it also returns the exit status of the process, meaning that we can now obtain this value, even if pdwait4(2) is still unimplemented. Notes: - Simply reuse EVFILT_NETDEV for EVFILT_PROCDESC. As both of these will be used on totally different descriptor types, this should not clash. - Let procdesc_kqops_event() reuse the same structure as filt_proc(). The only difference is that procdesc_kqops_event() should also be able to deal with the case where the process was already terminated after registration. Simply test this when hint == 0. - Fix some style(9) issues in filt_proc() to keep it consistent with the newly added procdesc_kqops_event(). - Save the exit status of the process in pd->pd_xstat, as we cannot pick up the proctree_lock from within procdesc_kqops_event(). Discussed on: arch@ Reviewed by: kib@
* Add support for UDP-Lite protocol (RFC 3828) to IPv4 and IPv6 stacks.kevlo2014-04-071-0/+5
| | | | | | | | Tested with vlc and a test suite [1]. [1] http://www.erg.abdn.ac.uk/~gerrit/udp-lite/files/udplite_linux.tar.gz Reviewed by: jhb, glebius, adrian
* Move definitions out of rpc_com so that the linker doesn't complain abouttheraven2014-04-062-2/+5
| | | | | | multiple definitions. Reported by: sbruno
* Accept RFC 2292 option values so that RFC 2292 compliant programs thatmarcel2014-04-051-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | are unaware of RFC 3542 can construct control messages. The kernel disallows mixing RFC 2292 behaviour with RFC 3542 behaviour. Only sockets that have specifically been marked as using the RFC 2292 API can use RFC 2292 specific options. This is all good and well, but libc itself seems inconsistent with this. The root cause of this inconsistency seems to relate to the definitions of IPV6_HOPOPTS and IPV6_DSTOPTS. They are defined in RFC 2292 and re-used in RFC 3542, yet have distinct values in the kernel. It's for this reason that the kernel also has definitions for IPV6_2292HOPOPTS and IPV6_2292DSTOPTS. Not so in libc. For example: some program calls inet6_option_init() (defined by RFC 2292) with the RFC 2292 defined IPV6_HOPOPTS and IPV6_DSTOPTS. Before RFC 3542, this was translated to values of 22 and 23 (resp.) The libc implementation correctly checks that only options IPV6_HOPOPTS and IPV6_DSTOPTS are given (as per RFC 2292) but since these defines have taken on the values defined by RFC 3542 (values 49 and 50 resp,) rejects the correct option values (22 and 23) passed said program and returns -1. The precisie fix is to have inet6_option_init() and friends only accept the RFC 2292 defined IPV6_HOPOPTS & IPV6_DSTOPTS, but that breaks other code (like mld6query(8)), which seem to not be aware of RFC 3542 and how it hi-jacked the option names. So the best fix is to accept the options from both. Obtained from: Juniper Networks, Inc. MFC after: 1 week
* The getlogin_basic() function can return a 0 status with a NULLmarcel2014-04-051-3/+8
| | | | | | | | | pointer for the login name (result). Make sure to handle that case properly. Improve robustness by checking namelen and then nul-terminating the provided buffer to simplify subsequent logic. Obtained from: Juniper Networks, Inc. MFC after: 1 week
* Convert from WITHOUT_SYSCALL_COMPAT to MK_SYSCALL_COMPAT.imp2014-04-059-9/+9
|
* Silence a warning with GCC that was breaking the build with Juniper's GCC.theraven2014-04-053-4/+7
| | | | Reviewed by: marcel
* Correct return type of pdfork(2).ed2014-04-041-2/+2
| | | | | | | | | | The pdfork(2) man page states: "pdfork() returns a PID, 0 or -1, as fork(2) does." As it returns a PID, the return type should obviously be pid_t. As int and pid_t have the same size on all architectures, this change does not affect the ABI in any way.
* Fix the inheritance of the FBSDprivate_1.0 namespace.theraven2014-04-031-1/+1
|
* Move _b functions into the 11.x symbol version namespace.theraven2014-04-033-5/+16
|
* Add an extra void* cast to work around a bug in FreeBSD-gcc inheritedtheraven2014-04-031-1/+1
| | | | from Apple.
* Move scandir_b to a later symbol version.theraven2014-04-021-1/+1
|
* Add support for some block functions that come from OS X. These aretheraven2014-04-0217-30/+390
| | | | | | | intended to build with any C compiler. Reviewed by: pfg MFC after: 3 weeks
* Fix an issue where the locale and rune locale could become out of sync,theraven2014-04-022-9/+9
| | | | | | | | causing mb* functions (and similar) to be called with the wrong data (possibly a null pointer, causing a crash). PR: standards/188036 MFC after: 1 week
* - In the libiconv module for ISO 2022 restore the original order of thetijl2014-04-0113-28/+25
| | | | | | | | | | | | | | | | | | | | | fields of a private struct such that variables of this type are initialised correctly. Fixes conversion from ISO 2022. Also do this in the BIG5 module to prevent similar errors in the future. - In the libiconv module for EUC-TW replace 2^cs with 1<<cs. Fixes conversion from EUC-TW. - Synchronise iconv code with NetBSD. In most cases this only updates the RCS id because the changes are already there or are NetBSD specific. + libc/iconv/citrus_csmapper.c: Add a comment. + libc/iconv/citrus_db_factory.c: Remove put16(). + libc/iconv/citrus_iconv.c: Return EINVAL on error. + libc/iconv/citrus_mapper.c: Return EINVAL on error. + libc/iconv/citrus_memstream.c: Fix type of a variable. + libc/iconv/citrus_prop.h: Sync definition of _CITRUS_PROP_HINT_END. + libc/iconv/citrus_stdenc.c: Return EINVAL on error. + libiconv_modules/mapper_std/citrus_mapper_std.c: Plug memory leak. Obtained from: NetBSD MFC after: 2 weeks
* Use the correct variable name in the example code.eadler2014-03-301-1/+1
|
* Update system man pages for s/capability.h/capsicum.h/.rwatson2014-03-277-14/+15
| | | | MFC after: 3 weeks
* Add a new ARM TARGET_ARCH, armv6hf. This is considered experimental.andrew2014-03-232-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | This targets the existing ARMv6 and ARMv7 SoCs that contain a VFP unit. This is an optional coprocessors may not be present in all devices, however it appears to be in all current SoCs we support. armv6hf targets the VFP variant of the ARM EABI and our copy of gcc is too old to support this. Because of this there are a number of WITH/WITHOUT options that are unsupported and must be left as the default value. The options and their required value are: * WITH_ARM_EABI * WITHOUT_GCC * WITHOUT_GNUCXX In addition, without an external toolchain, the following need to be left as their default: * WITH_CLANG * WITH_CLANG_IS_CC As there is a different method of passing float and double values to functions the ABI is incompatible with existing armv6 binaries. To use this a full rebuild of world is required. Because no floating point values are passed into the kernel an armv6 kernel with VFP enabled will work with an armv6hf userland and vice versa.
* Implement __flt_rounds for ARMv6 hard-float. The fpscr register stores theandrew2014-03-221-10/+14
| | | | current rounding mode used by the VFP unit.
* Remove an extra 1 in an #if lineandrew2014-03-161-1/+1
| | | | Reported by: ian@
* Fix the spelling of function.andrew2014-03-162-2/+2
| | | | Reported by: ian@
* Add an optimised version of the float and double helper functions. Theseandrew2014-03-166-124/+537
| | | | | | | are only used on armv6 when the vfp unit is detected. They will also be available for the upcoming armv6hf platform, however while not used by default there will need to be defined for any software that calls them directly.
* Update most userspace consumers of capability.h to use capsicum.h instead.rwatson2014-03-161-1/+1
| | | | | | | auditdistd is not updated as I will make the change upstream and then do a vendor import sometime in the next week or two. MFC after: 3 weeks
* To avoid missing a chance to cancel thread, call _pthread_testcancel at thedavidxu2014-03-131-0/+1
| | | | | | | beginning of _sem_timedwait. Submitted by: Eric van Gyzen &lt; eric at vangyzen dot net &gt; MFC after: 3 days
* Make ether_line really report an error when all input is invalid.jmmv2014-03-121-5/+7
| | | | | | | | | | | | The previous code failed to return an error condition when the whole input was invalid due to improper handling of the sscanf return value. Actually, this failure was properly being caught by a test in tools/regression/lib/libc/net/test-ether.t but was not noticed because these tests are never run. (On my way to fixing that ;-) The fix applied here resembles the implementation of ether_line in NetBSD modulo the setting of an errno value (which is not documented as an expectation in the manpage anyway).
OpenPOWER on IntegriCloud