summaryrefslogtreecommitdiffstats
path: root/lib/libc
Commit message (Collapse)AuthorAgeFilesLines
* Minor mdoc nits.joel2012-05-122-4/+4
|
* Remove tab from kernel configuration option. This is consistent with the restjoel2012-05-121-1/+1
| | | | of our manual pages.
* mdoc: end list context with El.joel2012-05-121-0/+1
|
* General mdoc(7) and typo fixes.gjb2012-05-1114-20/+21
| | | | | | PR: 167734 Submitted by: Nobuyuki Koganemaru (kogane!jp.freebsd.org) MFC after: 3 days
* According to SUSv4, realpath(3) must fail ifkib2012-05-112-12/+29
| | | | | | | | | | | | | | | | | [ENOENT] A component of file_name does not name an existing file or file_name points to an empty string. [ENOTDIR] A component of the path prefix is not a directory, or the file_name argument contains at least one non- <slash> character and ends with one or more trailing <slash> characters and the last pathname component names an existing file that is neither a directory nor a symbolic link to a directory. Add checks for the listed conditions, and set errno accordingly. Update the realpath(3) manpage to mention SUS behaviour. Remove the requirement to include sys/param.h before stdlib.h. PR: 128933 MFC after: 3 weeks
* Fix copy/paste error in lib/libc/locale/toupper.c.dim2012-05-101-1/+1
| | | | Submitted by: Kohji Okuno <okuno.kohji@jp.panasonic.com>
* Remove reference to non-existent FreeBSD Security Architectureeadler2012-05-091-3/+1
| | | | | Approved by: cperciva MFC after: 3 days
* Plug a leak.kib2012-05-081-2/+5
| | | | | Submitted by: Greg Bednarek <gbednarek averesystems com> MFC after: 1 week
* General mdoc(7) and typo fixes.gjb2012-05-0813-17/+20
| | | | | PR: 167713 Submitted by: Nobuyuki Koganemaru (kogane!jp.freebsd.org)
* Remove debug output.tuexen2012-05-041-1/+0
| | | | MFC after: 3 days
* Remove incorrect __restrict qualifier on several pointersdumbbell2012-04-302-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The typical case was: static __inline int convert_ccl(FILE *fp, char * __restrict p, [...]) { [...] if (p == SUPPRESS_PTR) { [...] } else { [...] } [...] } This qualifier says that the pointer is the only one at that time pointing to the resource. Here, clang considers that "p" will never match "SUPPRESS_PTR" and optimize the if{} block out. This leads to segfaults in programs calling vfscanf(3) and vfwscanf(3) with just the format string (no arguments following it). The following softwares were reported to abort with segmentation fault and this patch fixes it: o cmake o smartd o devel/ORBit2 dim@ opened an LLVM PR to discuss this clang optimization: http://llvm.org/bugs/show_bug.cgi?id=12656 Tested by: bsam@
* fix a further typo in the pdfork(2) man page.rwatson2012-04-301-1/+1
| | | | | Submitted by: Norman Hardy MFC after: 3 days
* The returned file descriptor from pdfork(2) is via fdp, not pidp.rwatson2012-04-301-2/+2
| | | | | Submitted by: Norman Hardy MFC after: 3 days
* Fix a bug in *wscanf's handling of non-wide %s, %c, and %[das2012-04-301-44/+9
| | | | | | | | | | | | | conversions. Both the specification and the documentation say the width is interpreted as the max number of wide characters to read, but the implementation was interpreting it as the number of bytes to convert. (See also r105317.) This change has security implications for any applications that depend on the buggy behavior, but the impact in practice is probably nil. Any such application would already be buggy on other platforms that get the semantics right. Also, these conversions are rarely used; %ls, %lc, and %l[ are more appropriate.
* pread(2) might fail with EBUSY, so document iteadler2012-04-291-0/+2
| | | | | | | PR: docs/167201 Submitted by: Kurt Jaeger <fbsd-ports@opsec.eu> Approved by: cperciva MFC after: 3 days
* Allow users of gprof to get per run output files (using the pid)eadler2012-04-292-1/+12
| | | | | | | | | PR: bin/99800 Submitted by: Peter Jeremy <peterjeremy@optushome.com.au> Reviewed by: jilles (code) Reviewed by: dwhite (doc) Approved by: cperciva MFC after: 1 week
* Previously, vfscanf()'s wide character processing functions weredas2012-04-293-150/+83
| | | | | | | | | | | | | | | reading wide characters manually. With this change, they now use fgetwc(). To make this work, we use an internal version of fgetwc() with a few extensions: it takes an mbstate * because non-wide streams don't have a built-in mbstate, and it indicates the number of bytes read. vfscanf() now resembles vfwscanf() more closely. Minor functional improvements include working xlocale support in vfscanf(), setting the stream error indicator on encoding errors, and proper handling of shift-based encodings. (Actually, making shift-based encodings work with non-wide streams is hopeless, but the implementation now matches the broken specification.)
* Fix small documentation mistakes.jlh2012-04-281-1/+1
| | | | | Submitted by: brueffer Approved by: kib (mentor)
* Import stdbuf(1) and the shared library it relies on.jlh2012-04-281-0/+4
| | | | | | | | | | | | | | This tool changes the default buffering behaviour of standard stdio streams. It only works on dynamic binaries. To make it work for static ones it would require cluttering stdio because there no single entry point. PR: 166660 Reviewed by: current@, jhb Approved by: kib (mentor) MFC after: 1 week
* Fix several memory and lock leaks on the out of memory condition.kib2012-04-282-2/+22
| | | | | Reported by: Matt Miller <matt matthewjmiller net> MFC after: 1 week
* Move sctp_sendv and sctp_recvv to FBSD_1.3 as suggested bytuexen2012-04-261-2/+5
| | | | | | | Konstantin Belousov. MFC after: 1 week. X-MFC with: r234715
* Export symbols for sctp_sendv() and sctp_recvv().tuexen2012-04-261-0/+2
| | | | MFC after: 1 week
* Use the .Bx macro instead of BSDeadler2012-04-261-1/+3
| | | | | | | Submitted by: ru Approved by: ru MFC after: 3 days X-MFC-With: r234700
* A new jail(8) with a configuration file, ultimately to replace the workjamie2012-04-261-39/+1
|\ | | | | | | | | | | currently done by /etc/rc.d/jail. MFC after: 3 months
| * Remove a section that went to jail(8), and fix a small grammar error.jamie2010-10-201-39/+1
| |
| * Import section 2 man files so I can update jail(2).jamie2010-10-20192-0/+34710
| |\
| * | A new jail(8) with a configuration file, to replace the work currently donejamie2010-10-191949-350043/+0
| | | | | | | | | | | | by /etc/rc.d/jail.
* | | Document the standardization status of err* and warn*eadler2012-04-261-1/+11
| | | | | | | | | | | | | | | | | | | | | PR: docs/164939 Submitted by: Niclas Zeising <zeising@daemonic.se> Approved by: bcr MFC after: 3 days
* | | Take the spinlock around clearing of the fp->_flags in fclose(3), whichkib2012-04-243-9/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | indicates the avaliability of FILE, to prevent possible reordering of the writes as seen by other CPUs. Reported by: Fengwei yin <yfw.bsd gmail com> Reviewed by: jhb MFC after: 1 week
* | | Bugfix: Include whitespace characters in the count of the number ofdas2012-04-221-1/+1
| | | | | | | | | | | | characters read.
* | | Bugfix: Correctly count the number of characters read for %l[ conversions.das2012-04-221-7/+4
| | |
* | | Bugfix: %n doesn't count as a conversion, sodas2012-04-222-2/+0
| | | | | | | | | | | | sscanf("abc", "ab%ncd", &i) returns EOF, not 0.
* | | Refactor scanf to improve modularity. Conversions are now performeddas2012-04-222-668/+843
| | | | | | | | | | | | | | | | | | by separate conversion functions. This will hopefully make bugs more noticeable (I noticed several already) and provide opportunities to reduce code duplication.
* | | Fix some incorrect symbol versions.theraven2012-04-221-4/+4
| | | | | | | | | | | | Reported by: das
* | | Import jemalloc a8f8d7540d66ddee7337db80c92890916e1063ca (dev branch,jasone2012-04-221-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | prior to 3.0.0 release). This fixes several bugs related to memory initialization. Mangle __jemalloc_a0{malloc,calloc,free}() just like all the other library-internal symbols in jemalloc, and adjust the tls allocation code in libc to use the mangled names.
* | | - Use quote when tab is used;delphij2012-04-221-2/+3
| | | | | | | | | | | | - Follow the same macros used in device driver manual pages.
* | | As noted by Peter Jeremy, r234528 only partially fixed the infinitedas2012-04-211-1/+1
| | | | | | | | | | | | | | | | | | | | | loop bug introduced in r187302. This completes the fix. PR: 167039 MFC after: 3 days
* | | If the size passed to {,v}s{w,n}printf is larger than INT_MAX+1das2012-04-215-6/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (i.e., the return value would overflow), set errno to EOVERFLOW and return an error. This improves the chances that buggy applications -- for instance, ones that pass in a negative integer as the size due to a bogus calculation -- will fail in safe ways. Returning an error in these situations is specified by POSIX, but POSIX appears to have an off-by-one error that isn't duplicated in this change. Previously, some of these functions would silently cap the size at INT_MAX+1, and others would exit with an error after writing more than INT_MAX characters. PR: 39256 MFC after: 2 weeks
* | | - Fix the claim that the output is always null-terminated. This isn'tdas2012-04-211-17/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | true if the size is zero. - Fix a claim that sprintf() is the same as snprintf() with an infinite size. It's equivalent to snprintf() with a size of INT_MAX + 1. - Document the return values in the return values section. - Document the possible errno value of EOVERFLOW. MFC after: 2 weeks
* | | Ensure that the {,v}swprintf functions always null-terminate thedas2012-04-211-0/+3
| | | | | | | | | | | | output string, even if an encoding error or malloc failure occurs.
* | | Fix a bug introduced in r187302 that was causing fputws() to enter andas2012-04-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | infinite loop pretty much unconditionally. It's remarkable that the patch that introduced the bug was never tested, but even more remarkable that nobody noticed for over two years. PR: 167039 MFC after: 3 days
* | | Import jemalloc 9ef7f5dc34ff02f50d401e41c8d9a4a928e7c2aa (dev branch,jasone2012-04-1713-8250/+182
| | | | | | | | | | | | | | | | | | | | | | | | prior to 3.0.0 release) as contrib/jemalloc, and integrate it into libc. The code being imported by this commit diverged from lib/libc/stdlib/malloc.c in March 2010, which means that a portion of the jemalloc 1.0.0 ChangeLog entries are relevant, as are the entries for all subsequent releases.
* | | Replace the C implementation of __aeabi_read_tp with an assembly version.andrew2012-04-162-14/+9
| | | | | | | | | | | | | | | | | | This ensures we follow the ABI by preserving registers r1-r3. Reviewed by: jmallett, imp
* | | When searching for uninitialized memory usage add ensure that the entireeadler2012-04-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | struct is set to zero. PR: bin/166483 Submitted by: Roy Marples <roy@marples.name> Reviewed by: delphij Approved by: cperciva MFC after: 3 days
* | | Additional manual page updates for r234103.jh2012-04-131-8/+12
| | | | | | | | | | | | Submitted by: bde
* | | Return EBADF instead of EMFILE from dup2 when the second argument iseadler2012-04-112-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | outside the range of valid file descriptors PR: kern/164970 Submitted by: Peter Jeremy <peterjeremy@acm.org> Reviewed by: jilles Approved by: cperciva MFC after: 1 week
* | | Do not restore the register holding the TLS pointer when doing variousnwhitehorn2012-04-116-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | usermode context switches (long jumps and ucontext operations). If these are used across threads, multiple threads can end up with the same TLS base. Madness will then result. This makes behavior on PPC match that on x86 systems and on Linux. MFC after: 10 days
* | | - Return EPERM from ufs_setattr() when an user without PRIV_VFS_SYSFLAGSjh2012-04-101-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | privilege attempts to toggle SF_SETTABLE flags. - Use the '^' operator in the SF_SNAPSHOT anti-toggling check. Flags are now stored to ip->i_flags in one place after all checks. Submitted by: bde
* | | sem_open: Make sure to fail an O_CREAT|O_EXCL open, even if that semaphorejilles2012-04-091-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | is already open in this process. If the named semaphore is already open, sem_open() only increments a reference count and did not take the flags into account (which otherwise happens by passing them to open()). Add an extra check for O_CREAT|O_EXCL. PR: kern/166706 Reviewed by: davidxu MFC after: 10 days
* | | Unlike other functions __aeabi_read_tp function must preserve r1-r3. Theandrew2012-04-081-2/+5
| | | | | | | | | | | | | | | | | | | | | currently generated code clobbers r3. Fix this by loading ARM_TP_ADDRESS using inline assembly. Approved by: imp (mentor)
OpenPOWER on IntegriCloud