Commit Graph

11775 Commits

Author SHA1 Message Date
kib
2e4b86adc7 Man pages for the openat(2), fexecve(2) and related syscalls.
Reviewed by:	ru
2008-04-16 13:03:12 +00:00
imp
4f0c181fb3 Doh! Extra mips in the path. Remove these and wait until tomorrow
when I have more brain cells to try again.
2008-04-16 05:11:25 +00:00
imp
158869d51a Turns out the machine/asm.h isn't needed here, since SYS.h already
included it.
2008-04-16 05:08:27 +00:00
imp
09d99400d7 FreeBSD/mips libc support. Merged from perforce mips2-jnpr branch. 2008-04-16 05:06:11 +00:00
davidxu
6a349c6771 _vfork is not in libthr, remove the reference. 2008-04-16 03:19:11 +00:00
cperciva
4ee0999e20 Fix one-byte buffer overflow: NUL gets written to the buffer, but isn't
counted in the width specification in scanf.

This is not a security problem, since this function is only used to
parse a user's configuration file.

Submitted by:	Joerg Sonnenberger
Obtained from:	dragonflybsd
MFC after:	1 week
2008-04-15 23:29:51 +00:00
davidxu
a19eeb1bb9 Implement POSIX function tcgetsid() which returns session id.
PR: stand/107561
2008-04-15 08:33:32 +00:00
davidxu
a1371575f4 don't include pthread_np.h, it is not used. 2008-04-14 08:08:40 +00:00
delphij
b612c0d58d Use calloc() instaed of zeroing memory ourselves. 2008-04-13 08:05:08 +00:00
das
e7c98f4fd1 Unbreak the build for arm and powerpc.
Pointy hat to yours truly.
2008-04-12 14:53:52 +00:00
das
61773c1dea Updates for changes in the way printf() handles hex floating point
numbers.
2008-04-12 03:11:56 +00:00
das
244a0bcf48 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
das
23ad2eb9b8 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
das
cb01b0e6f4 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
delphij
b65786c8a8 Add memrchr(3).
Obtained from:	OpenBSD
2008-04-10 00:12:44 +00:00
deischen
bdfc7667fc 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
dfr
a38ef19667 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
dfr
fd80ed9056 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
imp
cc89dca5ca Minor style(9) nit: move to using ANSI definition of functions. 2008-04-03 20:36:44 +00:00
ru
c60a524cb1 Fix descriptions of "struct msqid_ds and "struct ipc_perm" to match
harsh reality.
2008-04-03 16:21:43 +00:00
das
6a8cdf6fed 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
davidxu
8d9f007088 put THR_CRITICAL_LEAVE into do .. while statement. 2008-04-03 02:47:35 +00:00
kevlo
762f60a112 style(9) cleanup 2008-04-03 02:41:54 +00:00
davidxu
2d5bf7e6fc add __hidden suffix to _umtx_op_err, this eliminates PLT. 2008-04-03 02:13:51 +00:00
davidxu
f1df18eb48 Non-portable functions are in pthread_np.h, fix compiling problem. 2008-04-02 11:41:12 +00:00
davidxu
d00a98a4e8 Add pthread_setaffinity_np and pthread_getaffinity_np to libc namespace. 2008-04-02 08:53:18 +00:00
davidxu
aa2019ec00 Remove unused functions. 2008-04-02 08:33:42 +00:00
davidxu
570834290d 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
davidxu
8d50c29c72 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
davidxu
09e95ab21c 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
davidxu
111802a962 Restore normal pthread_cond_signal path to avoid some obscure races. 2008-04-01 06:23:08 +00:00
davidxu
664ef9f365 return EAGAIN early rather than running bunch of code later, micro optimize
static branch prediction.
2008-04-01 00:21:49 +00:00
das
017bbc352e Remove a (bogus) remnant of debugging this on sparc64. 2008-03-31 13:11:45 +00:00
kib
2ad0eb2d91 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
kientzle
bd1adacdf1 Include an extra byte for the trailing NUL. <sigh>
Pointy hat: Me
2008-03-31 06:24:39 +00:00
davidxu
220584ad61 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
das
39170f049a Add assembly versions of remquol() and remainderl(). 2008-03-30 21:21:53 +00:00
das
f487ba5286 Hook remquol() and remainderl() up to the build. 2008-03-30 20:48:02 +00:00
das
b4b933cd52 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
das
8bd589e900 Implement remquol() based on remquo(). 2008-03-30 20:47:26 +00:00
das
7e1a7394d9 Implement csqrtl(). 2008-03-30 20:07:15 +00:00
das
4e563b6d98 Hook hypotl() and cabsl() up to the build. 2008-03-30 20:03:46 +00:00
das
fed973ef18 Document hypotl().
Submitted by:	Steve Kargl <sgk@troutmask.apl.washington.edu>
2008-03-30 20:03:29 +00:00
das
ca69e4f334 Alias hypotl() and cabsl() for platforms where long double is the same
as double.
2008-03-30 20:03:06 +00:00
das
b48d845e62 Implement cabsl() in terms of hypotl().
Submitted by:	Steve Kargl <sgk@troutmask.apl.washington.edu>
2008-03-30 20:02:03 +00:00
das
927d9b1d58 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
bde
2916ad3e28 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
bde
b06e3a074e 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
bde
95436ce20d 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
dfr
256e041f3b 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
dfr
6eacca7a06 Don't assume that there is readable data on the stream after the
fragment header.
2008-03-30 09:35:04 +00:00
ru
0f0375e36a 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
das
ff9d959b80 Include math.h for the fmaf() prototype. 2008-03-29 16:38:29 +00:00
das
a1fc7d5578 Fix some rather obscene code that has ambiguous if...if...else...
constructs in it.
2008-03-29 16:37:59 +00:00
das
ede66e5daf 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
bcb0495c0e - 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
7ab14d8a96 - 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
ps
41d5b26ff8 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
ru
dd08a4dd1f Removed no longer existing CTL_MACHDEP defines.
Inspired by:	phk
2008-03-26 23:02:17 +00:00
dfr
79d2dfdaa6 Add the new kernel-mode NFS Lock Manager. To use it instead of the
user-mode lock manager, build a kernel with the NFSLOCKD option and
add '-k' to 'rpc_lockd_flags' in rc.conf.

Highlights include:

* Thread-safe kernel RPC client - many threads can use the same RPC
  client handle safely with replies being de-multiplexed at the socket
  upcall (typically driven directly by the NIC interrupt) and handed
  off to whichever thread matches the reply. For UDP sockets, many RPC
  clients can share the same socket. This allows the use of a single
  privileged UDP port number to talk to an arbitrary number of remote
  hosts.

* Single-threaded kernel RPC server. Adding support for multi-threaded
  server would be relatively straightforward and would follow
  approximately the Solaris KPI. A single thread should be sufficient
  for the NLM since it should rarely block in normal operation.

* Kernel mode NLM server supporting cancel requests and granted
  callbacks. I've tested the NLM server reasonably extensively - it
  passes both my own tests and the NFS Connectathon locking tests
  running on Solaris, Mac OS X and Ubuntu Linux.

* Userland NLM client supported. While the NLM server doesn't have
  support for the local NFS client's locking needs, it does have to
  field async replies and granted callbacks from remote NLMs that the
  local client has contacted. We relay these replies to the userland
  rpc.lockd over a local domain RPC socket.

* Robust deadlock detection for the local lock manager. In particular
  it will detect deadlocks caused by a lock request that covers more
  than one blocking request. As required by the NLM protocol, all
  deadlock detection happens synchronously - a user is guaranteed that
  if a lock request isn't rejected immediately, the lock will
  eventually be granted. The old system allowed for a 'deferred
  deadlock' condition where a blocked lock request could wake up and
  find that some other deadlock-causing lock owner had beaten them to
  the lock.

* Since both local and remote locks are managed by the same kernel
  locking code, local and remote processes can safely use file locks
  for mutual exclusion. Local processes have no fairness advantage
  compared to remote processes when contending to lock a region that
  has just been unlocked - the local lock manager enforces a strict
  first-come first-served model for both local and remote lockers.

Sponsored by:	Isilon Systems
PR:		95247 107555 115524 116679
MFC after:	2 weeks
2008-03-26 15:23:12 +00:00
brueffer
b64d211df2 Fix some "in in" typos in comments.
PR:		121490
Submitted by:	Anatoly Borodin <anatoly.borodin@gmail.com>
Approved by:	rwatson (mentor), jkoshy
MFC after:	3 days
2008-03-26 07:32:08 +00:00
ru
5398c833ef Compile libthr with warnings.
(Somehow this file sneaked from initial commit.)
2008-03-25 15:33:00 +00:00
ru
e8df07e5aa Compile libthr with warnings. 2008-03-25 13:28:12 +00:00
ru
e2f2131976 Fixed mis-implementation of pthread_mutex_get{spin,yield}loops_np().
Reviewed by:	davidxu
2008-03-25 09:48:10 +00:00
jeff
e1e2efa7be - Restore kse.h in this directory so other tools don't find it by mistake.
- Restore the ability to debug kse coredumps in 8.0.

Suggested by:	marcel
2008-03-23 09:38:11 +00:00
davidxu
1423f22a4c Add POSIX pthread API pthread_getcpuclockid() to get a thread's cpu
time clock id.
2008-03-22 09:59:20 +00:00
davidxu
3367c267b3 Use linker set to collection all target operations. 2008-03-22 05:40:44 +00:00
kaiw
2030a16c64 Add MLINK for archive_write_close.
Approved by:	jkoshy(mentor), kientzle
2008-03-21 11:10:20 +00:00
davidxu
8420f5505a Resolve __error()'s PLT early so that it needs not to be resolved again,
otherwise rwlock is recursivly called when signal happens and the __error
was never resolved before.
2008-03-21 02:31:55 +00:00
ru
735c62ce43 pthread_mutexattr_destroy() was accidentally broken in last revision,
unbreak it.  We should really start compiling this with warnings.
2008-03-20 11:47:08 +00:00
des
0b6cf6e8e4 s/wait/delta/ to avoid namespace collision.
MFC after:	2 weeks
2008-03-20 09:55:27 +00:00
davidxu
8326c06222 Preserve application code's errno in rtld locking code, it attemps to keep
any case safe.
2008-03-20 09:35:44 +00:00
davidxu
1bc96ca9dc Make pthread_mutexattr_settype to return error number directly and
conformant to POSIX specification.

Bug reported by: modelnine at modelnine dt org
2008-03-20 08:27:14 +00:00
davidxu
5e11ba1ac4 don't reduce new thread's refcount if current thread can not set cpuset
for it, since the new thread will reduce it by itself.
2008-03-19 09:33:07 +00:00
davidxu
a6c50de140 - Trim trailing spaces.
- Use a different sigmask variable name to avoid confusing.
2008-03-19 08:13:04 +00:00
davidxu
e846a1612b if passed thread pointer is equal to current thread, pass -1 to kernel
to speed up searching.
2008-03-19 06:38:21 +00:00
jkoshy
f8600f40e7 Ensure that the section header table is written out in an order
consistent with the section indices returned to the application by
elf_ndxscn().

Submitted by:		kaiw
2008-03-19 06:06:34 +00:00
jkoshy
af7049a2cd Clarify that the ELF library only sets the sh_entsize field of a
section header entry if the application is not taking charge of ELF
object layout.

Update (c) years, and bump the manual page's date.

Submitted by:		kaiw
2008-03-19 05:07:49 +00:00
emax
7704e14e90 Add mandatory "security description" SDP parameter to the PANU profile
Pointed-out by:	Iain Hibbert < plunky at rya-online dot net >
MFC after:	3 days
2008-03-19 00:06:30 +00:00
emax
a55b468d9c Add PSM and Load Factor SDP parameters to the BNEP based profiles
(NAP, GN and PANU). No reason to not to support them.

Separate SDP parameters data structures for the BNEP based profiles.

Generalize Service Availability SDP parameter creation.

Requested by:	Iain Hibbert < plunky at rya-online dot net >
MFC after:	3 days
2008-03-18 18:21:39 +00:00
davidxu
9dbfb036ab - Copy signal mask out before THR_UNLOCK(), because THR_UNLOCK() may call
_thr_suspend_check() which messes sigmask saved in thread structure.
- Don't suspend a thread has force_exit set.
- In pthread_exit(), if there is a suspension flag set, wake up waiting-
  thread after setting PS_DEAD, this causes waiting-thread to break loop
  in suspend_common().
2008-03-18 02:06:51 +00:00
antoine
73a86dc575 Don't allocate the constant array "props" on the stack in wctype.
PR:		74743
Submitted by:	knut st. osmundsen
Approved by:	rwatson (mentor)
MFC after:	1 month
2008-03-17 18:22:23 +00:00
das
6f407f2920 scandir(3) previously used st_size to obtain an initial estimate
of the array length needed to store all the directory entries.
Although BSD has historically guaranteed that st_size is the size
of the directory file, POSIX does not, and more to the point, some
recent filesystems such as ZFS use st_size to mean something else.

The fix is to not stat the directory at all, set the initial
array size to 32 entries, and realloc it in powers of 2 if that
proves insufficient.

PR:	113668
2008-03-16 19:08:53 +00:00
davidxu
3da38e35b4 Actually delete SIGCANCEL mask for suspended thread, so the signal will not
be masked when it is resumed.
2008-03-16 03:22:38 +00:00
kientzle
b9046423ec Update a comment: the format bid only runs once per archive; it no
longer runs once per entry.
2008-03-15 11:09:16 +00:00
kientzle
c37b281ebc Free up the entry objects allocated during this test. 2008-03-15 11:06:15 +00:00
kientzle
ee09b4a896 Release the buffers used for exercising the compress code. 2008-03-15 11:05:49 +00:00
kientzle
c7c16fc8e2 Remove the duplicate "archive_format" and "archive_format_name" fields
from the private archive_write structure and fix up all writers to use
the format fields in the base "archive" structure.  This error made it
impossible to query the format after setting up a writer because the
write format was stored in an inaccessible place.
2008-03-15 11:04:45 +00:00
kientzle
7ff9ac24d8 Correct a sign mismatch that only showed up on 64-bit systems.
Pointy hat: me
2008-03-15 11:02:47 +00:00
kientzle
3f30727604 Refactor the mtree code a bit to make the layering clearer: Each
"file" is described by multiple "lines" each possibly containing
multiple "keywords."  Incorporate some additions from Joerg Sonnenberger
to handle linked files and correctly deal with backing files on disk.
2008-03-15 07:10:24 +00:00
kientzle
1e4445bea8 FreeBSD does have fstat().
Correct the nasty typo this uncovers.
2008-03-15 04:20:50 +00:00
kientzle
74f604455f Testability is more important than standards conformance.
Disable the use of PaxHeader.<pid> for the fake pax extension pathname
until I can make the name here settable.  Otherwise, tests that try
to compare output to static pre-generated reference files break.
2008-03-15 03:49:18 +00:00
kientzle
4c7ea30e33 Ignore a few more common files. 2008-03-15 02:31:28 +00:00
kientzle
f863f57f14 Resolve a minor nit in SUS compliance by including the PID in the
fake directory name used for pax extended headers.
2008-03-15 02:30:42 +00:00
kientzle
c6463b768d GC a reference to the defunct TESTFILES variable. 2008-03-15 02:22:08 +00:00
kientzle
4f3f5f46dd A subtle point: "pax interchange format" mandates that all strings
(including pathname, gname, uname) be stored in UTF-8.  This usually
doesn't cause problems on FreeBSD because the "C" locale on FreeBSD
can convert any byte to Unicode/wchar_t and from there to UTF-8.  In
other locales (including the "C" locale on Linux which is really
ASCII), you can get into trouble with pathnames that cannot be
converted to UTF-8.

Libarchive's pax writer truncated pathnames and other strings at the
first nonconvertible character.  (ouch!)  Other archivers have worked
around this by storing unconvertible pathnames as raw binary, a
practice which has been sanctioned by the Austin group.  However,
libarchive's pax reader would segfault reading headers that weren't
proper UTF-8.  (ouch!)  Since bsdtar defaults to pax format, this
affects bsdtar rather heavily.

To correctly support the new "hdrcharset" header that is going into
SUS and to handle conversion failures in general, libarchive's pax reader
and writer have been overhauled fairly extensively.  They used to do
most of the pax header processing using wchar_t (Unicode); they now do
most of it using char so that common logic applies to either UTF-8 or
"binary" strings.

As a bonus, a number of extraneous conversions to/from wchar_t have
been eliminated, which should speed things up just a tad.

Thanks to: Bjoern Jacke for originally reporting this to me
Thanks to: Joerg Sonnenberger for noting a bad typo in my first draft of this
Thanks to: Gunnar Ritter for getting the standard fixed
MFC after: 5 days
2008-03-15 01:43:59 +00:00
kientzle
2e83d280ed Ignore some built files. 2008-03-15 00:52:22 +00:00
kientzle
f5ba8800a4 Don't lie. If a string can't be converted to a wide (Unicode) string,
return a NULL instead of an incomplete string.  Expand the test coverage
to verify the correct behavior here.
2008-03-14 23:19:46 +00:00
kientzle
794d55fb64 Don't advertise the default block size as a constant; don't
rely on a deprecated value to set the default.  This is also
related to a longer-term goal of setting the default block
size based on format and possibly other factors, which makes
it a bad idea to tie this to a published constant.
2008-03-14 23:09:02 +00:00
kientzle
f9f0592c21 New public functions archive_entry_copy_link() and archive_entry_copy_link_w()
override the currently set link value, whether that's a hardlink
or a symlink.  Plus documentation update and tests.
2008-03-14 23:00:53 +00:00