summaryrefslogtreecommitdiffstats
path: root/lib/libc
Commit message (Collapse)AuthorAgeFilesLines
...
* Convert print_positional_test over to ATFngie2015-11-081-16/+40
| | | | | | | | Somehow missed in r290537 X-MFC with: r290537 MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Reorganize code to elimitate one _sseek() call for append modes.ache2015-11-081-21/+14
| | | | MFC after: 1 week
* printfloat_test and scanfloat_test need symbols from msun; these are ↵ngie2015-11-081-0/+6
| | | | | | | | | | | | automatically provided on amd64, but not i386. Add libm to DPADD/LDADD to unbreak the i386 tinderbox Pointyhat to: ngie MFC after: 1 week X-MFC with: r290538 Sponsored by: EMC / Isilon Storage Division
* Integrate tools/regression/lib/libc/string into the FreeBSD test suitengie2015-11-085-1/+554
| | | | | | | as lib/libc/tests/string MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Integrate tools/regression/lib/libc/stdlib into the FreeBSD test suitengie2015-11-085-2/+492
| | | | | | | | | | as lib/libc/tests/stdlib - Make the code a bit more style(9) compliant - Convert a sizeof(x)/sizeof(x[0]) to nitems MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Integrate tools/regression/lib/libc/stdio into the FreeBSD test suitengie2015-11-0814-23/+2613
| | | | | | | | | | | as lib/libc/tests/stdio - Fix some whitespace - Convert the testcases to ATF - Convert "/dev/null" to _PATH_DEVNULL MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Integrate tools/regression/lib/libc/locale into the FreeBSD test suitengie2015-11-0818-1/+2355
| | | | | | | as lib/libc/tests/locale MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* Merge from head r290483bapt2015-11-0715-92/+76
|\
| * sdl->sdl_len in sockaddr_dl can be longer thanhrs2015-11-031-3/+13
| | | | | | | | sizeof(struct sockaddr_dl).
| * Add _test suffix to multiple tests in lib/libc to conform to the design notedngie2015-11-023-38/+38
| | | | | | | | | | | | | | in the FreeBSD Test Suite wiki MFC after: 3 days Sponsored by: EMC / Isilon Storage Division
| * Remove unused variable (SRCDIR)ngie2015-11-021-2/+0
| | | | | | | | | | MFC after: 3 days Sponsored by: EMC / Isilon Storage Division
| * Remove unnecessary `if (x)` tests before calling `free(x)`; free(3)ngie2015-11-0210-49/+25
| | | | | | | | | | | | | | already employs this check MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division
* | Fix mbtowc not setting EILSEQ on an Incomplete multibyte sequence for eucJP ↵bapt2015-11-021-0/+1
| | | | | | | | encoding
* | Merge from headbapt2015-11-0117-103/+146
|\ \ | |/
| * Microoptimize.ache2015-11-011-4/+3
| |
| * Addition to prev. commit.ache2015-11-011-4/+6
| | | | | | | | | | | | | | In some edge cases fp->_p can be changed in _sseek(), recalculate. PR: 204156 MFC after: 1 week
| * Don't seek to the end if write buffer is empty (in append modes).ache2015-11-011-11/+12
| | | | | | | | | | PR: 204156 MFC after: 1 week
| * Not all targets support by clang have a tested or enabled ubsan yet.sbruno2015-10-301-0/+4
| | | | | | | | | | | | | | Only enable h_raw on x86 targets for today so that a buildworld runs to completion for clang enabled targets that are not x86. This should be removed when validation of the sanitizer has occured for all targets supported by FreeBSD and clang.
| * Disable h_raw/h_read with gccngie2015-10-301-2/+7
| | | | | | | | | | | | | | I forgot that these testcases fail with gcc 4.2.1; add a note to that effect MFC after: never Sponsored by: EMC / Isilon Storage Division
| * - Re-enable h_raw with clang 3.7.0+ngie2015-10-301-1/+2
| | | | | | | | | | | | | | | | - Fix the compiler check to allow the test to be compiled for gcc PR: 196430 MFC after: never Sponsored by: EMC / Isilon Storage Division
| * Remove a set but unused variable in __getgroupmembership to fix a gcc 4.9+ ↵ngie2015-10-301-2/+1
| | | | | | | | | | | | | | warning MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
| * Integrate contrib/netbsd-tests/lib/libc/rpc into the FreeBSD test suitengie2015-10-301-0/+1
| | | | | | | | | | | | | | | | | | | | as lib/libc/rpc This testcase requires rpcbind be up in running; otherwise the testcases will time out and be skipped MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
| * Use memmove(3) to avoid overlapping copy.bdrewery2015-10-291-1/+1
| | | | | | | | | | | | Reported by: valgrind MFC after: 2 weeks X-MFC-With: r290168
| * Fix several memory leaks, and crashes, in iconvlist(3).bdrewery2015-10-291-18/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Both curitem and curitem (via the names list) was always leaked. - malloc(3) failures lead to some leaks. - __bsd___iconv_get_list() failure lead to a crash since its error was not handles and __bsd___iconv_free_list() is not NULL-safe. I have slightly refactored this to avoid extra malloc and free logic in cases of malloc(3) failing. There are still bad assumptions here that I did not deal with. One of which is that the data will always have a '/' so the strchr(3) will not return NULL. Coverity CID: 1130055 1130054 1130053
| * Add _flags2 per jhb@ suggestion since no room left in _flags.ache2015-10-286-10/+7
| | | | | | | | | | | | Rewrite O_APPEND flag checking using new __S2OAP flag. MFC after: 3 weeks
| * According to POSIX, a write operation shall start at the current size ofache2015-10-251-0/+3
| | | | | | | | | | | | the stream (if mode had 'a' as the first character). MFC after: 1 week
| * Fix compiling with gcc [4.2.1] after r287797 when MK_HESOID == no andngie2015-10-252-13/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MK_NIS == no by converting `i` back to an int, and instead cast the loop comparison to `int` The loop comparison is iterating the len(ns_dtab)-1, because the last element is the sentinel tuple { NULL, NULL, NULL, }, so when both HESOID and NIS are off, len(ns_dtab)-1 == 1 - 1 == 0, and the loop is skipped because the expression is tautologically false While here, convert `(sizeof(x) / sizeof(x[0]))` to `nitems(x)` Tested with: clang 3.7.0, gcc 4.2.1, and gcc 4.9.4 [*] with MK_NIS={no,yes} and by running bash -lc 'id -u && id -g && id' * gcc 4.9.4 needs another patch in order for the compile to succeed with -Werror with lib/libc/gen/getgrent.c Reported by: jhibbits
| * Since no room left in the _flags, reuse __SALC for O_APPEND.ache2015-10-245-19/+31
| | | | | | | | | | | | | | It helps to remove _fcntl() call from _ftello() and optimize seek position calculation in _swrite(). MFC after: 3 weeks
| * resolver: abuse _res a little lessvangyzen2015-10-231-39/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the past, _res was a global variable. Now, it's multiple function calls. Several functions in the resolver use _res multiple times and therefore call the function(s) far more than necessary. Fix those callers to store the result of _res in a local variable. Add __noinline to the definition of res_init() to avoid the code bloat that these changes would have otherwise incurred. Thanks to jilles for noticing this. Reviewed by: jilles MFC after: 1 week Sponsored by: Dell Inc. Differential Revision: https://reviews.freebsd.org/D3887
| * Revert lib/libc/gen/dirname.3@r289695ngie2015-10-211-2/+0
| | | | | | | | This is why I use branches usually, not commit directly to head
| * Revert r289694ngie2015-10-211-0/+2
| | | | | | | | I committed some other undesirable local changes by accident
| * cpuset.9: Link to/from the new pagecem2015-10-202-4/+6
| | | | | | | | | | | | A follow-up to r289667. Sponsored by: EMC / Isilon Storage Division
| * Switch pl_child_pid from int to pid_t.jhb2015-10-201-2/+2
| | | | | | | | | | | | Reviewed by: emaste, kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D3857
* | locales: Fix eucJP sorting (broken upstream?)bapt2015-11-011-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Sorting eucJP text with "sort" resulted in an illegal sequence while "gsort" worked. This was traced back to mbrtowc handling which was broken for eucJP (probably eucCN, eucKR, and eucTW as well). This small fix took hours to figure out. The OR operation to build the wide character requires an unsigned character to work correctly. The euc wcrtowc conversion is probably broken upstream in Illumos as well. Triggered by: misc/freebsd-doc-ja in ports (encoded in eucJP) Submitted by: marino Obtained from: DragonflyBSD
* | libc: Fix (and improve) nl_langinfo (CODESET)bapt2015-11-012-9/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The output of "locale charmap" is identical to the result of nl_langinfo (CODESET) for any given locale. The logic for returning the codeset was very simplistic. It just returned portion of the locale name after the period (e.g. en_FR.ISO8859-1 returned "ISO8859-1"). When softlinks were added to locales, this broke. e.g.: en_US returned "" en_FR.UTF8 returned "UTF8" en_FR.UTF-8 returned "UTF-8" zh_Hant_HK.Big5HKSCS returned "Big5HKSCS" zh_Hant_TW.Big5 returned "Big5" es_ES@euro returned "" In order to fix this properly, the named locale cannot be used to determine the encoding. This information was almost available in the rune data. Unfortunately, all the single byte encodings were listed as "NONE" encoding. So I adjusted localedef tool to provide more information about the encoding. For example, instead of "NONE", the LC_CTYPE used by fr_FR.ISO8859-15 is now encoded as "NONE:ISO8859-15". The locale handlers now check if the first four characters of the encoding is "NONE" and if so, treats it as a single-byte encoding. The nl_langinfo handling of CODESET was adjusting accordingly. Now the following is returned: en_US returns "ISO8859-1" fr_FR.UTF8 returns "UTF-8" fr_FR.UTF-8 returns "UTF-8" zh_Hant_HK.Big5HKSCS returns "Big5" zh_Hant_TW.Big5 returns "Big5" es_ES@euro returns "ISO8859-15" as before, "C" and "POSIX" locales return "US-ASCII". This is a big improvement. The result of nl_langinfo can never be a zero-length string and it will always exclusively one of the values of the character maps of /usr/src/tools/tools/locale/etc/final-maps. Submitted by: marino Obtained from: DragonflyBSD
* | collate: Fix expansion substitions (broken upstream too)bapt2015-10-232-57/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Through testing, the user noted that some Cyrillic characters were not sorting correctly, and this was confirmed. After extensive testing and review, the localedef tool was eliminated as the culprit. The sustitutions were encoded correctly in LC_COLLATE. The error was mainly in wcscoll where character expansions were mishandled. The main directive pass routines had to be written to go back for a new collation value when the "state" variable was set. Before pointers were being advanced, the second lookup was gettting applied to the wrong character, etc. The "eat expansion codes" section on collate.c also had a bug. Later own, the "state" variable logic was changed to only set if next code was greater than zero (rather than >= 0). Some additional cleanups got captured from previous work: 1) The previous commit moved the binary search comment from the correct location to a wrong location because it's wrong upstream in Illumos. The comment has little value so I just removed it. 2) Don't check if pointers are null before freeing, this is redundant as free() handles null pointers. 3) The two binary search trees were standardized wrt initialization 4) On the binary search trees, a negative "high" exits rather than checking the table count again. Submitted by: marino Obtained from: DragonflyBSD
* | libc/collate: minor tweaks / fixbapt2015-10-221-27/+30
| | | | | | | | | | | | | | | | | | | | The main "fix" here is properly setting a collate loading error for each early return. Tweaks include removing unnecessary null checks, adding assertions (from Illumos) and a couple of variables to reduces code differences and improve readability. For normal use, there are no functional changes here. Obtained from: DragonflyBSD, Illumos
* | Merge from headbapt2015-10-193-4/+54
|\ \ | |/
| * Document bitset(9)cem2015-10-171-2/+3
| |
| * resolver: automatically reload /etc/resolv.confvangyzen2015-10-142-2/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On each resolver query, use stat(2) to see if the modification time of /etc/resolv.conf has changed. If so, reload the file and reinitialize the resolver library. However, only call stat(2) if at least two seconds have passed since the last call to stat(2), since calling it on every query could kill performance. This new behavior is enabled by default. Add a "reload-period" option to disable it or change the period of the test. Document this behavior and option in resolv.conf(5). Polish the man page just enough to appease igor. https://lists.freebsd.org/pipermail/freebsd-arch/2015-October/017342.html Reviewed by: kp, wblock Discussed with: jilles, imp, alfred MFC after: 1 month Relnotes: yes Sponsored by: Dell Inc. Differential Revision: https://reviews.freebsd.org/D3867
* | Include sys/*.h earlierbapt2015-10-141-3/+5
| | | | | | | | Reported by: kib
* | Commit log from Dragonfly:bapt2015-10-134-17/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FreeBSD extended ctypes to include numbers (e.g. isnumber()) but never actually implemented it. The isnumber() function was equivalent to the isdigit() function in every case. Now that DragonFly's ctype source files have number definitions, the number ctype can finally be implemented. It's given a new flag _CTYPE_N. The isalnum() and iswalnum() functions have been changed to use this flag rather than the _CTYPE_D digit flag. While isalnum(), isnumber(), and their wide equivalents now return different values in locale cases, the ishexnumber() and iswhexnumber() functions are unchanged. They are still aliases for isxdigit() and iswxdigit(). Also change ctype.h for isdigit and isxdigit to use sbistype like the other functions. Obtained from: dragonfly
* | Merge from headbapt2015-10-13281-2054/+1555
|\ \ | |/
| * Refactor the test/ Makefiles after recent changes to bsd.test.mk (r289158) andngie2015-10-1226-60/+9
| | | | | | | | | | | | | | | | | | | | | | | | netbsd-tests.test.mk (r289151) - Eliminate explicit OBJTOP/SRCTOP setting - Convert all ad hoc NetBSD test integration over to netbsd-tests.test.mk - Remove unnecessary TESTSDIR setting - Use SRCTOP where possible for clarity MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Divison
| * Change the default setting of kern.ipc.shm_allow_removed from 0 to 1.trasz2015-10-101-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes the need for manually changing this flag for Google Chrome users. It also improves compatibility with Linux applications running under Linuxulator compatibility layer, and possibly also helps in porting software from Linux. Generally speaking, the flag allows applications to create the shared memory segment, attach it, remove it, and then continue to use it and to reattach it later. This means that the kernel will automatically "clean up" after the application exits. It could be argued that it's against POSIX. However, SUSv3 says this about IPC_RMID: "Remove the shared memory identifier specified by shmid from the system and destroy the shared memory segment and shmid_ds data structure associated with it." From my reading, we break it in any case by deferring removal of the segment until it's detached; we won't break it any more by also deferring removal of the identifier. This is the behaviour exhibited by Linux since... probably always, and also by OpenBSD since the following commit: revision 1.54 date: 2011/10/27 07:56:28; author: robert; state: Exp; lines: +3 -8; Allow segments to be used even after they were marked for deletion with the IPC_RMID flag. This is permitted as an extension beyond the standards and this is similar to what other operating systems like linux do. MFC after: 1 month Relnotes: yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3603
| * Use proper function prototypes.rodrigc2015-10-072-4/+4
| | | | | | | | Eliminates -Wstrict-prototypes warning
| * Document the recently added pl_syscall_* fields in struct ptrace_lwpinfo.jhb2015-10-071-1/+24
| | | | | | | | | | Reviewed by: emaste, kib Differential Revision: https://reviews.freebsd.org/D3833
| * truss: Add support for utrace(2).bdrewery2015-10-061-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This uses the kdump(1) utrace support code directly until a common library is created. This allows malloc(3) tracing with MALLOC_CONF=utrace:true and rtld tracing with LD_UTRACE=1. Unknown utrace(2) data is just printed as hex. PR: 43819 [inspired by] Reviewed by: jhb MFC after: 2 weeks Relnotes: yes Differential Revision: https://reviews.freebsd.org/D3819
| * - address grammarjgh2015-10-051-7/+6
| | | | | | | | | | | | | | | | PR: 203440 (based on) Submitted by: ceratv@rpi.edu Approved by: wblock@ (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D3813
| * Revert r288628 and instead fix a discrepancy between the posix_fadvise(2)markj2015-10-031-5/+7
| | | | | | | | | | | | | | man page and POSIX: posix_fadvise(2) returns an error number on failure. Reported by: jilles MFC after: 1 week
OpenPOWER on IntegriCloud