Commit graph

11672 commits

Author SHA1 Message Date
Xin LI 92226c92f3 Use calloc() instaed of zeroing memory ourselves. 2008-04-13 08:05:08 +00:00
David Schultz 77fab5a8eb Unbreak the build for arm and powerpc.
Pointy hat to yours truly.
2008-04-12 14:53:52 +00:00
David Schultz e058c00c40 Updates for changes in the way printf() handles hex floating point
numbers.
2008-04-12 03:11:56 +00:00
David Schultz 76303a9735 Make several changes to the way printf handles hex floating point (%a):
1. Previously, printing the number 1.0 could produce 0x1p+0, 0x2p-1,
   0x4p-2, or 0x8p-3, depending on what happened to be convenient. This
   meant that printing a value as a double and printing the same value
   as a long double could produce different (but equivalent) results.
   The change is to always make the leading digit a 1, unless the
   number is 0. This solves the aforementioned problem and has
   several other advantages.

2. Use the FPU to do rounding. This is far simpler and more portable
   than manipulating the bits, and it fixes an obsure round-to-even
   bug. It also raises the exceptions now required by IEEE 754R.
   The drawbacks are that it is usually slightly slower, and it makes
   printf less effective as a debugging tool when the FPU is hosed
   (e.g., due to a buggy softfloat implementation).

3. On i386, twiddle the rounding precision so that (2) works properly
   for long doubles.

4. Make several simplifications that are now possible due to (2).

5. Split __hldtoa() into a separate file.

Thanks to remko for access to a sparc64 box for testing.
2008-04-12 03:11:36 +00:00
David Schultz 10a465e525 Fix some bugs that caused sparc64's quad precision sqrt to get
the wrong answer for virtually all inputs.

Thanks to remko for access to a sparc64 box for testing.
2008-04-12 03:10:13 +00:00
David Schultz a9d5aa6aeb Make the software emulator for long doubles set the FPU exception
flags appropriately. The next step is to make it raise a SIGFPE if
any exceptions are unmasked.

Thanks to remko for access to a sparc64 box for testing.
2008-04-12 03:09:51 +00:00
Xin LI 82e45205c8 Add memrchr(3).
Obtained from:	OpenBSD
2008-04-10 00:12:44 +00:00
Daniel Eischen fc9299dd1b Move the cpuset functions from FBSD_1.0 to FBSD_1.1. All symbols added
to 8.0 belong in the FBSD_1.1 symbol namespace.
2008-04-07 13:53:51 +00:00
Doug Rabson 472f4537e6 On i386, don't try to do network-type stuff if the device name is'nt pxeN. 2008-04-05 15:03:29 +00:00
Doug Rabson aea15cbc62 Add some compatibility code so that software which is built to use the new
struct flock with l_sysid member can work properly on an an old kernel which
doesn't support l_sysid.

Sponsored by:	Isilon Systems
2008-04-04 09:43:03 +00:00
Warner Losh 22e5baf782 Minor style(9) nit: move to using ANSI definition of functions. 2008-04-03 20:36:44 +00:00
Ruslan Ermilov c3ee8ebcbc Fix descriptions of "struct msqid_ds and "struct ipc_perm" to match
harsh reality.
2008-04-03 16:21:43 +00:00
David Schultz 92a1a6e169 Fix some corner cases:
- fma(x, y, z) returns z, not NaN, if z is infinite, x and y are finite,
  x*y overflows, and x*y and z have opposite signs.
- fma(x, y, z) doesn't generate an overflow, underflow, or inexact exception
  if z is NaN or infinite, as per IEEE 754R.
- If the rounding mode is set to FE_DOWNWARD, fma(1.0, 0.0, -0.0) is -0.0,
  not +0.0.
2008-04-03 06:14:51 +00:00
David Xu caad30a422 put THR_CRITICAL_LEAVE into do .. while statement. 2008-04-03 02:47:35 +00:00
Kevin Lo 6cec2e4b55 style(9) cleanup 2008-04-03 02:41:54 +00:00
David Xu a6cba9400a add __hidden suffix to _umtx_op_err, this eliminates PLT. 2008-04-03 02:13:51 +00:00
David Xu 7abb97dcd8 Non-portable functions are in pthread_np.h, fix compiling problem. 2008-04-02 11:41:12 +00:00
David Xu 7a30bcf04b Add pthread_setaffinity_np and pthread_getaffinity_np to libc namespace. 2008-04-02 08:53:18 +00:00
David Xu 8b873a2328 Remove unused functions. 2008-04-02 08:33:42 +00:00
David Xu d6e0eb0a48 Replace function _umtx_op with _umtx_op_err, the later function directly
returns errno, because errno can be mucked by user's signal handler and
most of pthread api heavily depends on errno to be correct, this change
should improve stability of the thread library.
2008-04-02 07:41:25 +00:00
David Xu 8bf1a48cb3 Replace userland rwlock with a pure kernel based rwlock, the new
implementation does not switch pointers when it resumes waiters.

Asked by: jeff
2008-04-02 04:32:31 +00:00
David Xu ad4a96ba13 Normally, we are often reading local time rather than setting time zone,
replace mutex with rwlock, this should eliminate lock contention in
most cases.
2008-04-01 06:56:11 +00:00
David Xu 18967c1918 Restore normal pthread_cond_signal path to avoid some obscure races. 2008-04-01 06:23:08 +00:00
David Xu f5bc4f9930 return EAGAIN early rather than running bunch of code later, micro optimize
static branch prediction.
2008-04-01 00:21:49 +00:00
David Schultz 8087c515ab Remove a (bogus) remnant of debugging this on sparc64. 2008-03-31 13:11:45 +00:00
Konstantin Belousov ba2983e5b3 Add the libc glue and headers definitions for the *at() syscalls.
Based on the submission by rdivacky,
	sponsored by Google Summer of Code 2007
Reviewed by:	rwatson, rdivacky
Tested by:	pho
2008-03-31 12:14:04 +00:00
Tim Kientzle 4b7d286a5b Include an extra byte for the trailing NUL. <sigh>
Pointy hat: Me
2008-03-31 06:24:39 +00:00
David Xu 5ab512bb8e Rewrite rwlock to user atomic operations to change rwlock state, this
eliminates internal mutex lock contention when most rwlock operations
are read.

Orignal patch provided by: jeff
2008-03-31 02:55:49 +00:00
David Schultz 074fb64d9a Add assembly versions of remquol() and remainderl(). 2008-03-30 21:21:53 +00:00
David Schultz c7392feecc Hook remquol() and remainderl() up to the build. 2008-03-30 20:48:02 +00:00
David Schultz a2e5f27559 Implement remainderl() as a wrapper around remquol(). The extra work
remquol() performs to compute the quotient is negligible.
2008-03-30 20:47:42 +00:00
David Schultz cef56f9d6d Implement remquol() based on remquo(). 2008-03-30 20:47:26 +00:00
David Schultz 511dd36b32 Implement csqrtl(). 2008-03-30 20:07:15 +00:00
David Schultz 84c1c0a1ca Hook hypotl() and cabsl() up to the build. 2008-03-30 20:03:46 +00:00
David Schultz 01a13522ad Document hypotl().
Submitted by:	Steve Kargl <sgk@troutmask.apl.washington.edu>
2008-03-30 20:03:29 +00:00
David Schultz a641fc76eb Alias hypotl() and cabsl() for platforms where long double is the same
as double.
2008-03-30 20:03:06 +00:00
David Schultz 2264157a42 Implement cabsl() in terms of hypotl().
Submitted by:	Steve Kargl <sgk@troutmask.apl.washington.edu>
2008-03-30 20:02:03 +00:00
David Schultz d23166b015 Implement hypotl(). This is bde's conversion of fdlibm hypot(), with minor
fixes for ld128 by me.
2008-03-30 20:01:50 +00:00
Bruce Evans 42ee187c3c Use fabs[f]() instead of bit fiddling for setting absolute values.
This makes little difference in float precision, but in double
precision gives a speedup of about 30% on amd64 (A64 CPU) and i386
(A64).  This depends on fabs[f]() being inline and efficient.  The
bit fiddling (or any use of SET_HIGH_WORD(), which libm does too
much because it was best on old 32-bit machines) always causes
packing overheads and sometimes causes stalls in the packing, since
it operates on only part of a variable in the double precision case.
It apparently did cause stalls in a critical path here.
2008-03-30 18:07:12 +00:00
Bruce Evans c0c7ddd3a8 Use the expression fabs(x+0.0)-fabs(y+0.0) instead of
fabs(x+0.0)+fabs(y+0.0) when mixing NaNs.  This improves
consistency of the result by making it harder for the compiler to reorder
the operands.  (FP addition is not necessarily commutative because the
order of operands makes a difference on some machines iff the operands are
both NaNs.)
2008-03-30 17:28:27 +00:00
Bruce Evans f94997c8d7 Fix a missing mask in a hi+lo decomposition. Thus bug made the extra
precision in software useless, so hypotf() had some errors in the 1-2
ulp range unless there is extra precision in hardware (as happens on
i386).
2008-03-30 17:17:42 +00:00
Doug Rabson ecc03b80f1 Don't call xdrrec_skiprecord in the non-blocking case. If
__xdrrec_getrec has returned TRUE, then we have a complete request in
the buffer - calling xdrrec_skiprecord is not necessary. In particular,
if there is another record already buffered on the stream,
xdrrec_skiprecord will discard both this request and the next
one, causing the call to xdr_callmsg to fail and the stream to be
closed.

Sponsored by:	Isilon Systems
2008-03-30 09:36:17 +00:00
Doug Rabson 7ea7cc4bab Don't assume that there is readable data on the stream after the
fragment header.
2008-03-30 09:35:04 +00:00
Ruslan Ermilov dbdb679c6f Remove options MK_LIBKSE and DEFAULT_THREAD_LIB now that we no longer
build libkse.  This should fix WITHOUT_LIBTHR builds as a side effect.
2008-03-29 17:44:40 +00:00
David Schultz a1af0d70da Include math.h for the fmaf() prototype. 2008-03-29 16:38:29 +00:00
David Schultz ee0730e61e Fix some rather obscene code that has ambiguous if...if...else...
constructs in it.
2008-03-29 16:37:59 +00:00
David Schultz 838200ff96 Document modff() and modfl(). Technically, modff() and modfl()
live in libm, while modf() lives in libc due to historical
mistakes. I'm claiming in the manpage that they all live in libm,
since programmers should not rely on the mistake.
2008-03-29 16:19:35 +00:00
Jeff Roberson d1317e00b8 - Add a man page for cpuset_getaffinity() and cpuset_setaffinity() and
hook it up to the build.

Reviewed by:	brueffer (skeleton and formatting assistance)
2008-03-29 10:26:29 +00:00
Jeff Roberson 329356f9f2 - Add a man page for cpuset(), cpuset_setid(), and cpuset_getid() and hook
it up to the build.

Reviewed by:	brueffer (skeleton and formatting assistance)
2008-03-29 10:06:30 +00:00
Paul Saab 6e7534b8c8 Add support to mincore for detecting whether a page is part of a
"super" page or not.

Reviewed by:	alc, ups
2008-03-28 04:29:27 +00:00