summaryrefslogtreecommitdiffstats
path: root/lib/libc
Commit message (Collapse)AuthorAgeFilesLines
* The NOTE_COPY should have been named NOTE_FFCOPY from the veryru2011-12-071-2/+2
| | | | | | beginning. Submitted by: Igor Sysoev
* libc: Eliminate 13 relative relocations in wctype().jilles2011-12-051-26/+45
|
* Revert r227812 and r227808 per discussioneadler2011-12-024-30/+18
| | | | | Reviewed by: many Approved by: des
* Split sentences at period boundaries.obrien2011-12-027-73/+93
|
* Tweak the r137233 fix to r136283 -- Code was making two send() attemptsobrien2011-12-021-3/+3
| | | | | | | | | | | | | vs. the comment documented "If we are working with a privileged socket, then take only one attempt". Make the code match. Furthermore, critical privileged applications that [over] log a vast amount can look like a DoS to this code. Given it's unlikely the single reattempted send() will succeeded, avoid usurping the scheduler in a library API for a single non-critical facility in critical applications. Obtained from: Juniper Networks Discussed with: glebius
* Cross-reference capsicum.4 from cap_enter.2 and cap_new.2.rwatson2011-11-272-1/+3
| | | | | MFC after: 3 days Sponsored by: Google, Inc.
* style(9) fix.theraven2011-11-261-1/+1
| | | | Approved by: dim (mentor)
* Return not-implemented from pthread_once and pthread_key_create, rathertheraven2011-11-261-2/+10
| | | | | | | | | than silently failing and returning success. Without this, code calls pthread_once(), receives a return value of success, and thinks that the passed function has been called. Approved by: dim (mentor)
* fdopendir(): Do not close the passed file descriptor on failure.jilles2011-11-221-4/+13
| | | | Reviewed by: delphij
* Fix a crash when trying to duplicate a locale that contains some implicit C ↵theraven2011-11-221-1/+6
| | | | | | | locale components. Reported by: Michael Butler Approved by: dim (mentor)
* - fix some style(9) nits with my last commiteadler2011-11-222-3/+5
| | | | | | | - add a comment explaining why I used '|' instead of '||' Submitted by: danfe@ Approved by: emaste@
* - add check for pointer equality prior to performing the O(n) passeadler2011-11-224-18/+28
| | | | | | | | | - while here change 's' to 's1' in strcoll Submitted by: eadler@ Reviewed by: theraven@ Approved by: brooks@ MFC after: 2 weeks
* (Hopefully) Fix the build with clang by removing a typedef that's no longer ↵theraven2011-11-211-2/+0
| | | | | | needed. Approved by: brooks (mentor)
* Add history for setsockopt(2).pluknet2011-11-211-2/+4
| | | | | | PR: docs/162719 Submitted by: Niclas Zeising <niclas at zeising gmail> MFC after: 1 week
* - Add the ffclock_getcounter(), ffclock_getestimate() and ffclock_setestimate()lstewart2011-11-213-1/+183
| | | | | | | | | | | | | | | | | | | | system calls to provide feed-forward clock management capabilities to userspace processes. ffclock_getcounter() returns the current value of the kernel's feed-forward clock counter. ffclock_getestimate() returns the current feed-forward clock parameter estimates and ffclock_setestimate() updates the feed-forward clock parameter estimates. - Document the syscalls in the ffclock.2 man page. - Regenerate the script-derived syscall related files. Committed on behalf of Julien Ridoux and Darryl Veitch from the University of Melbourne, Australia, as part of the FreeBSD Foundation funded "Feed-Forward Clock Synchronization Algorithms" project. For more information, see http://www.synclab.org/radclock/ Submitted by: Julien Ridoux (jridoux at unimelb edu au)
* Add support for the SCTP_REMOTE_UDP_ENCAPS_PORT socket option.tuexen2011-11-201-0/+3
| | | | | | | Retire the the now unused sctp_udp_tunneling_for_client_enable sysctl variable. MFC after: 3 months.
* Implement xlocale APIs from Darwin, mainly for use by libc++. This adds atheraven2011-11-20141-800/+4050
| | | | | | | | | | | | load of _l suffixed versions of various standard library functions that use the global locale, making them take an explicit locale parameter. Also adds support for per-thread locales. This work was funded by the FreeBSD Foundation. Please test any code you have that uses the C standard locale functions! Reviewed by: das (gdtoa changes) Approved by: dim (mentor)
* Fix typo.kib2011-11-171-2/+2
| | | | | Submitted by: arundel MFC after: 3 days
* Further reduce diffs with OpenBSD's arc4random. The main functionaldas2011-11-151-33/+30
| | | | | | | | | | | | | | | | change here is to ensure that when a process forks after arc4random is seeded, the parent and child don't observe the same random sequence. OpenBSD's fix introduces some additional overhead in the form of a getpid() call. This could be improved upon, e.g., by setting a flag in fork(), if it proves to be a problem. This was discussed with secteam (simon, csjp, rwatson) in 2008, shortly prior to my going out of town and forgetting all about it. The conclusion was that the problem with forks is worrisome, but it doesn't appear to have introduced an actual vulnerability for any known programs. The only significant remaining difference between our arc4random and OpenBSD's is in how we seed the generator in arc4_stir().
* Sync the style, comments, and variable names of arc4random.c withdas2011-11-151-39/+33
| | | | | | | | | | OpenBSD's version (r1.22). While some of our style changes were indeed small improvements, being able to easily track functionality changes in OpenBSD seems more useful. Also fix style bugs in the FreeBSD-specific parts of this file. No functional changes, as verified with md5.
* Converting int to wint_t leads to broekn comparison of raw charkevlo2011-11-111-8/+8
| | | | | | and encoded wint_t. Spotted by: ache
* Document that flock can return ENOLCKdougb2011-11-101-1/+3
|
* - Don't handle out-of-memory conditionkevlo2011-11-101-20/+21
| | | | | | | - Fix types of function arguments match their declaration Reviewed by: delphij Obtained from: NetBSD
* Fix a warning emitted by Clang.ed2011-11-041-1/+2
| | | | | | The size passed to strlcat() must depend on the input length, not the output length. Because the input and output buffers are equal in size, the resulting binary does not change at all.
* Add the posix_fadvise(2) system call. It is somewhat similar tojhb2011-11-044-2/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | madvise(2) except that it operates on a file descriptor instead of a memory region. It is currently only supported on regular files. Just as with madvise(2), the advice given to posix_fadvise(2) can be divided into two types. The first type provide hints about data access patterns and are used in the file read and write routines to modify the I/O flags passed down to VOP_READ() and VOP_WRITE(). These modes are thus filesystem independent. Note that to ease implementation (and since this API is only advisory anyway), only a single non-normal range is allowed per file descriptor. The second type of hints are used to hint to the OS that data will or will not be used. These hints are implemented via a new VOP_ADVISE(). A default implementation is provided which does nothing for the WILLNEED request and attempts to move any clean pages to the cache page queue for the DONTNEED request. This latter case required two other changes. First, a new V_CLEANONLY flag was added to vinvalbuf(). This requests vinvalbuf() to only flush clean buffers for the vnode from the buffer cache and to not remove any backing pages from the vnode. This is used to ensure clean pages are not wired into the buffer cache before attempting to move them to the cache page queue. The second change adds a new vm_object_page_cache() method. This method is somewhat similar to vm_object_page_remove() except that instead of freeing each page in the specified range, it attempts to move clean pages to the cache queue if possible. To preserve the ABI of struct file, the f_cdevpriv pointer is now reused in a union to point to the currently active advice region if one is present for regular files. Reviewed by: jilles, kib, arch@ Approved by: re (kib) MFC after: 1 month
* Despite official i386 ABI does not mandate any stack alignment besideskib2011-11-022-0/+28
| | | | | | | | the word alignment, some versions of gcc do require 16-byte alignment. Make sure the stack is 16-byte aligned before calling a subroutine. Inspired by: PR amd64/162214 MFC after: 1 week
* Make sure that stack is 16-byte aligned before calling a function,kib2011-11-022-0/+6
| | | | | | | | | as it is required by amd64 ABI. Add a comment for the places were the stack is accidentally properly aligned already. PR: amd64/162214 Submitted by: yamayan <yamayan kbh biglobe ne jp> MFC after: 1 week
* Don't forget to kick the man page date.ed2011-10-271-1/+1
|
* Make our utmpx more like System V.ed2011-10-272-3/+20
| | | | | | | | | | | | | | | | | | | | When booting the system, truncate the utx.active file, but do write the BOOT_TIME record into it afterwards. This allows one to obtain the boot time of the system as follows: struct utmpx u1 = { .ut_type = BOOT_TIME }, *u2; setutxent(); u2 = getutxid(&u1); Now, the boot time is stored in u2->ut_tv, just like on Linux and other systems. We don't open the utx.active file with O_EXLOCK. It's rather unlikely that other applications use this database at the same time and I want to prevent the possibility of deadlocks in init(8). Discussed with: pluknet
* Fix the manual section number for a cross-reference to open(2) and sort it.pluknet2011-10-271-1/+1
| | | | | Reviewed by: ed MFC after: 3 days
* Fix typo in timer_getoverrun cross-reference.pluknet2011-10-261-1/+1
| | | | MFC after: 3 days
* Replace a proliferation of buggy MD implementations of modf() with adas2011-10-2128-987/+149
| | | | | | | working MI one. The MI one only needs to be overridden on machines with non-IEEE754 arithmetic. (The last supported one was the VAX.) It can also be overridden if someone comes up with a faster one that actually passes the regression tests -- but this is harder than it sounds.
* Add support for the 'x' mode option in fopen() as specified in the C1Xdas2011-10-212-49/+60
| | | | | | draft standard. The option is equivalent to O_EXCL. MFC after: 1 month
* - change "is is" to "is" or "it is"eadler2011-10-161-1/+1
| | | | | | | | - change "the the" to "the" Approved by: lstewart Approved by: sahil (mentor) MFC after: 3 days
* Add a new trace point, KTRFAC_CAPFAIL, which traces capability checkdes2011-10-111-3/+4
| | | | failures. It is included in the default set for ktrace(1) and kdump(1).
* Add a FBSD_1.3 namespace for FreeBSD 10.das2011-10-101-1/+5
|
* Line up the struct declaration (yes, I know this isn't what it looksdes2011-10-091-6/+6
| | | | like in the header file)
* Document some not-so-recently added trace points.des2011-10-091-2/+7
| | | | MFC after: 1 week
* Fix whitespace inconsistencies found in homegrown Symbol.maps.ed2011-10-073-13/+13
|
* Remove no longer needed BUGS section.kib2011-10-061-9/+1
| | | | MFC after: 1 month
* Remove no longer valid statement about ARM.kib2011-10-041-2/+2
| | | | MFC after: 1 month
* Reimplement ctermid().ed2011-10-012-21/+35
| | | | | | | | | | | Even though POSIX allows us to return simply /dev/tty as a pathname identifying the controlling terminal of the running process, it is nicer if this function were actually useful, by returning the actual pathname of the controlling terminal. Implement ctermid() by using the kern.devname sysctl to resolve the actual name of /dev/tty. Don't use devname(3), since it may return bogus strings like #C:0x123.
* Get rid of major/minor number distinction.ed2011-09-281-2/+3
| | | | | | | | | | | | | | | | | | | | | | As of FreeBSD 6, devices can only be opened through devfs. These device nodes don't have major and minor numbers anymore. The st_rdev field in struct stat is simply based a copy of st_ino. Simply display device numbers as hexadecimal, using "%#jx". This is allowed by POSIX, since it explicitly states things like the following (example taken from ls(1)): "If the file is a character special or block special file, the size of the file may be replaced with implementation-defined information associated with the device in question." This makes the output of these commands more compact. For example, ls(1) now uses approximately four columns less. While there, simplify the column length calculation from ls(1) by calling snprintf() with a NULL buffer. Don't be afraid; if needed one can still obtain individual major/minor numbers using stat(1).
* Fix grammar.schweikh2011-09-271-3/+3
| | | | | | PR: 140457 Submitted by: jeremyhu AT apple.com MFC after: 2 weeks
* - Fix a trivial bug in iconv. When there is no space to perform thegabor2011-09-191-2/+1
| | | | | | | | | conversion, conversion must fail and errno must be set to E2BIG. PR: standards/160673 Submitted by: Henning Petersen <henning.petersen@t-online.de> Reviewed by: pluknet Approved by: re (kib), delphij (mentor)
* Clarify the behaviour of sigwait() on signal interruption, and notekib2011-08-252-2/+20
| | | | | | the difference between sigwait() and sigtimedwait()/sigwaitinfo(). Approved by: re (bz)
* Add experimental support for process descriptorsjonathan2011-08-184-3/+191
| | | | | | | | | | | | | | | | | | | | | | | | | | A "process descriptor" file descriptor is used to manage processes without using the PID namespace. This is required for Capsicum's Capability Mode, where the PID namespace is unavailable. New system calls pdfork(2) and pdkill(2) offer the functional equivalents of fork(2) and kill(2). pdgetpid(2) allows querying the PID of the remote process for debugging purposes. The currently-unimplemented pdwait(2) will, in the future, allow querying rusage/exit status. In the interim, poll(2) may be used to check (and wait for) process termination. When a process is referenced by a process descriptor, it does not issue SIGCHLD to the parent, making it suitable for use in libraries---a common scenario when using library compartmentalisation from within large applications (such as web browsers). Some observers may note a similarity to Mach task ports; process descriptors provide a subset of this behaviour, but in a UNIX style. This feature is enabled by "options PROCDESC", but as with several other Capsicum kernel features, is not enabled by default in GENERIC 9.0. Reviewed by: jhb, kib Approved by: re (kib), mentor (rwatson) Sponsored by: Google Inc
* Cross-reference cap_new(2) from dup(2), as they have similar functionality.rwatson2011-08-141-1/+7
| | | | Approved by: re (kib)
* Fix a pathname (s,netinet/if_ether.h,net/ethernet.h,).hrs2011-08-081-1/+1
| | | | | | PR: docs/159341 Submitted by: Garrett Cooper Approved by: re (kib)
* The result of a joint work between rrs@ and myself at the IETF:tuexen2011-08-031-0/+3
| | | | | | | | | | | * Decouple the path supervision using a separate HB timer per path. * Add support for potentially failed state. * Bring back RTO.min to 1 second. * Accept packets on IP-addresses already announced via an ASCONF * While there: do some cleanups. Approved by: re@ MFC after: 2 months.
OpenPOWER on IntegriCloud