Commit Graph

11745 Commits

Author SHA1 Message Date
imp
9623d72c05 Add mips support to libm, from mips2-jnpr perforce branch. 2008-04-26 12:20:29 +00:00
imp
92f18b23d5 Bring in mips threads support from perforce mips2-jnpr branch. 2008-04-26 12:17:57 +00:00
imp
87785b8e3a Add mips support libc from the mips2-jnpr branch of perforce. 2008-04-26 12:08:02 +00:00
scf
23f167db94 Have the man page catch up with the namespace pollution cleanup that
occurred between 2001-2003.  Thanks to bde for the history lesson[1]
concerning sys/types.h and the many system calls that at one time
(pre-2001) were required by POSIX to include it.

1. http://lists.freebsd.org/pipermail/freebsd-arch/2008-April/008126.html

MFC after:	3 days
2008-04-26 02:33:53 +00:00
ru
c17c108c2a Stricter check for integer overflow. 2008-04-24 07:49:00 +00:00
marcel
38f942a4e1 Add support for gpart:
o  Correct for gpart's 1-based index, versus 0-based index used by
   legacy slicers.
o  Parse and understand the xs and xt parameters.
2008-04-24 00:11:15 +00:00
delphij
6b7d752076 Avoid various shadowed variables. libthr is now almost WARNS=4 clean except
for some const dequalifiers that needs more careful investigation.

Ok'ed by:	davidxu
2008-04-23 21:06:51 +00:00
jasone
14c9906df5 Implement red-black trees without using parent pointers, and store the
color bit in the least significant bit of the right child pointer, in
order to reduce red-black tree linkage overhead by ~2X as compared to
sys/tree.h.

Use the new red-black tree implementation in malloc, which drops
memory usage by ~0.5 or ~1%, for 32- and 64-bit systems, respectively.
2008-04-23 16:09:18 +00:00
marcel
ed972f84a3 Correct an off-by-1 for GPART. The literal partition type (i.e.
the actual UUID) is prefixed by '!' to distinguish them from
well-known aliases.

MFC after: 3 days
2008-04-23 03:00:26 +00:00
scf
cab3742f10 Add four utility functions related to struct grp processing modeled in-part
after similar calls related to struct pwd in libutil/pw_util.c:
  - gr_equal()
    Perform a deep comparison of two struct grp's.  It does a thorough, yet
    unoptimized comparison of all the members regardless of order.

  - gr_make()
    Create a string (see group(5)) from a struct grp.

  - gr_dup()
    Duplicate a struct grp.  Returns a value that is a single contiguous
    block of memory.

  - gr_scan()
    Create a struct grp from a string (as produced by gr_make()).

MFC after:	3 weeks
2008-04-23 00:49:13 +00:00
jhb
a3eb935764 Fix a leak in the recent fixes for file descriptors > SHRT_MAX. In the
case of a file descriptor we can't handle, clear the FILE structure's flags
so it can be reused.

MFC after:	1 week
Reported by:	otto @ OpenBSD
2008-04-22 17:03:32 +00:00
davidxu
b794176bc5 Use native rwlock. 2008-04-22 06:44:11 +00:00
antoine
8d9408ec26 Document that you must include <sys/param.h> before <sys/cpuset.h>.
Approved by:	rwatson (mentor)
2008-04-20 15:51:56 +00:00
ru
27e53e835a Don't forget to free() currency_symbol and asciivalue when multiple
conversion specifiers for them are present.

Submitted by:	Maxim Dounin <mdounin@mdounin.ru>
Obtained from:	NetBSD (partially)
MFC after:	3 days
2008-04-19 07:22:58 +00:00
ru
b15775c48a Better strfmon(3) conversion specifiers sanity checking.
There were no checks for left and right precisions at all, and
a check for field width had integer overflow bug.

Reported by:	Maksymilian Arciemowicz
Security:	http://securityreason.com/achievement_securityalert/53
Submitted by:	Maxim Dounin <mdounin@mdounin.ru>
MFC after:	3 days
2008-04-19 07:18:22 +00:00
jhb
ab875ea726 Next stage of stdio cleanup: Retire __sFILEX and merge the fields back into
__sFILE.  This was supposed to be done in 6.0.  Some notes:
- Where possible I restored the various lines to their pre-__sFILEX state.
- Retire INITEXTRA() and just initialize the wchar bits (orientation and
  mbstate) explicitly instead.  The various places that used INITEXTRA
  didn't need the locking fields or _up initialized.  (Some places needed
  _up to exist and not be off the end of a NULL or garbage pointer, but
  they didn't require it to be initialized to a specific value.)
- For now, stdio.h "knows" that pthread_t is a 'struct pthread *' to
  avoid namespace pollution of including all the pthread types in stdio.h.
  Once we remove all the inlines and make __sFILE private it can go back
  to using pthread_t, etc.
- This does not remove any of the inlines currently and does not change
  any of the public ABI of 'FILE'.

MFC after:	1 month
Reviewed by:	peter
2008-04-17 22:17:54 +00:00
delphij
6de397fa88 Implement fdopendir(3) by splitting __opendir2() into two parts, the upper part
deals with the usual __opendir2() calls, and the rest part with an interface
translator to expose fdopendir(3) functionality.  Manual page was obtained from
kib@'s work for *at(2) system calls.
2008-04-16 18:59:36 +00:00
delphij
71f117505a Style fixes to opendir.c:
- Use /*- for copyright block;
 - ANSIfy.
2008-04-16 18:40:52 +00:00
ru
994093cd25 Sort MAN and MLINKS. 2008-04-16 14:57:40 +00:00
ru
59a8ac0c77 Connect newly added manpages to the build.
Submitted by:	kib
2008-04-16 14:44:43 +00:00
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