summaryrefslogtreecommitdiffstats
path: root/lib/libc
Commit message (Collapse)AuthorAgeFilesLines
...
* fts: Use O_DIRECTORY when opening name that might be changed by attacker.jilles2013-02-101-1/+2
| | | | | | | | There are uncommon cases where fts_safe_changedir() may be called with a non-NULL name that is not "..". Do not block or worse if an attacker put (a (symlink to) a fifo or device where a directory used to be. MFC after: 1 week
* Improve code style. No functional change.tuexen2013-02-101-7/+7
| | | | MFC after: 3 days
* sigqueue(2): Fix typo (EEPERM -> EPERM).jilles2013-02-101-1/+1
| | | | MFC after: 3 days
* Fix logic inversion.eadler2013-02-091-1/+1
| | | | | | PR: docs/174966 Submitted by: Christian Ullrich <chris+freebsd@chrullrich.net> Approved by: bcr (mentor)
* mdoc: Remove EOL whitespace.joel2013-02-091-1/+1
|
* Document the detail of interaction between vfork and PT_TRACEME.kib2013-02-071-1/+11
| | | | MFC after: 2 weeks
* Document the ERESTART translation to EINTR for devfs nodes.kib2013-02-071-1/+12
| | | | | Based on the submission by: jilles MFC after: 2 weeks
* - Fix more style(9)-related issues (copyright header, spaces after functiongahr2013-02-011-56/+55
| | | | | | | | | names, unnecessary casts) - Change type of boolean variable from char to bool Suggested by: jhb, zont, jmallett Reviewed by: cognet Approved by: cognet
* - Remove underscores from the internal structure name, as it doesn't collidegahr2013-01-312-32/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with the user's namespace. - Correct size and position variables type from long to size_t. - Do not set errno to ENOMEM on malloc failure, as malloc already does so. - Implement the concept of "buffer data length", which mandates what SEEK_END refers to and the allowed extent for a read. - Use NULL as read-callback if the buffer is opened in write-only mode. Conversely, use NULL as write-callback when opened in read-only mode. - Implement the handling of the ``b'' character in the mode argument. A binary buffer differs from a text buffer (default mode if ``b'' is omitted) in that NULL bytes are never appended to writes and that the "buffer data length" equals to the size of the buffer. - Remove shall from the man page. Use indicative instead. Also, specify that the ``b'' flag does not conform with POSIX but is supported by glibc. - Update the regression test so that the ``b'' functionality and the "buffer data length" concepts are tested. - Minor style(9) corrections. Suggested by: jilles Reviewed by: cognet Approved by: cognet
* Add fmemopen(3), an interface to get a FILE * from a buffer in memory, alonggahr2013-01-304-7/+224
| | | | | | | | with the respective regression test. See http://pubs.opengroup.org/onlinepubs/9699919799/functions/fmemopen.html Reviewed by: cognet Approved by: cognet
* Rework the __vdso_* symbols attributes to only make the symbols weak,kib2013-01-3016-5/+325
| | | | | | | | | | but use normal references instead of weak. This makes the statically linked binaries to use fast gettimeofday(2) by forcing the linker to resolve references and providing the neccessary functions. Reported by: bde Tested by: marius (sparc64) MFC after: 2 weeks
* posix_fadvise(2) first appeared in FreeBSD 9.1glebius2013-01-231-1/+1
|
* Note that SIGCHLD is special and if ignored, won't be recorded by the filter.pjd2013-01-211-2/+4
|
* Add the required __aeabi_* functions to libc.andrew2013-01-197-0/+361
| | | | | The floating point functions are here rather than compiler-rt because the libc softfloat code allows us to set the rounding mode.
* Use the compiler-rt version __{u,}divsi3 and __{u,}modsi3 on ARM EABIandrew2013-01-194-5/+27
|
* Update the syscall calling convention for ARM EABI. We store the syscallandrew2013-01-191-0/+8
| | | | | | in r7 and use ip to store the old version of r7 as it is not guaranteed to be kept when calling a subroutine. The kernel will preserve the register across system calls.
* For ARM EABI we only need a subset of the quad functions, the rest areandrew2013-01-191-0/+4
| | | | provided by libgcc.
* - Use standard RETURN VALUES section.zont2013-01-151-6/+2
| | | | | Approved by: kib (mentor) MFC after: 1 week
* Add contrib/libc-vis to the include path so we reliably pick up the rightbrooks2013-01-111-0/+1
| | | | | | version of vis.h. Reported by: dim
* In r244401 I accidently moved strunvis and strunvisx from version 1.0 tobrooks2013-01-111-2/+2
| | | | | 1.3 breaking the libc ABI. Revert that change (breaking the ABI again for users who updated after December 18th).
* Re-enable ip6addrctl support but only for IPv6 address.ume2013-01-101-7/+5
| | | | | Requested by: Ben Morrow <ben__at__morrow.me.uk> MFC after: 1 week
* Disable destination address selection support ofume2013-01-091-0/+8
| | | | | | | | getipnodebyname(1). RFC 2553 mentions IPv6 addresses are returned 1st. Spotted by: uqs MFC after: 1 week
* Silence a clang warning by telling it we are only interested in leftandrew2013-01-061-1/+1
| | | | shifting the lower 32bits of the floating point value when we demangle it.
* Add derived versions for common Simplified Chinese encodings.delphij2012-12-283-0/+596
| | | | MFC after: 2 weeks
* Add zh_CN.UTF-8 catalog.delphij2012-12-282-0/+296
| | | | | Reviewed by: alphachi <alphachi mediaspirit.org> MFC after: 2 weeks
* - Update manual pages accordingly to r244384 and r244385.zont2012-12-252-9/+25
| | | | | Approved by: kib (mentor) MFC after: 1 week
* - Reduce buffer size from LINE_MAX to PATH_MAX, there is no point to storedelphij2012-12-211-8/+4
| | | | | | | | | | path longer than this. - Fix an unreached case of check against sizeof buf, which in turn leads to an off-by-one nul byte write on the stack. The original condition can never be satisfied because the passed boundary is the maximum value that can be returned, so code was harmless. MFC after: 1 month
* Replace our implementation of the vis(3) and unvis(3) APIs withbrooks2012-12-187-1007/+65
| | | | | | | | | NetBSD's. This output size limited versions of vis and unvis functions as well as a set of vis variants that allow arbitrary characters to be specified for encoding. Finally, MIME Quoted-Printable encoding as described in RFC 2045 is supported.
* Fix warning from valgrind when a failed entry is tested.eadler2012-12-171-0/+1
| | | | | | | | PR: kern/173008 Submitted by: Zhihao Yuan <lichray@gmail.com> Reviewed by: gabor Approved by: cperciva (implicit) MFC after: 1 week
* libc/iconv: Fix race condition with setting FD_CLOEXEC.jilles2012-12-171-5/+1
| | | | | | | | | A fork/exec could happen between open and fcntl, leaking a file descriptor. Using O_CLOEXEC fixes this and as a side effect simplifies the code. NetBSD already had this (I checked this after making the change myself). Reviewed by: gabor
* Eliminate redundant variable.pjd2012-12-121-6/+3
|
* libc: Make various internal file descriptors close-on-exec.jilles2012-12-112-2/+2
| | | | These are obtained via fopen().
* libc: Make various internal file descriptors close-on-exec.jilles2012-12-107-12/+12
| | | | These are obtained via fopen().
* Improve style(9) compliance of function declarations.brooks2012-12-101-4/+12
|
* Document that socket(2) may fail with EAFNOSUPPORT if the family cannotkevlo2012-12-071-7/+12
| | | | | | | be found. Reviewed by: glebius Obtained from: NetBSD
* libc: Use the new 'e' fopen() mode option to simplify fstab.c.jilles2012-12-041-11/+1
| | | | No functional change is intended.
* Document that bind(2) can fail with EAFNOSUPPORT.kevlo2012-12-041-0/+2
| | | | Reviewed by: glebius
* Protect against DoS attacks, such as being described in CVE-2010-2632.marcel2012-12-011-22/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The changes were derived from what has been committed to NetBSD, with modifications. These are: 1. Preserve the existsing GLOB_LIMIT behaviour by including the number of matches to the set of parameters to limit. 2. Change some of the limits to avoid impacting normal use cases: GLOB_LIMIT_STRING - change from 65536 to ARG_MAX so that glob(3) can still provide a full command line of expanded names. GLOB_LIMIT_STAT - change from 128 to 1024 for no other reason than that 128 feels too low (it's not a limit that impacts the behaviour of the test program listed in CVE-2010-2632). GLOB_LIMIT_PATH - change from 1024 to 65536 so that glob(3) can still provide a fill command line of expanded names. 3. Protect against buffer overruns when we hit the GLOB_LIMIT_STAT or GLOB_LIMIT_READDIR limits. We append SEP and EOS to pathend in those cases. Return GLOB_ABORTED instead of GLOB_NOSPACE when we would otherwise overrun the buffer. This change also modifies the existing behaviour of glob(3) in case GLOB_LIMIT is specifies by limiting the *new* matches and not all matches. This is an important distinction when GLOB_APPEND is set or when the caller uses a non-zero gl_offs. Previously pre-existing matches or the value of gl_offs would be counted in the number of matches even though the man page states that glob(3) would return GLOB_NOSPACE when gl_matchc or more matches were found. The limits that cannot be circumvented are GLOB_LIMIT_STRING and GLOB_LIMIT_PATH all others can be crossed by simply calling glob(3) again and with GLOB_APPEND set. The entire description above applies only when GLOB_LIMIT has been specified of course. No limits apply when this flag isn't set! Obtained from: Juniper Networks, Inc
* In globextend(), take advantage of the fact that realloc(NULL, size) ismarcel2012-12-011-3/+2
| | | | | | equivalent to malloc(size). This eliminates the conditional expression used for calling either realloc() or malloc() when realloc() will do all the time.
* In globextend() when the pathv vector cannot be (re-)allocated, don'tmarcel2012-12-011-6/+1
| | | | | | | | | | | | | | free and clear the gl_pathv pointer in the glob_t structure. Such breaks the invariant of the glob_t structure, as stated in the comment right in front of the globextend() function. If gl_pathv was non-NULL, then gl_pathc was > 0. Making gl_pathv a NULL pointer without also setting gl_pathc to 0 is wrong. Since we otherwise don't free the memory associated with a glob_t in error cases, it's unlikely that this change will cause a memory leak that wasn't already there to begin with. Callers of glob(3) must call globfree(3) irrespective of whether glob(3) returned an error or not.
* The getline function returns the number of characters read, noteadler2012-12-011-2/+2
| | | | | | | | | written. Use clearer text for this. PR: docs/174023 Submitted by: Paul Procacci <pprocacci@gmail.com> Approved by: bcr (mentor) MFC after: 1 week
* libc: Allow setting close-on-exec in fopen/freopen/fdopen.jilles2012-11-304-2/+33
| | | | | | | | | | | | | | | | | | | This commit adds a new mode option 'e' that must follow any 'b', '+' and/or 'x' options. C11 is clear about the 'x' needing to follow 'b' and/or '+' and that is what we implement; therefore, require a strict position for 'e' as well. For freopen() with a non-NULL path argument and fopen(), the close-on-exec flag is set iff the 'e' mode option is specified. For freopen() with a NULL path argument and fdopen(), the close-on-exec flag is turned on if the 'e' mode option is specified and remains unchanged otherwise. Although the same behaviour for fopen() can be obtained by open(O_CLOEXEC) and fdopen(), this needlessly complicates the calling code. Apart from the ordering requirement, the new option matches glibc. PR: kern/169320
* Document that getpeername(2) and getsockname(2) can fail with EINVAL.kevlo2012-11-232-0/+8
| | | | Reviewed by: glebius
* Cleanup the code a bit, which improves the portability.tuexen2012-11-191-43/+42
| | | | MFC after: 1 week
* Fix the handling of mapped IPv6 addresses in sctp_connectx().tuexen2012-11-191-1/+0
| | | | MFC after: 3 days
* - the preferred way to write a NULL pointer constant is with NULLkevlo2012-11-163-9/+6
| | | | | | - whitespace nit Reviewed by: glebius
* mdoc: Use the Ev macro for environmental variables.joel2012-11-161-3/+3
|
* Document that rtprio(2) and rtprio_thread(2) can fail with EFAULTkevlo2012-11-161-2/+10
| | | | | | due to the invoked copyout(9). Reviewed by: davidxu
* Complete man page.grog2012-11-161-11/+27
| | | | MFC after: 2 weeks
* Document that sendfile(2) can fail with ENOBUFS.kevlo2012-11-141-0/+2
| | | | Reviewed by: glebius
OpenPOWER on IntegriCloud