summaryrefslogtreecommitdiff
path: root/lib/libc
Commit message (Collapse)AuthorAgeFilesLines
* MFC: r207946Christian Brueffer2010-07-041-3/+2
| | | | | | | | The previous revision actually removed the bug being hinted at, so go ahead and remove the hint. Notes: svn path=/stable/8/; revision=209698
* MFC: r207923Christian Brueffer2010-07-031-1/+25
| | | | | | | Document FIONREAD, FIONWRITE and FIONSPACE. Notes: svn path=/stable/8/; revision=209661
* MFC r209360: add C message catalogue entries for newer errnos.Maxim Konovalov2010-07-021-0/+10
| | | | Notes: svn path=/stable/8/; revision=209643
* MFH r200600: Clarify what's meant by NUL for getline.3Ulrich Spörlein2010-06-191-1/+2
| | | | | | | | PR: docs/141125 Submitted by: Jeremy Huddleston <jeremyhu@apple.com> Notes: svn path=/stable/8/; revision=209349
* MFC r208811:Edward Tomasz Napierala2010-06-111-5/+5
| | | | | | | | | | | Don't use pointer to 64 bit value (id_t) to point to 32 bit value (uid_t). Found with: Coverity Prevent CID: 7466, 7467 Approved by: re (kib) Notes: svn path=/stable/8/; revision=209047
* Fix usage of uninitialized variable.Edward Tomasz Napierala2010-06-111-1/+1
| | | | | | | | | Found with: Coverity Prevent CID: 7517 Approved by: re (kib) Notes: svn path=/stable/8/; revision=209046
* MFC r208437:Edward Tomasz Napierala2010-06-022-24/+18
| | | | | | | | | | Make acl_get_perm_np(3) work with NFSv4 ACLs. Reviewed by: kientzle@ Approved by: re (kib) Notes: svn path=/stable/8/; revision=208756
* MFC r208493:Ulrich Spörlein2010-05-301-1/+1
| | | | | | | | | These features will first appear in 8.1, soon to be released Approved by: re (kib) Notes: svn path=/stable/8/; revision=208652
* Change the current working directory to be inside the jail created byColin Percival2010-05-271-1/+8
| | | | | | | | | | | | | | | | | the jail(8) command. [10:04] Fix a one-NUL-byte buffer overflow in libopie. [10:05] Correctly sanity-check a buffer length in nfs mount. [10:06] Approved by: so (cperciva) Approved by: re (kensmith) Security: FreeBSD-SA-10:04.jail Security: FreeBSD-SA-10:05.opie Security: FreeBSD-SA-10:06.nfsclient Notes: svn path=/stable/8/; revision=208586
* MFC r208034:Edward Tomasz Napierala2010-05-201-0/+3
| | | | | | | | Make branding less intrusive - in acl_set(3), in case ACL brand is ACL_BRAND_UNKNOWN, do what the programmer says instead of failing. Notes: svn path=/stable/8/; revision=208359
* MFC r208033:Edward Tomasz Napierala2010-05-201-20/+32
| | | | | | | | | Make it possible to actually use NFSv4 permission bits with acl_set_perm(3) and acl_delete_perm(3). It went undetected, because neither setfacl(1) nor Samba use this routines. D'oh. Notes: svn path=/stable/8/; revision=208358
* MFC r207981:Gordon Tetlow2010-05-191-2/+2
| | | | | | | | | | | | | Fix a bug due to a type conversion from 64 to 32 bits. The side effect of this type conversion is the high bits which were used to indicate if a special character was a literal or special were dropped. As a result, all special character were treated as special, even if they were supposed to be literals. Approved by: mentor (wes@) Notes: svn path=/stable/8/; revision=208318
* MFC r205099-205100,205108:Xin LI2010-05-131-25/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Two optimizations to MI strlen(3) inspired by David S. Miller's blog posting [1]. - Use word-sized test for unaligned pointer before working the hard way. Memory page boundary is always integral multiple of a word alignment boundary. Therefore, if we can access memory referenced by pointer p, then (p & ~word mask) must be also accessible. - Better utilization of multi-issue processor's ability of concurrency. The previous implementation utilized a formular that must be executed sequentially. However, the ~, & and - operations can actually be caculated at the same time when the operand were different and unrelated. The original Hacker's Delight formular also offered consistent performance regardless whether the input would contain characters with their highest-bit set, as it catches real nul characters only. These two optimizations has shown further improvements over the previous implementation on microbenchmarks on i386 and amd64 CPU including Pentium 4, Core Duo 2 and i7. [1] http://vger.kernel.org/~davem/cgi-bin/blog.cgi/2010/03/08#strlen_1 Notes: svn path=/stable/8/; revision=208051
* MFC r207734: sigaltstack(2): document some modernizations:Jilles Tjoelker2010-05-131-17/+15
| | | | | | | | | | * un-document 'struct sigaltstack' tag for stack_t as this is BSD-specific; this doesn't seem useful enough to document as such * alternate stacks are per thread, not per process * update error codes to what the kernel does and POSIX requires Notes: svn path=/stable/8/; revision=208032
* MFC r207604:Konstantin Belousov2010-05-111-3/+9
| | | | | | | Document RUSAGE_THREAD. Notes: svn path=/stable/8/; revision=207919
* MFC r206760: getcwd(3): Clarify that EACCES may or may not be checked.Jilles Tjoelker2010-05-051-3/+11
| | | | | | | | | | | | | | | | | | POSIX permits but does not require checking access on the current and parent directories. Because various programs do not like it if getcwd(3) fails, it seems best to avoid checking access as much as possible. There are various reports in GNATS about this (search for getcwd). Our getcwd(3) implementation first queries the kernel for the pathname directly, which does not check any permissions but sometimes fails, and then falls back to reading all parent directories for the names. PR: standards/44425 Notes: svn path=/stable/8/; revision=207684
* MFC r207190: unlinkat(2): unlinkat(AT_REMOVEDIR) fails with ENOTEMPTYJilles Tjoelker2010-05-051-2/+2
| | | | | | | | | | like rmdir() for non-empty directories. POSIX permits both ENOTEMPTY and EEXIST, but we use the clearer ENOTEMPTY, following BSD tradition. Notes: svn path=/stable/8/; revision=207682
* MFC r207186: sysctl(3): Update description of various kern.* variables.Jilles Tjoelker2010-05-051-12/+10
| | | | | | | | | | Also add xrefs for confstr(3) (as sysconf(3) but for strings) and kvm(3) (which is a more convenient way to access some of the variables). PR: 116480 Notes: svn path=/stable/8/; revision=207679
* MFC r207009:Konstantin Belousov2010-05-051-2/+2
| | | | | | | C language does not has references, it provides pointers. Notes: svn path=/stable/8/; revision=207654
* MFC r206893:Konstantin Belousov2010-05-042-11/+62
| | | | | | | | | | | | | | | | | | | | | | | | | Slightly modernize realpath(3). SUSv4 requires that implementation returns EINVAL if supplied path is NULL, and ENOENT if path is empty string [1]. Bring prototype in conformance with SUSv4, adding restrict keywords. Allow the resolved path buffer pointer be NULL, in which case realpath(3) allocates storage with malloc(). MFC r206898: Free() is not allowed to modify errno, remove safety brackets around it. Add small optimization, do not copy a string to the buffer that is to be freed immediately after. MFC r206997: Move realpath(3) prototype to a POSIX section. MFC r206998: Add standards section, improve wording, taking into account the handling of NULL and changed type in declaration. Notes: svn path=/stable/8/; revision=207599
* MFC: r206490, r206492Marius Strobl2010-05-021-0/+4
| | | | | | | | | | | | | | | While SPARC V9 allows tininess to be detected either before or after rounding (impl. dep. #55), the SPARC JPS1 responsible for SPARC64 and UltraSPARC processors defines that in all cases tininess is detected before rounding therefore rounding up to the smallest normalized number should set the underflow flag. This change is needed for using SoftFloat on sparc64 for reference purposes. PR: 144900 Submitted by: Peter Jeremy Notes: svn path=/stable/8/; revision=207526
* MFC r206711: fnmatch: Fix bad FNM_PERIOD disablingJilles Tjoelker2010-04-231-8/+8
| | | | | | | | | | | if an asterisk has been seen. Example: fnmatch("a*b/*", "abbb/.x", FNM_PATHNAME | FNM_PERIOD) PR: 116074 Notes: svn path=/stable/8/; revision=207129
* MFC r206549:Konstantin Belousov2010-04-211-8/+13
| | | | | | | | | | | | | | Align the declaration for sa_sigaction with POSIX. MFC r206649: Still reference struct __sigaction with clarification when this form of argument declaration is needed. MFC r206802: Revert r206649. Simplify the presented declaration of struct sigaction. Notes: svn path=/stable/8/; revision=206990
* MFC r206155, r206267: Add capability to use a db version ofHajimu UMEMOTO2010-04-182-1/+202
| | | | | | | | services. It is enabled by specifying `db' as source of services in /etc/nsswitch.conf. Notes: svn path=/stable/8/; revision=206784
* MFC ir206152, r206153, r206154:Hajimu UMEMOTO2010-04-181-71/+35
| | | | | | | | | | | - Stop adding trailing '\n'. The servent_unpack() doesn't expect lines terminated with '\n'. - Treat '+' as special only when in compat mode, and simplify the logic bit. - Reduce duplicate code. Notes: svn path=/stable/8/; revision=206783
* MFC 205536:John Baldwin2010-04-141-1/+6
| | | | | | | Reject attempts to create a MAP_ANON mapping with a non-zero offset. Notes: svn path=/stable/8/; revision=206602
* MFC r205796:Edward Tomasz Napierala2010-04-131-7/+4
| | | | | | | | | Make acl_to_text_np(3) not crash on long group or user names in NFSv4 ACLs. PR: amd64/145091 Notes: svn path=/stable/8/; revision=206542
* MFC r206178: ibc/db/hash: cap auto-tuned block sizeAndriy Gapon2010-04-122-1/+3
| | | | Notes: svn path=/stable/8/; revision=206508
* MFC r206177: hash.3: fix a factual mistake in the man pageAndriy Gapon2010-04-081-1/+1
| | | | Notes: svn path=/stable/8/; revision=206393
* MFC r205606Pietro Cerutti2010-03-312-3/+3
| | | | | | | | | Remove const'ness from dlerror(3) prototype, for consistency with POSIX. Approved by: cognet Notes: svn path=/stable/8/; revision=205979
* MFC: r205410Marius Strobl2010-03-301-12/+11
| | | | | | | | | | | Avoid aliasing which leads to incorrect results when compiling with the default strict aliasing rules. PR: 144900 Submitted by: Peter Jeremy Notes: svn path=/stable/8/; revision=205905
* MFC: r205397Marius Strobl2010-03-301-5/+10
| | | | | | | | | | | | | | | | - While SPARC V9 allows tininess to be detected either before or after rounding (impl. dep. #55), the SPARC JPS1 responsible for SPARC64 and UltraSPARC processors defines that in all cases tinyness is detected before rounding, therefore rounding up to the smallest normalised number should set the underflow flag. - If an infinite result is rounded down, the result should have an exponent 1 less than the value for infinity. PR: 144900 Submitted by: Peter Jeremy Notes: svn path=/stable/8/; revision=205902
* MFC: r205396Marius Strobl2010-03-301-7/+9
| | | | | | | | | | | Division should take both arguments' signs into account when the the dividend is infinity or zero and the divisor is not the same. PR: 144900 Submitted by: Peter Jeremy Notes: svn path=/stable/8/; revision=205896
* MFC: r205395Marius Strobl2010-03-303-1/+12
| | | | | | | | | | FPU_DEBUG requires <stdio.h>. PR: 144900 Submitted by: Peter Jeremy Notes: svn path=/stable/8/; revision=205893
* MFC: r205394Marius Strobl2010-03-301-5/+7
| | | | | | | | | | | Ensure that __fpu_ftox() both returns the high bits and res[1] contains the low bits also in the default case. PR: 144900 Obtained from: OpenBSD Notes: svn path=/stable/8/; revision=205890
* MFC: r205393Marius Strobl2010-03-302-7/+3
| | | | | | | | - Remove a bogus forward declaration. - Fix whitespace. Notes: svn path=/stable/8/; revision=205887
* MFC 204950,205020:John Baldwin2010-03-228-65/+81
| | | | | | | | | | | | Use thr_once() with once_t controls to initialize various thread_key_t objects used to provide per-thread storage in the RPC code. Almost all of these used double-checking with a dedicated mutex (tsd_lock) to do this before. However, that is not always safe with more relaxed memory orders. There were also other bugs, such as one in __rpc_createrr() that caused a new key to be allocated each time __rpc_createrr() was invoked. Notes: svn path=/stable/8/; revision=205449
* MFC: r204974, r205002Marius Strobl2010-03-152-29/+21
| | | | | | | | | | | | | | | | | | | | - The OPSZ macro actually only does the right thing for int32 and int64 operands but not for double and extended double ones. Instead of trying to fix the macro just nuke it and unroll the loops in the correct way though as extended double operands turn out to be the only special case. - For FxTO{s,d,q} the source operand is int64 so rs2 has to be re-decoded after setting type accordingly as it's generally decoded using the low 2 bits as the type, which are 0 for these three instructions. - Similarly, in case of F{s,d,q}TOx the target is int64 so rd has to be re-decoded using not only the operand mask appropriate for int64 but also the correct register number encoding. - Use const where appropriate. - Wrap long lines. Submitted by: Peter Jeremy (partly) Notes: svn path=/stable/8/; revision=205183
* MFC r204447:Jaakko Heinonen2010-03-121-0/+4
| | | | | | | | | | | In _gettemp(), check that the length of the path doesn't exceed MAXPATHLEN. Otherwise the path name (or part of it) may not fit to carrybuf causing a buffer overflow. PR: bin/140228 Notes: svn path=/stable/8/; revision=205070
* MFC revs 203696, 203783:Marcel Moolenaar2010-03-071-1/+84
| | | | | | | | | | Add PT_VM_TIMESTAMP and PT_VM_ENTRY so that the tracing process can obtain the memory map of the traced process. Requested by: kib@ Notes: svn path=/stable/8/; revision=204814
* MFC r204307:Konstantin Belousov2010-03-041-1/+7
| | | | | | | | | Make pause(3) implementation not depended on the legacy sigcompat.c interfaces. Do not block rt signals during and after pause(3) calls. Use private libc namespace to call proper methods. Notes: svn path=/stable/8/; revision=204700
* MFC r201959Brooks Davis2010-03-031-4/+4
| | | | | | | | Use the correct types to store uids and gids in the credential cache and eliminate an inappropriate use of NGROUPS. Notes: svn path=/stable/8/; revision=204671
* MFC r203323:Rebecca Cran2010-02-181-1/+1
| | | | | | | | | Remove extra semicolon. Approved by: rrs (mentor) Notes: svn path=/stable/8/; revision=204036
* MFC r203322:Rebecca Cran2010-02-184-3/+5
| | | | | | | | | | Fix typo of ENOTCONN. Add missing RETURN VALUES section in sctp_opt_info(3). Approved by: rrs (mentor) Notes: svn path=/stable/8/; revision=204035
* Merge r203393,r203395 from head:Gavin Atkinson2010-02-131-2/+2
| | | | | | | | | | | The multiplicand a = 0x5deece66d = 25214903917, not 0xfdeece66d. This bug in the man page has gone unnoticed for over 15 years! PR: docs/143461 Submitted by: Jeremy Huddleston jeremyhu apple.com Notes: svn path=/stable/8/; revision=203817
* MFC r203077:Ed Maste2010-02-091-0/+1
| | | | | | | | | | | Add missing return, in a rare case where we can't allocate memory in deallocate. Submitted by: Ryan Stone (rysto32 at gmail dot com) Approved by: jasone Notes: svn path=/stable/8/; revision=203701
* MFC r202916: Make strsignal(3) thread-safe.Hajimu UMEMOTO2010-02-071-4/+48
| | | | Notes: svn path=/stable/8/; revision=203598
* MFC r199827:Konstantin Belousov2010-01-314-8/+250
| | | | | | | | | | Implement sighold, sigignore, sigpause, sigrelse, sigset functions. MFC r200881 (by cognet): Don't name parameters. Notes: svn path=/stable/8/; revision=203298
* MFC r201145 to stable/8:Antoine Brodin2010-01-301-1/+1
| | | | | | | | | | | | (S)LIST_HEAD_INITIALIZER takes a (S)LIST_HEAD as an argument. Fix some wrong usages. Note: this does not affect generated binaries as this argument is not used. PR: 137213 Submitted by: Eygene Ryabinkin (initial version) Notes: svn path=/stable/8/; revision=203184
* MFC r197752:David Schultz2010-01-241-2/+2
| | | | | | | | | | | | | | | Better glibc compatibility for getline/getdelim: - Tolerate applications that pass a NULL pointer for the buffer and claim that the capacity of the buffer is nonzero. - If an application passes in a non-NULL buffer pointer and claims the buffer has zero capacity, we should free (well, realloc) it anyway. It could have been obtained from malloc(0), so failing to free it would be a small memory leak. Notes: svn path=/stable/8/; revision=202947