summaryrefslogtreecommitdiffstats
path: root/lib/libc
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Remove incorrect attribution.gnn2011-07-211-1/+1
| | | | | | Approved by: re (kib) Pointed out by: brueffer Pointy hat to: gnn
* Make both stpcpy and strcpy be assembly language implementationsgnn2011-07-213-20/+60
| | | | | | | | | on amd64. Submitted by: Guillaume Morin (guillaume at morinfr.org) Reviewed by: kib, jhb Approved by: re (bz) MFC after: 1 month
* Add cap_new(2) and cap_getrights(2) symbols to libc.jonathan2011-07-203-1/+478
| | | | | | | | These system calls have already been implemented in the kernel; now we hook up libc symbols so userspace can drive them. Approved by: re (kib), mentor (rwatson) Sponsored by: Google Inc
* Fix building of 32-bit compat libraries on amd64 with clang, and usingdim2011-07-181-4/+0
| | | | | | | | | | | | | | -g, by reverting r219139. The LLVM PR referenced in that revision was fixed in the mean time, and we imported a clang snapshot soon afterwards, so the temporary workaround of disabling clang's integrated assembler is no longer needed. In this particular case, using e.g. DEBUG_FLAGS=-g causes clang to output certain directives into assembly that our version of GNU as chokes on. Reported by: dougb Approved by: re (kib)
* Document RFTSIGZMB. Fix spelling of SIGCHLD. Note that signals arekib2011-07-121-2/+14
| | | | | | delivered, not returned. MFC after: 1 week
* posix_spawn: If an error is detected in the child process, reap the zombie.jilles2011-07-101-1/+4
| | | | | | | | | | Formerly, in this case an error was returned but the pid was also returned to the application, requiring the application to use unspecified behaviour (the returned pid in error situations) to avoid zombies. Now, reap the zombie and do not return the pid. MFC after: 2 weeks
* Add a HISTORY sectionkevlo2011-07-101-0/+5
| | | | Requested by: arundel
* - Add xdr_sizeof(3) to libckevlo2011-07-094-4/+22
| | | | | | - Document xdr_sizeof(3); from NetBSD Discussed with: kib
* Fix whitespace inconsistencies in libc in files copyrighted by me.ed2011-06-265-8/+8
|
* Change sparc64 to use the initial exec TLS model, too. This avoids randommarius2011-06-211-1/+1
| | | | assertion failures in _malloc_thread_cleanup().
* Put a quick bandaid on internal citrus locking.kan2011-06-192-1/+3
| | | | | The code is not quite right still, but it programs from deadlocking on themselves if one enables new citrus code by mistake.
* Fix clang warnings.benl2011-06-181-3/+4
| | | | Approved by: philip (mentor)
* Document the latest changes to sctp_opt_info() in the code.tuexen2011-06-181-4/+31
| | | | | This makes sctp_opt_info() compiliant with the latest version of the socket API ID.
* Note how wait(3) is implemented.obrien2011-06-181-0/+13
|
* Sync with OpenBSD, primarily make the code easier to read, and a licensedelphij2011-06-182-68/+54
| | | | | | | change to standard OpenBSD ISC license. Obtained from: OpenBSD MFC after: 2 weeks
* Sync with OpenBSD (zap rcsid).delphij2011-06-181-7/+1
| | | | MFC after: 2 weeks
* The flags argument of mpool_get() is meaningful, document it.delphij2011-06-181-2/+9
| | | | MFC after: 2 weeks
* posix_spawn(3): Document r222511 (trying to close already closed fd).jilles2011-06-171-9/+14
| | | | MFC after: 1 week
OpenPOWER on IntegriCloud