Commit Graph

6344 Commits

Author SHA1 Message Date
Marius Strobl
b7e9bee71c While SPARC V9 allows tininess to be detected either before or after
rounding (impl. dep. #55), the SPARC JPS1 responsible for SPARC64 and
UltraSPARC processors defines that in all cases  tininess is detected
before rounding therefore rounding up to the smallest normalized number
should set the underflow flag. This change is needed for using SoftFloat
on sparc64 for reference purposes.

PR:		144900
Submitted by:	Peter Jeremy
2010-04-11 20:08:54 +00:00
Hajimu UMEMOTO
79bbdc60dc Use the stored length value instead of calculating it by strlen(). 2010-04-06 12:33:05 +00:00
David E. O'Brien
6a18a77221 I feel this wording of the history is more clear.
ANSIfy vasprintf() while I'm here.
2010-04-05 22:09:29 +00:00
Andriy Gapon
f3c733e82b libc/db/hash: cap auto-tuned block size with a value that actually works
This fix mostly matters after r206129 that made it possible for
st_blksize to be greater than 4K.  For this reason, this change should
be MFC-ed before r206129.
Also, it seems that all FreeBSD uitlities that use db(3) hash databases
and create new databases in files, specify their own block size value
and thus do not depend on block size autotuning.

PR:		bin/144446
Submitted by:	Peter Jeremy <peterjeremy@acm.org>
MFC after:	5 days
2010-04-05 10:12:21 +00:00
Andriy Gapon
983419fe1e hash.3: fix a factual mistake in the man page
PR:		bin/144446
Submitted by:	Peter Jeremy <peterjeremy@acm.org>
MFC after:	3 days
2010-04-05 10:01:53 +00:00
Hajimu UMEMOTO
e622b47989 Add capability to use a db version of services. It is enabled by
specifying `db' as source of service in /etc/nsswitch.conf.

MFC after:	2 weeks
2010-04-04 08:31:03 +00:00
Hajimu UMEMOTO
dc6ab8ddb4 Reduce duplicate code.
MFC after:	2 weeks
2010-04-04 07:31:10 +00:00
Hajimu UMEMOTO
aea86367e8 Treat '+' as special only when in compat mode, and simplify
the logic bit.

MFC after:	2 weeks
2010-04-04 07:21:45 +00:00
Hajimu UMEMOTO
8390eaedcc Stop adding trailing '\n'. The servent_unpack() doesn't expect
lines terminated with '\n'.

MFC after:	2 weeks
2010-04-04 07:02:10 +00:00
Xin LI
64c12e81e2 Add prototype for libc internal interfaces. 2010-03-31 18:37:00 +00:00
Xin LI
9fd9d097aa Add prototypes for libc private interfaces.
While I'm there, apply __unused whenever appropriate.

Reviewed by:	md5(1)
2010-03-31 18:36:04 +00:00
Edward Tomasz Napierala
48463a6747 Make acl_to_text_np(3) not crash on long group or user names in NFSv4 ACLs.
PR:		amd64/145091
MFC after:	2 weeks
2010-03-28 17:29:15 +00:00
Ed Schouten
435d267423 Don't forget to bump the date in the man page. 2010-03-28 13:40:13 +00:00
Ed Schouten
510ea843ba Rename st_*timespec fields to st_*tim for POSIX 2008 compliance.
A nice thing about POSIX 2008 is that it finally standardizes a way to
obtain file access/modification/change times in sub-second precision,
namely using struct timespec, which we already have for a very long
time. Unfortunately POSIX uses different names.

This commit adds compatibility macros, so existing code should still
build properly. Also change all source code in the kernel to work
without any of the compatibility macros. This makes it all a less
ambiguous.

I am also renaming st_birthtime to st_birthtim, even though it was a
local extension anyway. It seems Cygwin also has a st_birthtim.
2010-03-28 13:13:22 +00:00
Pietro Cerutti
071ab531db - Remove const'ness from dlerror(3) prototype, for consistency with POSIX.
Approved by:	cognet
MFC after:	1 week
2010-03-24 15:59:51 +00:00
John Baldwin
5711bf30da Reject attempts to create a MAP_ANON mapping with a non-zero offset.
PR:		kern/71258
Submitted by:	Alexander Best
MFC after:	2 weeks
2010-03-23 21:08:07 +00:00
Ed Schouten
070f2a9831 Let opendir() use O_DIRECTORY.
I am not removing the fstat() calls here, since we cannot yet assume
people will always run kernels that respect O_DIRECTORY.
2010-03-21 20:45:06 +00:00
Ed Schouten
0fef797f4a Actually make O_DIRECTORY work.
According to POSIX open() must return ENOTDIR when the path name does
not refer to a path name. Change vn_open() to respect this flag. This
also simplifies the Linuxolator a bit.
2010-03-21 20:43:23 +00:00
Marius Strobl
be05bc3ffb Avoid aliasing which leads to incorrect results when compiling with the
default strict aliasing rules.

PR:		144900
Submitted by:	Peter Jeremy
MFC after:	3 days
2010-03-21 13:18:08 +00:00
Marius Strobl
b28ad3ebc9 - While SPARC V9 allows tininess to be detected either before or after
rounding (impl. dep. #55), the SPARC JPS1 responsible for SPARC64 and
  UltraSPARC processors defines that in all cases tinyness is detected
  before rounding, therefore rounding up to the smallest normalised
  number should set the underflow flag.
- If an infinite result is rounded down, the result should have an
  exponent 1 less than the value for infinity.

PR:		144900
Submitted by:	Peter Jeremy
MFC after:	3 days
2010-03-20 22:32:13 +00:00
Marius Strobl
bd2ec8519e Division should take both arguments' signs into account when the
the dividend is infinity or zero and the divisor is not the same.

PR:		144900
Submitted by:	Peter Jeremy
MFC after:	3 days
2010-03-20 22:12:15 +00:00
Marius Strobl
484bacf4b9 FPU_DEBUG requires <stdio.h>.
PR:		144900
Submitted by:	Peter Jeremy
MFC after:	3 days
2010-03-20 21:27:44 +00:00
Marius Strobl
4dda9dfd81 Ensure that __fpu_ftox() both returns the high bits and res[1] contains
the low bits also in the default case.

PR:		144900
Obtained from:	OpenBSD
MFC after:	3 days
2010-03-20 21:15:56 +00:00
Marius Strobl
564b3fffdd - Remove a bogus forward declaration.
- Fix whitespace.
2010-03-20 21:04:47 +00:00
Poul-Henning Kamp
156a1661a6 Comment a fine point, so it does not get lost when people borrow code
from FreeBSD for other purposes.
2010-03-15 08:58:35 +00:00
Xin LI
87c88b2632 Correct bugs fixed but not merged from my own tree.
Pointy hat to:	delphij
MFC after:	1 month
2010-03-13 00:15:06 +00:00
Xin LI
51e48ff21b Follow up commit to reindent the code.
MFC after:	1 month
2010-03-12 21:15:35 +00:00
Xin LI
dabae22639 Two optimizations to MI strlen(3) inspired by David S. Miller's
blog posting [1].

 - Use word-sized test for unaligned pointer before working
   the hard way.

   Memory page boundary is always integral multiple of a word
   alignment boundary.  Therefore, if we can access memory
   referenced by pointer p, then (p & ~word mask) must be also
   accessible.

 - Better utilization of multi-issue processor's ability of
   concurrency.

   The previous implementation utilized a formular that must be
   executed sequentially.  However, the ~, & and - operations can
   actually be caculated at the same time when the operand were
   different and unrelated.

   The original Hacker's Delight formular also offered consistent
   performance regardless whether the input would contain
   characters with their highest-bit set, as it catches real
   nul characters only.

These two optimizations has shown further improvements over the
previous implementation on microbenchmarks on i386 and amd64 CPU
including Pentium 4, Core Duo 2 and i7.

[1] http://vger.kernel.org/~davem/cgi-bin/blog.cgi/2010/03/08#strlen_1

MFC after:	1 month
2010-03-12 21:14:56 +00:00
Ulrich Spörlein
63d46d1d5e Fix several typos in macros or macro misusage.
Found by:	make manlint
Reviewed by:	ru
Approved by:	philip (mentor)
2010-03-12 10:01:06 +00:00
John Baldwin
1b0181df2f - Use an initializer macro to initialize fields in 'fake' FILE objects used
by *sprintf(), etc.
- Explicitly initialize _fl_mutex to PTHREAD_MUTEX_INITIALIZER for all FILE
  objects.  This is currently a nop on FreeBSD, but is import for other
  platforms (or in the future) where PTHREAD_MUTEX_INITIALIZER is not simply
  zero.

PR:		threads/141198
Reported by:	Jeremy Huddleston @ Apple
MFC after:	2 weeks
2010-03-11 17:03:32 +00:00
John Baldwin
f458b72661 Fix a bug in the previous change: remove function-local definition of
tcp_key and udp_key that shadows the global definition.

PR:		threads/144558
Submitted by:	Sam Robb
2010-03-11 16:58:15 +00:00
Marius Strobl
7e0e1004f3 Fix a typo in r204974 so that FTYPE_LNG matches the initialisers of
the opmask array.

Pointed out by:	Peter Jeremy
2010-03-11 07:46:17 +00:00
Marius Strobl
ff2f66ea79 - The OPSZ macro actually only does the right thing for int32 and int64
operands but not for double and extended double ones. Instead of trying
  to fix the macro just nuke it and unroll the loops in the correct way
  though as extended double operands turn out to be the only special case.
- For FxTO{s,d,q} the source operand is int64 so rs2 has to be re-decoded
  after setting type accordingly as it's generally decoded using the low
  2 bits as the type, which are 0 for these three instructions.
- Similarly, in case of F{s,d,q}TOx the target is int64 so rd has to be
  re-decoded using not only the operand mask appropriate for int64 but
  also the correct register number encoding.
- Use const where appropriate.
- Wrap long lines.

Submitted by:	Peter Jeremy (partly)
MFC after:	3 days
2010-03-10 19:55:48 +00:00
John Baldwin
6f88d2a870 Use thr_once() with once_t controls to initialize various thread_key_t
objects used to provide per-thread storage in the RPC code.  Almost all
of these used double-checking with a dedicated mutex (tsd_lock) to do this
before.  However, that is not always safe with more relaxed memory orders.
There were also other bugs, such as one in __rpc_createrr() that caused a
new key to be allocated each time __rpc_createrr() was invoked.

PR:		threads/144558
Reported by:	Sam Robb  samrobb of averesystems com (key leak)
MFC after:	1 week
2010-03-10 13:23:25 +00:00
Joel Dahl
a303eae7c8 Switch to our preferred license text.
Approved by:	jedgar
2010-03-07 07:59:05 +00:00
Joel Dahl
a4481a8745 Use our standard license text. No more voices in the authors head. :-)
Approved by:	trasz
2010-03-04 19:38:24 +00:00
Joel Dahl
2598954edc The NetBSD Foundation has granted permission to remove clause 3 and 4 from
their software.

Obtained from:	NetBSD
2010-03-03 17:07:02 +00:00
Jaakko Heinonen
967e82cae0 In reallocf(3), free the memory only when size != 0. Otherwise, when the
System V compatibility option (malloc "V" flag) is in effect a zero sized
reallocf() could cause a double free.

PR:		bin/141753
Submitted by:	Dan Lukes
2010-03-03 15:43:26 +00:00
Joel Dahl
d940309d80 The NetBSD Foundation has granted permission to remove clause 3 and 4 from
their software.

Obtained from:	NetBSD
2010-03-02 22:16:40 +00:00
Joel Dahl
edb8858bd1 The NetBSD Foundation has granted permission to remove clause 3 and 4 from
their software.

Obtained from:	NetBSD
2010-03-02 22:11:14 +00:00
Joel Dahl
e1c6ef6aa4 The NetBSD Foundation has granted permission to remove clause 3 and 4 from
their software.

Obtained from:	NetBSD
2010-03-02 17:20:04 +00:00
Jason Evans
15f8d49756 Rewrite red-black trees to do lazy balance fixup. This improves
insert/remove speed by ~30%.
2010-02-28 22:57:13 +00:00
Jaakko Heinonen
6ca7812a19 In _gettemp(), check that the length of the path doesn't exceed
MAXPATHLEN. Otherwise the path name (or part of it) may not fit to
carrybuf causing a buffer overflow.

PR:		bin/140228
Suggested by:	jilles
2010-02-28 13:31:29 +00:00
Edwin Groothuis
dcfeda6122 Split the contributed code from libc/stdtime from lib/libc/stdtime
to contrib/tzcode/stdtime.
2010-02-26 06:44:00 +00:00
Konstantin Belousov
4d44fc9c59 Make pause(3) implementation not depended on the legacy sigcompat.c
interfaces. Do not block rt signals during and after pause(3) calls.
Use private libc namespace to call proper methods.

MFC after:	1 week
2010-02-25 13:51:11 +00:00
Ed Schouten
3878829eeb While there, trim some trailing whitespace. 2010-02-21 14:58:01 +00:00
Ed Schouten
62399df2c9 Add proper const keywords to sysctl(3) parameters.
The `name' and `newp' arguments can be marked const, because the buffers
they refer to are never changed. While there, perform some other
cleanups:

- Remove K&R from sysctl.c.
- Implement sysctlbyname() using sysctlnametomib() to prevent
  duplication of an undocumented kernel interface.
- Fix some whitespace nits.

It seems the prototypes are now in sync with NetBSD as well.
2010-02-21 13:57:02 +00:00
Gabor Kovesdan
29c271590e - More style(9) fixups
Approved by:	delphij (mentor)
2010-02-20 08:19:19 +00:00
Poul-Henning Kamp
82c59e57f3 Mention EISDIR as a possible errno. 2010-02-17 09:11:21 +00:00
Marcel Moolenaar
a6c79196a7 Define TLS_MODEL for PowerPC as well. Since PowerPC uses variant I,
like ia64, leave it empty (default model).
2010-02-16 20:46:22 +00:00