summaryrefslogtreecommitdiffstats
path: root/lib
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.
* Expose the unimplemented libm functions in the math.h header. This allows ↵theraven2011-11-121-13/+13
| | | | | | | C++'s <cmath> to work without the compiler complaining that the C++ versions are calling implicitly-declared functions. You will still get a linker error when they are called. OpenBSD 5.0 claims to fully implement the C99 <math.h> stuff, so might be worth investigating... Reviewed by: das Approved by: dim (mentor)
* 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
* Add definition of some USB 3.0 descriptors to libusb 1.0 and libusb 2.0.hselasky2011-11-096-3/+332
| | | | | | | Some header file parts of this patch were taken from a patch submitted by Maya Erez <merez@codeaurora.org> to the LibUSB developers list. MFC after: 1 week
* Ensure pam_lastlog removes the /dev/ component of the TTY name.ed2011-11-071-0/+5
| | | | | | | | | | Some consumers of PAM remove the /dev/ component (i.e. login), while others don't (i.e. su). We must ensure that the /dev/ component is removed to ensure that the utmpx entries properly work with tools such as w(1). Discussed with: des MFC after: 1 week
* When one attempts to compile the tree with -march=i386, which also useddim2011-11-062-0/+4
| | | | | | | | | | | to be gcc's default before r198344, calls to atomic builtins will not be expanded inline. Instead, they will be generated as calls to external functions (e.g. __sync_fetch_and_add_N), leading to linking errors later on. Put in a seatbelt that disables use of atomic builtins in libstdc++ and llvm, when tuning specifically for the real i386 CPU. This does not protect against all possible issues, but it is better than nothing.
* Remove an unused variable from pam_unix.ed2011-11-051-2/+0
| | | | | | | | This variable was added in r82352 back in 2001, but even then it didn't have any use. Because it's not marked static, the C compiler won't complain about it. Discussed with: des
* 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
* Note that pam_unix(8) does not respect PAM_CHANGE_EXPIRED_AUTHTOK.des2011-11-021-0/+6
|
* 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
* Fix Buildworld WITHOUT_OPENSSL.kientzle2011-10-222-4/+32
| | | | | PR: kern/160922 MFC after: 3 days
* Correct the spelling of getgrgid and getpwuid in the man page.kientzle2011-10-221-6/+6
| | | | MFC after: 3 days
*-. Upgrade our copy of llvm/clang to r142614, from upstream's release_30dim2011-10-2237-88/+150
|\ \ | | | | | | | | | | | | | | | | | | branch. This brings us very close to the 3.0 release, which is expected in a week or two. MFC after: 1 week
| | * Vendor import of clang release_30 branch r142614:dim2011-10-20398-31469/+50270
| | | | | | | | | | | | http://llvm.org/svn/llvm-project/cfe/branches/release_30@142614
| * | Vendor import of llvm release_30 branch r142614:dim2011-10-20849-33915/+63160
| | | | | | | | | | | | http://llvm.org/svn/llvm-project/llvm/branches/release_30@142614
* | | Revert the previous commit and add a comment explaining why it was wrong.des2011-10-221-2/+14
| | |
* | | openpam_static.c isn't auto-generated.des2011-10-221-5/+2
| | |
* | | Minor corrections and clarifications regarding exceptions.das2011-10-211-12/+23
| | |
* | | 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
* | | Fix a regression introduced in r226371: When the high part of x*ydas2011-10-212-6/+6
| | | | | | | | | | | | | | | exactly cancels with z, return the low part of x*y instead of discarding it.
* | | Fix a corner case: tan(large + Inf i) == NaN + NaN i.das2011-10-212-0/+10
| | |
* | | Improved handling of large x in ccosh{,f}():das2011-10-214-15/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | - Handle cases where exp(x) would overflow, but ccosh(x) ~= exp(x) / 2 shouldn't. - Use the ccosh(x) ~= exp(x) / 2 approximation to simplify the calculation when x is large. Similarly for csinh(). Also fixed the return value of csinh(-Inf +- 0i).
* | | Use __ldexp_exp() to simplify things and improve accuracy for x neardas2011-10-214-27/+10
| | | | | | | | | | | | the overflow threshold.
* | | The cexp() and {,c}{cos,sin}h functions all need to be able to computedas2011-10-216-33/+210
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | exp(x) scaled down by some factor, and the challenge is doing this accurately when exp(x) would overflow. This change replaces all of the tricks we've been using with common __ldexp_exp() and __ldexp_cexp() routines that handle all the scaling. bde plans to improve on this further by moving the guts of exp() into k_exp.c and handling the scaling in a more direct manner. But the current approach is simple and adequate for now.
* | | Use STRICT_ASSIGN() to ensure that the compiler doesn't screw thingsdas2011-10-214-5/+13
| | | | | | | | | | | | | | | | | | up by storing x in a wider type than it's supposed to. Submitted by: bde
* | | Per IEEE754r, pow(1, y) is 1 even if y is NaN, and pow(-1, +-Inf) is 1.das2011-10-212-2/+8
| | | | | | | | | | | | MFC after: 2 weeks
* | | Bugfix: feenableexcept() and fedisableexcept() should just return thedas2011-10-212-8/+8
| | | | | | | | | | | | | | | | | | old exception mask, not mask | ~FE_ALL_EXCEPT. MFC after: 2 weeks
* | | latin1 -> utf8des2011-10-198-9/+9
| | |
* | | Add a flush of the current PMC log buffer before displaying the next top.fabient2011-10-184-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | As the underlying block is 4KB if the PMC throughput is low the measurement will be reported on the next tick. pmcstat(8) use the modified flush API to reclaim current buffer before displaying next top. MFC after: 1 month
* | | Update llvm/clang's target triple (confusingly named LLVM_HOSTTRIPLE) todim2011-10-171-2/+1
| | | | | | | | | | | | $arch-unknown-freebsd10.0.
* | | It's no longer accurate to say that math.h "constitute[s] the C mathdas2011-10-171-1/+16
| | | | | | | | | | | | | | | | | | library," since complex.h, tgmath.h, and fenv.h are also part of the math library. Replace the outdated sentence with some references to the other parts.
* | | Add c{cos,sin,tan}{,h}{,f} functions. This is joint work withdas2011-10-1717-12/+871
| | | | | | | | | | | | bde and kargl.
* | | In pidfile_open(), if the pidfile is locked, but empty (PID is not stored yet)pjd2011-10-162-22/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and the caller requested other process' PID by passing non-NULL pidptr argument, we will wait at most 100ms for the PID to show up in the file and if it won't, we will store -1 in *pidptr. From now on, pidfile_open() function never sets errno to EAGAIN on failure. In collaboration with: des MFC after: 1 week
* | | - change "is is" to "is" or "it is"eadler2011-10-165-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | - change "the the" to "the" Approved by: lstewart Approved by: sahil (mentor) MFC after: 3 days
* | | Change the SDP_GET* macros to cast to a const buffer.ed2011-10-161-3/+3
| | | | | | | | | | | | This fixes a compiler warning when passing a const buffer to them.
* | | Change ncp_scan_bindery_object() to pass a constant search string.ed2011-10-161-1/+1
| | | | | | | | | | | | | | | The ncp_scan_bindery_object() function does not modify search_string internally, so there is no need to declare it as `char *'.
* | | Use #include "fenv.h" instead of #include <fenv.h>. This makes itdas2011-10-167-7/+7
| | | | | | | | | | | | | | | | | | more convenient to compile the math library by itself. Requested by: bde
* | | Fix some non-standard variable declarations.das2011-10-161-10/+10
| | |
* | | Optimize the case of pure imaginary arguments. Calls like this aredas2011-10-162-2/+9
| | | | | | | | | | | | | | | | | | common, e.g., in DFT implementations. Discussed with: bde, kargl
* | | Move the macros GET_LDBL_EXPSIGN() and SET_LDBL_EXPSIGN() intodas2011-10-162-15/+19
| | | | | | | | | | | | math_private.h, so they can be used elsewhere in the math library.
OpenPOWER on IntegriCloud