summaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* 1) POSIX requires rand(3) return values to be in the [0, RAND_MAX] range,ache2013-07-031-4/+16
| | | | | | | | | | | | | | | | but ACM formula we use have internal state (and return value) in the [1, 0x7ffffffe] range, so our RAND_MAX (0x7fffffff) is never reached because it is off by one, zero is not reached too. Correct both RAND_MAX and rand(3) return value, shifting last one to the 0 by 1 subtracted, resulting POSIXed [0, 0x7ffffffd(=new RAND_MAX)] range. 2) Add a checks for not overflowing on too big seeds. It may happens on the machines, where sizeof(unsigned int) > 32 bits. Reviewed by: bde [1] MFC after: 2 weeks
* Make it clear that there are three separate internal locks.peter2013-07-034-25/+28
|
* As a followup to r252547, propate const down the call stack.peter2013-07-0321-46/+46
|
* Replace the #define for "iconv" so it is for the function name instead ofpeter2013-07-035-7/+9
| | | | | | a macro with parameters. Remove a __DECONST hack and add consts instead for gnu libiconv API compatability. This makes it work with things like devel/boost-libs that expects to use "iconv" as though it were a pointer.
* Move pos++ out of the complicated equation, introduced at r240780.mav2013-07-011-2/+3
| | | | | | | | There is an oppinion that result of that equation is compiler-specific. Submitted by: dt71@gmx.com, kientzle Reviewed by: rmacklem MFC after: 3 days
* If strdup failed, don't try and free the wrong thing.peter2013-07-011-1/+1
|
* __weak_alias() doesn't exist on FreeBSD. Use __weak_reference();peter2013-07-013-11/+19
| | | | | | | | | | | | | Expose iconv functions as weak symbols as well as their internal remapped #define names. This is necessary for autoconf compatability - on Linux it appears that #include <iconv.h> isn't a link time prerequisite for their version that's built into glibc. Initialize the pthread rwlock. Note that upstream has three separate locks. The file-local static lock appears intentional. I'm using this as a ports-compatible compile-time substitute for converters/libiconv on one of my personal machines.
* When decoding SLEB128, make sure sign extension is performed forkaiw2013-06-302-2/+2
| | | | | | 64-bit integers. MFC after: 3 days
* libc: Access _sigintr more efficiently.jilles2013-06-302-2/+2
| | | | | The variable _sigintr is not exported via the version script; therefore, tell the compiler that no indirection (to allow interposition) is needed.
* Convert this piece of code to use C11 atomics.ed2013-06-301-3/+4
| | | | | | | As mentioned before, we should at least aim to have one piece of code in both user space and kernel space that uses C11 atomics, to get some coverage. This piece of code can be migrated trivially, so it's a good candidate.
* Fix -Wunsequenced warningkientzle2013-06-291-1/+1
| | | | Submitted by: dt71@gmx.com
* Fix -Wunsequenced warning.kientzle2013-06-291-1/+1
| | | | Submitted by: dt71@gmx.com
* - Trim an unused and bogus Makefile for mount_smbfs.davide2013-06-284-0/+11
| | | | | | - Reconnect with some minor modifications, in particular now selsocket() internals are adapted to use sbintime units after recent'ish calloutng switch.
* Make the order of operations for lib/msun more clear.eadler2013-06-242-2/+2
| | | | | | | Tested with md5 sum of object code Reported by: swildner@DragonFlyBSD.org Submitted by: bde
* The SUSv4tc1 requires that pthread_setcancelstate() shall be not akib2013-06-191-1/+2
| | | | | | | | | cancellation point. When enabling the cancellation, only process the pending cancellation for asynchronous mode. Reported and reviewed by: Kohji Okuno <okuno.kohji@jp.panasonic.com> Sponsored by: The FreeBSD Foundation MFC after: 1 week
* Refine UMA bucket allocation to reduce space consumption and improvejeff2013-06-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | performance. - Always free to the alloc bucket if there is space. This gives LIFO allocation order to improve hot-cache performance. This also allows for zones with a single bucket per-cpu rather than a pair if the entire working set fits in one bucket. - Enable per-cpu caches of buckets. To prevent recursive bucket allocation one bucket zone still has per-cpu caches disabled. - Pick the initial bucket size based on a table driven maximum size per-bucket rather than the number of items per-page. This gives more sane initial sizes. - Only grow the bucket size when we face contention on the zone lock, this causes bucket sizes to grow more slowly. - Adjust the number of items per-bucket to account for the header space. This packs the buckets more efficiently per-page while making them not quite powers of two. - Eliminate the per-zone free bucket list. Always return buckets back to the bucket zone. This ensures that as zones grow into larger bucket sizes they eventually discard the smaller sizes. It persists fewer buckets in the system. The locking is slightly trickier. - Only switch buckets in zalloc, not zfree, this eliminates pathological cases where we ping-pong between two buckets. - Ensure that the thread that fills a new bucket gets to allocate from it to give a better upper bound on allocation time. Sponsored by: EMC / Isilon Storage Division
* Build __clear_cache on ARM with clang now it supports it.andrew2013-06-151-5/+1
|
* Let ARM use the custom tailored atomic intrinsics.ed2013-06-1511-211/+3
|
* Renumber clauses to reduce diffs to other versionsemaste2013-06-1328-28/+28
| | | | | NetBSD, OpenBSD, and Android's Bionic number the clauses 1 through 3, so follow suit to make comparison easier.
* Turn libc.so into an ld script rather than a symlink pointing to thejlh2013-06-122-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | real shared object and libssp_nonshared.a. This was the last showstopper that prevented from enabling SSP for ports by default. portmgr@ performed a buildworld which showed no significant breakage with this patch. Details: On i386 for PIC objects, gcc uses the __stack_chk_fail_local hidden symbol instead of calling __stack_chk_fail directly [1]. This happen not only with our gcc-4.2.1 but also with the latest gcc-4.8. If you want the very nasty details, see [2]. OTOH the problem doesn't exist on other architectures. It also doesn't exist with Clang as the latter will somehow manage to create the function in the object file at compile time (contrary to only referencing it through a symbol that will be brought in at link time). In a perfect world, when an object file is compiled with -fstack-protector, it will be linked into a binary or a DSO with this same flag as well, so GCC will add libssp_nonshared.a to the linker command-line. Unfortunately, we don't control softwares in ports and we may have such broken DSO. This is the whole point of this patch. You can reproduce the problem on i386 by compiling a source file into an object file with "-fstack-protector-all -fPIE" and linking it into a binary without "-fstack-protector". This ld script automatically proposes libssp_nonshared.a along with the real libc DSO to the linker. It is important to understand that the object file contained in this library will be pulled in the resulting binary _only if_ the linker notices one of its symbols is needed (i.e. one of the SSP symbol is missing). A theorical performance impact could be when compiling, but my testing showed less than 0.1% of difference. [1] For 32-bit code gcc saves the PIC register setup by using __stack_chk_fail_local hidden function instead of calling __stack_chk_fail directly. See comment line 19460 in: src/contrib/gcc/config/i386/i386.c [2] When compiling a source file to an object file, if you use something which is external to the compilation unit, GCC doesn't know yet if this symbol will be inside or outside the DSO. So it expects the worst case and routes the symbol through the GOT, which means additional space and extra relocation for rtld(1). Declaring a symbol has hidden tells GCC to use the optimal route (no GOT), but on the other hand this means the symbol has to be provided in the same DSO (namely libssp_nonshared.a). On i386, GCC actually uses an hidden symbol for SSP in PIC objects to save PIC register setup, as said in [1]. PR: ports/138228 PR: ports/168010 Reviewed by: kib, kan
*-. Upgrade our copy of llvm/clang to 3.3 release.dim2013-06-1214-13/+38
|\ \ | | | | | | | | | | | | | | | Release notes are still in the works, these will follow soon. MFC after: 1 month
| | * Vendor import of clang tags/RELEASE_33/final r183502 (effectively, 3.3dim2013-06-10221-5312/+13295
| | | | | | | | | | | | | | | release): http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_33/final@183502
| * | Vendor import of llvm tags/RELEASE_33/final r183502 (effectively, 3.3dim2013-06-10500-12204/+34342
| | | | | | | | | | | | | | | release): http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_33/final@183502
* | | Borrow the algorithm from kvm_getprocs() to fix procstat_getprocs() tojhb2013-06-111-7/+11
| | | | | | | | | | | | | | | | | | | | | handle the case where the process tables grows in between the calls to fetch the size and fetch the table. MFC after: 1 week
* | | Add implementations of acoshl(), asinhl(), and atanhl(). This is adas2013-06-1012-48/+344
| | | | | | | | | | | | merge of the work done by bde and myself.
* | | Make recv() and send() cancellation points, as required by POSIX.jilles2013-06-092-6/+10
| | | | | | | | | | | | | | | Call the recvfrom() and sendto() functions overridden by libthr instead of the _recvfrom() and _sendto() versions that are not cancellation points.
* | | Minor mdoc fixes.joel2013-06-091-3/+3
| | |
* | | libstand: Reset the seek pointer in ext2fs as done in UFS.pfg2013-06-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on r134760: Reset the seek pointer to 0 when a file is successfully opened, since otherwise the initial seek offset will contain the directory offset of the filesystem block that contained its directory entry. This bug was mostly harmless because typically the directory is less than one filesystem block in size so the offset would be zero. It did however generally break loading a kernel from the (large) kernel compile directory. Also reset the seek pointer when a new inode is opened in read_inode(), though this is not actually necessary now because all callers set it afterwards. PR: 177328 Submitted by: Eric van Gyzen Reviewed by: iedowse MFC after: 5 days
* | | sigaction(2): Document various non-POSIX functions as async-signal safe.jilles2013-06-081-2/+15
| | |
* | | Add new system call - aio_mlock(). The name speaks for itself. It allowsglebius2013-06-083-0/+135
| | | | | | | | | | | | | | | | | | | | | | | | to perform the mlock(2) operation, which can consume a lot of time, under control of aio(4). Reviewed by: kib, jilles Sponsored by: Nginx, Inc.
* | | Use improved __sync_*() intrinsics for MIPS in userspace as well.ed2013-06-088-56/+5
| | | | | | | | | | | | | | | r251524 introduced custom tailored versions for MIPS of these functions for kernel-space code. We can just reuse them in userspace as well.
* | | Finish pulling in the NetBSD setjmp/longjmp updates on ARM.andrew2013-06-074-4/+162
| | | | | | | | | | | | | | | | | | | | | | | | Store/restore the VFP registers in setjmp/longjmp on ARM EABI if VFP is enabled in the kernel. It checks the hw.floatingpoint sysctl to see if floating-point is available and uses this to determine if it should store them. If it does it uses a different magic value so longjmp is able to know if it should load them.
* | | Include machine/setjmp.h to get the definition of _JB_MAGIC__SETJMP. Thisandrew2013-06-071-1/+3
| | | | | | | | | | | | allows us to remove it from the ARM copy of machine/asm.h.
* | | Remove an extra copy of _setjmp from libstand. We have used the libc versionandrew2013-06-071-106/+0
| | | | | | | | | | | | of this function since r183876.
* | | Add libusb_get_port_numbersemaste2013-06-073-2/+13
| | | | | | | | | | | | | | | | | | libusbx deprecated libusb_get_port_path and replaced it with libusb_get_port_numbers. The latter omits an extra parameter which was unused in the FreeBSD implementation anyway.
* | | Switch to 2-clause license and standard textemaste2013-06-062-26/+22
| | | | | | | | | | | | Approved by: bms@
* | | Remove part of the NetBSD longjmp code that was not ready to be merged.andrew2013-06-051-2/+1
| | |
* | | Style fixes.das2013-06-054-54/+58
| | | | | | | | | | | | Submitted by: bde
* | | Start to merge the updated ARM NetBSD setjump/longjmp functions. To beginandrew2013-06-042-75/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with merge the functions but leave out the code to save/load the VFP registers as that requires other changes to ensure the VFP is enabled first. This removes storing the old fpa registers. These were never fully supported, and the only user of this code I can find have moved to newer CPUs which use a VFP.
* | | mdoc: convert .Fd to .In, which is much nicer.joel2013-06-043-7/+7
| | |
* | | Add man links for expl(3) and expm1l(3).das2013-06-041-2/+2
| | |
* | | Fix a typo: XPORT_SPI should be tested against transport, nor protocol.delphij2013-06-031-1/+1
| | | | | | | | | | | | | | | | | | Submitted by: Sascha Wildner <swildner dragonflybsd org> Reviewed by: mjacob MFC after: 2 weeks
* | | Change a comma to a semicolon.kargl2013-06-031-3/+2
| | | | | | | | | | | | | | | | | | Remove a blank line that crept into the declarations. Fix a comment to show a sign on a NaN.
* | | ld80 and ld128 implementations of expm1l(). This code started lifekargl2013-06-036-4/+373
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | as a fairly faithful implementation of the algorithm found in PTP Tang, "Table-driven implementation of the Expm1 function in IEEE floating-point arithmetic," ACM Trans. Math. Soft., 18, 211-222 (1992). Over the last 18-24 months, the code has under gone significant optimization and testing. Reviewed by: bde Obtained from: bde (most of the optimizations)
* | | Fix two comments that got lost in the disentanglement of the larger diff.kargl2013-06-031-1/+6
| | |
* | | ld80/s_expl.c:kargl2013-06-032-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Use integral numerical constants, and let the compiler do the conversion to long double. ld128/s_expl.c: * Use integral numerical constants, and let the compiler do the conversion to long double. * Use the ENTERI/RETURNI macros, which are no-ops on ld128. This however makes the ld80 and ld128 identical. Reviewed by: bde (as part of larger diff)
* | | Micro-optimization: move the unary mius operator to operatekargl2013-06-032-3/+3
| | | | | | | | | | | | | | | | | | on a literal constant. Obtained from: bde
* | | Add a comment to note that bde supplied most, if not all,kargl2013-06-031-0/+2
| | | | | | | | | | | | of the optimizations.
* | | ld80/s_expl.c:kargl2013-06-032-13/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * In the special case x = -Inf or -NaN, use a micro-optimization to eliminate the need to access u.xbits.man. * Fix an off-by-one for small arguments |x| < 0x1p-65. ld128/s_expl.c: * In the special case x = -Inf or -NaN, use a micro-optimization to eliminate the need to access u.xbits.manh and u.xbits.manl. * Fix an off-by-one for small arguments |x| < 0x1p-114. Obtained from: bde
* | | ld80/s_expl.c:kargl2013-06-032-27/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Update the evaluation of the polynomial. This allows the removal of the now unused variables t23 and t45. ld128/s_expl.c: * Update the evaluation of the polynomial and the intermediate result t. This update allows several numerical constants to be written as double rather than long double constants. Update the constants as appropriate. Obtained from: bde
OpenPOWER on IntegriCloud