summaryrefslogtreecommitdiffstats
path: root/lib/libc
Commit message (Collapse)AuthorAgeFilesLines
...
* MFC r315033asomers2017-04-021-0/+1
| | | | | | | | | | | Increase WARNS for nss tests ATF tests have a default WARNS of 0, unlike other usermode programs. Reviewed by: ngie MFC after: 3 weeks Sponsored by: Spectra Logic Corporation Differential Revision: https://reviews.freebsd.org/D9933
* MFC r315032asomers2017-04-021-0/+1
| | | | | | | | | | | Increase WARNS for iconv tests ATF tests have a default WARNS of 0, unlike other usermode programs. Reviewed by: ngie MFC after: 3 weeks Sponsored by: Spectra Logic Corporation Differential Revision: https://reviews.freebsd.org/D9933
* MFC r315734:ngie2017-03-301-5/+5
| | | | style(9): sort #includes
* MFC r315694vangyzen2017-03-251-26/+36
| | | | | | | | | | clock_gettime.2: add some clock IDs Add the CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID clock_id values to the clock_gettime(2) man page. Reformat the excessively long paragraph (sentence!) into a tag list. Sponsored by: Dell EMC
* MFC r315720 (from cem@)pfg2017-03-221-1/+1
| | | | | | | | | | | scandir: Fix NULL dereference, uninitialized value use in error case This bug was introduced in r315095. Given that it obviously is a bug and we can't afford to have such creatures in libc, do an early merge, Reported by: Coverity CIDs: 1329566, 1372625 Sponsored by: Dell EMC Isilon
* MFC r313690:kib2017-03-191-3/+35
| | | | | | | | Consistently handle negative or wrapping offsets in the mmap(2) syscalls. MFC r315158: Fix two missed places where vm_object offset to index calculation should use unsigned shift.
* MFC r315095, r315096, r315097, r315187:pfg2017-03-154-14/+13
| | | | | | | | | | | | | | | | libc: small cleanups. Rename nitems to numitems: it shares the anme with an existing macro in sys/params.h. Also initialize the value later which avoids asigning the value if we exit early. Unsign setlen: it is local and will never be negative. Having one more bit for growth is beneficial and it avoids a cast when it's going to be used for allocation. Remove unused initialization: "num" is properly defined before use. Let calloc(3) do the multiplication.
* MFC r314179 r314206 r314424vangyzen2017-03-146-25/+97
| | | | | | | | | | | | | | | | | Add sem_clockwait_np() This function allows the caller to specify the reference clock and choose between absolute and relative mode. In relative mode, the remaining time can be returned. The API is similar to clock_nanosleep(3). Thanks to Ed Schouten for that suggestion. While I'm here, reduce the sleep time in the semaphore "child" test to greatly reduce its runtime. Also add a reasonable timeout. Relnotes: yes Sponsored by: Dell EMC
* MFC r315225:delphij2017-03-141-1/+1
| | | | | | | | Discard first 3072 bytes of RC4 keystream, this is a bandaid that allows us to work on switching to a more modern PRNG. Submitted by: Steven Chamberlain <steven pyro eu org> Approved by: so
* MFC r314807:ngie2017-03-131-1/+1
| | | | Move ATF_TC_WITHOUT_HEAD(getgrent) near the testcase it annotates
* MFC r314556-r314558brooks2017-03-1116-40/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r314556: Correct MDSRCS use in <arch>/string/Makefile.inc. - Remove .c files which duplicate entries in MISRCS. - Use the same, less merge conflict prone style in all cases. - Use MDSRCS for mips (.c and .S files both ended up in SRCS). - Remove pointless sparc64 Makefile.inc. - Remove uninformative foreign VCS ID entries. Reviewed by: emaste, imp, jhb MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D9841 r314557: Correct an misunderstanding of MDSRCS. MDSRCS it intended to allow assembly versions of funtions with C implementations listed in MISRCS. The selection of the correct machdep_ldis?.c for a given architecture does not follow this pattern and the file should be added to SRCS directly. Reviewed by: emaste, imp, jhb MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D9841 r314558: Garbage collect unused gdtoa related files on mips. Reviewed by: emase, imp, jhb MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D9841
* MFC r314055vangyzen2017-03-101-58/+54
| | | | | | Make several improvements and corrections in the kenv(2) man page Sponsored by: Dell EMC
* MFC r313748, r313749:markj2017-03-101-15/+15
| | | | Register nss_atexit() before parsing nsswitch.conf for the first time.
* MFC r313439,r314450:ngie2017-03-072-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r313439: Merge content from ^/projects/netbsd-tests-upstream-01-2017 into ^/head The primary end-goal of this drop is ease future merges with NetBSD and collaborate further with the NetBSD project. The goal was (largely, not completely as some items are still oustanding in the NetBSD GNATS system) achieved by doing the following: - Pushing as many changes required to port contrib/netbsd-tests back to NetBSD as possible, then pull the upstream applied changes back in to FreeBSD. - Diff reduce with upstream where possible by: -- Improving libnetbsd header, etc compat glue. -- Using _SED variables to modify test scripts on the fly for items that could not be upstreamed to NetBSD. As a bonus for this work, this change also introduces testcases for uniq(1). Many thanks to Christos for working with me to get many of the changes back into the NetBSD project. In collaboration with: Christos Zoulas <christos@netbsd.org> r314450: Add additional __FreeBSD_version guards around the hsearch_r testcases The reasoning for this is the same as r276046: to ease MFCing the tests to ^/stable/10 . This was accidentally missed in r313439
* MFC r309626,r309627,r309659:bdrewery2017-03-031-5/+10
| | | | | | | | | r309626: strvis(3): Avoid internal state of multibyte functions being tainted. r309627: Remove unneeded hack fixed by r309626. r309659: Support spaces in group names.
* MFC r311954, r311996, r312077, r312080:ian2017-03-021-3/+30
| | | | | | | | | | | | | | | | | | | | | | | | | Rework tty_drain() to poll the hardware for completion, and restore drain timeout handling to historical freebsd behavior. The primary reason for these changes is the need to have tty_drain() call ttydevsw_busy() at some reasonable sub-second rate, to poll hardware that doesn't signal an interrupt when the transmit shift register becomes empty (which includes virtually all USB serial hardware). Such hardware hangs in a ttyout wait, because it never gets an opportunity to trigger a wakeup from the sleep in tty_drain() by calling ttydisc_getc() again, after handing the last of the buffered data to the hardware. Restructure the tty_drain loop so that device-busy is checked one more time after tty_timedwait() returns an error only if the error is EWOULDBLOCK; other errors cause an immediate return. This fixes the case of the tty disappearing while in tty_drain(). Check tty_gone() after allocating IO buffers. The tty lock has to be dropped then reacquired due to using M_WAITOK, which opens a window in which the tty device can disappear. Check for this and return ENXIO back up the call chain so that callers can cope. Correct the comments about how much buffer is allocated.
* MFC r313374:ngie2017-02-141-4/+4
| | | | | | | | hcreate(3): fix the ERRORS section and bump .Dd - Add missing comma between functions that trigger ENOMEM error. - Fix the description for ESRCH. The action that triggers this error is FIND, not SEARCH (SEARCH does not exist).
* MFC r313378,r313379:ngie2017-02-141-10/+12
| | | | | | | | | | | | | | | | | | | | | | | | | r313378: Wrap strcmp/wcscmp calls with ATF_CHECK_MSG and drop atf_tc_fail use The reasoning here was the same as what was done in r313376: - Gather as many results as possible instead of failing early and not testing the rest of the cases. - Simplify logic when checking test inputs vs outputs and printing test result. r313379: Expect :int_within_limits to fail when ptrdiff_t/*intmax_t differ in base type The %t{d,u} (ptrdiff_t) tests fail for the following reasons: - ptrdiff_t is by definition int32_t on !LP64 architectures and int64_t on LP64 architectures. - intmax_t is by definition fixed to int64_t on all architectures. - Some of the code in lib/libc/stdio/... is promoting ptrdiff_t to *intmax_t when parsing/representing the value. PR: 191674
* MFC r313376:ngie2017-02-141-11/+8
| | | | | | | | | | | | | | | | Fix :hexadecimal_floating_point on i386 Don't exclude i386 from LDBL_MANT_DIG == 64; it works properly in that case. While here, replace strcmp + atf_tc_fail with ATF_CHECK_MSG for 2 reasons: - Gather as many results as possible instead of failing early and not testing the rest of the cases. - Simplify logic when checking test inputs vs outputs and printing test result. Tested on: amd64, i386
* MFC r312008:ngie2017-02-123-1/+17
| | | | | | | | | | | | | Upgrade NetBSD tests to 01.11.2017_23.20 snapshot This contains some new testcases in /usr/tests/...: - .../lib/libc - .../lib/libthr - .../lib/msun - .../sys/kern Tested on: amd64, i386
* MFC r313174: Clean up documentation of AF_UNIX control messages.jilles2017-02-101-51/+4
| | | | | | | | | | Document AF_UNIX control messages in unix(4) only, not split between unix(4) and recv(2). Also, warn about LOCAL_CREDS effective uid/gid fields, since the write could be from a setuid or setgid program (with the explicit SCM_CREDS and LOCAL_PEERCRED, the credentials are read at such a time that it can be assumed that the process intends for them to be used in this context).
* MFC r312418,r312422:ngie2017-02-102-4/+8
| | | | | | | | | | | | | | | | | | | | r312418: Conditionalize hyperv support in gettimeofday(2) based on MK_HYPERV The effect at runtime is negligible as the hyperv timer isn't available except when hyperv is loaded. This is a prerequisite for conditionalizing the header build/install out of the build r312422: Only conditionally add in hyperv support if we're building amd64 This unbreaks the build because the assembly is written for x64. Pointyhat to: ngie
* MFC r306349:ngie2017-02-101-4/+9
| | | | | | | | | | | r306349 (by pfg): hash(3): protect in-memory page when using cross-endianness. When writing out pages in the "other endian" format, make a copy instead of trashing the in-memory one. Obtained from: NetBSD (CVS rev. 1.29)
* MFC 310638:jhb2017-02-083-10/+16
| | | | | | | | | | Rename the 'flags' argument to getfsstat() to 'mode' and validate it. This argument is not a bitmask of flags, but only accepts a single value. Fail with EINVAL if an invalid value is passed to 'flag'. Rename the 'flags' argument to getmntinfo(3) to 'mode' as well to match. This is a followup to r308088.
* MFC r312332,r312446,r312451:ngie2017-02-0414-21/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r312332: Use SRCTOP where possible and use :H to manipulate .CURDIR to get rid of unnecessarily long relative path .PATH values with make r312446 (by emaste): libc: remove reference to nonexistent lib/locale directory As far as I can tell this was introduced in r72406 and updated in several subsequent revisions, but the lib/locale directory it referenced never existed. r312451: Replace dot-dot relative pathing with SRCTOP-relative paths where possible This reduces build output, need for recalculating paths, and makes it clearer which paths are relative to what areas in the source tree. The change in performance over a locally mounted UFS filesystem was negligible in my testing, but this may more positively impact other filesystems like NFS. LIBC_SRCTOP was left alone so Juniper (and other users) can continue to manipulate lib/libc/Makefile (and other Makefile.inc's under lib/libc) as include Makefiles with custom options. Discussed with: marcel, sjg
* MFC r311925,r311968,r311969,r312102,r312108:ngie2017-02-041-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r311925: Import testcase updates with code contributed back to NetBSD This also (inadvertently) contains an update to contrib/netbsd-tests/lib/libc/sys/t_wait.c (new testcases). In collaboration with: christos@NetBSD.org r311968: Fix lib/libc/sys/access_test after r311925 sys/param.h needs to be #included in order for __FreeBSD_version to be checked r311969: Remove __HAVE_LONG_DOUBLE #define from t_strtod.c and place it in Makefile This is to enable support in other testcases Inspired by lib/msun/tests/Makefile . r312102: Note that sys/types.h is required on FreeBSD for kqueue(2), unlike NetBSD r312108: Delete trailing whitespace and use __arraycount instead of nitems in contrib code
* MFC r309200:markj2017-02-031-1/+3
| | | | Launder VPO_NOSYNC pages upon vnode deactivation.
* MFC r312547: Mention sendfile(2) by popular demand.wblock2017-01-271-2/+8
| | | | Sponsored by: iXsystems
* MFC r311651:kib2017-01-215-106/+164
| | | | Export __cxa_thread_atexit_impl as an alias for __cxa_thread_atexit.
* MFC 312083:wblock2017-01-201-14/+39
| | | | | | Update the shm_open.2 man page to reflect objective reality. Sponsored by: iXsystems
* MFC r311287:kib2017-01-111-19/+35
| | | | | __vdso_gettc(): be extra careful with /dev/hpet mappings, never unmap the mapping which might be accessed by other threads.
* MFC r310984,r311102:ngie2017-01-091-8/+4
| | | | | | | | | | r310984: Use calloc instead of malloc + memset(.., 0, ..) r311102 (by pfg): Cleanup inelegant calloc(3) introduced in r310984.
* MFC 310048,310101,310239sephe2017-01-051-0/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 310048 hyperv: Implement "enlightened" time counter, which is rdtsc based. Reviewed by: kib Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8763 310101 hyperv: Allow userland to ro-mmap reference TSC page This paves way to implement VDSO for the enlightened time counter. Reviewed by: kib Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8768 310239 hyperv: Implement userspace gettimeofday(2) with Hyper-V reference TSC This 6 times gettimeofday performance, as measured by tools/tools/syscall_timing Reviewed by: kib Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8789
* MFC r310976:pfg2017-01-051-12/+12
| | | | | | | Move __hidden attribute towards the end of the declaration. Apple had them at the start but moving them to the end is better for faster reading and fits better what is done in other FreeBSD headers.
* MFC r309650:ed2016-12-202-2/+9
| | | | | | | | | Properly sign extend the result of jrand48() and mrand48(). These functions are supposed to return a value between [-2^31, 2^31). This doesn't seem to work on 64-bit systems, where we return a value between [0, 3^32). Patch up the function to use proper casts to int32_t. While there, fix some other style bugs.
* MFC r308386:trasz2016-12-191-1/+3
| | | | | Document that getfsstat(2) called with MNT_NOWAIT skips file systems that are in the process of being unmounted.
* MFC r309683:tuexen2016-12-181-1/+1
| | | | | Fix a bug in sctp_sendmsgx(), where the sid provided by the user was hot honored.
* MFC r309460vangyzen2016-12-131-14/+11
| | | | | | | | | | | | | | | thr_set_name(): silently truncate the given name as needed Instead of failing with ENAMETOOLONG, which is swallowed by pthread_set_name_np() anyway, truncate the given name to MAXCOMLEN+1 bytes. This is more likely what the user wants, and saves the caller from truncating it before the call (which was the only recourse). Polish pthread_set_name_np(3) and add a .Xr to thr_set_name(2) so the user might find the documentation for this behavior. Sponsored by: Dell EMC
* MFC r305855, r306297, r306300, r306312-r306313marcel2016-12-111-1/+8
| | | | | | | | | | | | | | When MAKEOBJDIRPREFIX points to a case-insensitive file system, the build can break when different source files create the same object files (case-insensitivity speaking). This is the case for object files compiled with -fpic and shared libraries. The former uses an extension of ".So", and the latter an extension ".so". Rename shared object files from *.So to *.pico to match what NetBSD does. Also: o Compile _Exit.c as C99_Exit.c, as it conflicts with _exit.s o Add entry to UPDATING o Document .pico extension
* Merge rr309688: address regressions in SA-16:37.libc.glebius2016-12-071-6/+5
| | | | | PR: 215105 Submitted by: <jtd2004a sbcglobal.net>
* Merge r309639 from head:glebius2016-12-061-17/+34
| | | | | | | | | | | Fix possible buffer overflow(s) in link_ntoa(3). A specially crafted sockaddr_dl argument can trigger a static buffer overflow in the libc library, with possibility to rewrite with arbitrary data following static buffers that belong to other library functions. Reviewed by: kib Security: FreeBSD-SA-16:37.libc
* MFC r307220:ngie2016-12-061-2/+2
| | | | | | r307220 (by br): Fix typos: use correct string format and value to compare.
* MFC r309026: open(2): Clarify non-POSIX error when opening a symlink withjilles2016-12-041-1/+17
| | | | | | | | | | O_NOFOLLOW. We return [EMLINK] instead of [ELOOP] when trying to open a symlink with O_NOFOLLOW, so that the original case of [ELOOP] can be distinguished. Code like cmp -h and xz takes advantage of this. PR: 214633
* MFC r305449:ngie2016-12-031-1/+1
| | | | | Install h_db to unbreak some of the lib/libc/db testcases after r305358
* MFC r305921:ngie2016-12-032-6/+6
| | | | Similar to r305920, remove spurious newlines from ATF_REQUIRE_MSG calls
* MFC r305358:ngie2016-12-037-3/+13
| | | | | | | | | | | | | | | | | | | | | Update contrib/netbsd-tests with new content from NetBSD This updates the snapshot from 09/30/2014 to 08/11/2016 This brings in a number of new testcases from upstream, most notably: - bin/cat - lib/libc - lib/msun - lib/libthr - usr.bin/sort lib/libc/tests/stdio/open_memstream_test.c was moved to lib/libc/tests/stdio/open_memstream2_test.c to accomodate the new open_memstream test from NetBSD. Tested on: amd64 (VMware fusion VM; various bare metal platforms); i386 (VMware fusion VM); make tinderbox
* MFC r307700:ngie2016-12-031-1/+4
| | | | Only build lib/libc/tests/iconv if MK_ICONV != no
* MFC r308904vangyzen2016-11-303-15/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix error reporting from wcstof() When wcstof() skipped initial space and then parsing failed, it set endptr to the first non-space character. Fix it to correctly report failure by setting endptr to the beginning of the input string. The fix is from theraven@, who fixed this bug in wcstod() and wcstold() in r227753. While I'm here: Move assignments out of declarations in wcstod() and wcstold(). This is against my personal preference, but it is our agreed style(9). Set endptr correctly on malloc() failure in all three functions. Remove an incorrect comment: This is pointer arithmetic, so the code was not actually making that assumption. wcstold() advanced the wcp pointer beyond leading whitespace and then reset it back to the beginning of the string. Do not reset it. This seems to have no functional effect, since strtold_l() also skips leading whitespace. I'm making the change to keep this function consistent with wcstof() and wcstod(), and because the C11 spec prescribes the use of iswspace() to skip leading space. Reported by: libc++ unit test for std::stof(std::wstring) Sponsored by: Dell EMC
* MFC r309006: remove unnecessary vm includes from setproctitleemaste2016-11-291-4/+0
| | | | | vm headers were needed only for the PS_STRINGS fallback, which was removed in r297888.
* MFC 308056: Fix formatting of tables.jhb2016-11-231-121/+121
| | | | | | | | | | | Specifically, use .Ta instead of tabs to separate column entries. While here fix a few other things: - Use .Sy for all column headers (previously only the first column header was bold) - Use .Dv to markup constants used for MIB names. - Use "1234" and "4321" for the byte order descriptions without thousands separators. - Mark up header files in the first table with .In.
OpenPOWER on IntegriCloud