Commit Graph

10074 Commits

Author SHA1 Message Date
Joseph Koshy
9dc2f0df89 Document the fact that sendfile(2) can EOPNOTSUPP if the underlying
filesystem for the file being transferred doesn't support UIO_NOCOPY.

Reported by:	Niki Denev <nike_d@cytexbg.com>
2005-10-31 04:08:28 +00:00
Joseph Koshy
012546dd27 Sort error list. 2005-10-31 04:00:20 +00:00
David Xu
7a81302ce7 Add thread exit handler in timer_loop to handle broken buggy code which
could lead to memory leak.
2005-10-30 23:59:01 +00:00
Bruce Evans
053d1689b1 Fixed spelling of remquof() in its prototype. 2005-10-30 12:34:58 +00:00
Bruce Evans
f964c6ecfb Fixed some comments added in rev.1.5.
The log message for 1.5 said that some small (one or two ulp) inaccuracies
were fixed, and a comment implied that the critical change is to switch
the rounding mode to to-nearest, with a switch of the precision to
extended at no extra cost.  Actually, the errors are very large (ucbtest
finds ones of several hundred ulps), and it is the switch of the
precision that is critical.

Another comment was wrong about NaNs being handled sloppily.
2005-10-30 12:21:02 +00:00
David Xu
4a050d016e Add timer_create wrapper. 2005-10-30 03:16:30 +00:00
Bruce Evans
19b114da0e Implement inline functions to give the complex result x+I*y from float
or double args x and y.  x+I*y cannot be used directly yet due to compiler
bugs.

Submitted by:	Steve Kargl <sgk@troutmask.apl.washington.edu>
2005-10-29 17:14:11 +00:00
Bruce Evans
8b438ea8dd Use double precision to simplify and optimize arg reduction for small
and medium size args too: instead of conditionally subtracting a float
17+24, 17+17+24 or 17+17+17+24 bit approximation to pi/2, always
subtract a double 33+53 bit one.  The float version is now closer to
the double version than to old versions of itself -- it uses the same
33+53 bit approximation as the simplest cases in the double version,
and where the float version had to switch to the slow general case at
|x| == 2^7*pi/2, it now switches at |x| == 2^19*pi/2 the same as the
double version.

This speeds up arg reduction by a factor of 2 for |x| between 3*pi/4 and
2^7*pi/4, and by a factor of 7 for |x| between 2^7*pi/4 and 2^19*pi/4.
2005-10-29 16:34:50 +00:00
David Xu
c09df63bb9 Remove unused variable.
Reviewed by: cognet
2005-10-29 13:40:31 +00:00
Bruce Evans
21b0341c80 Start trying to make the float precision trig functions actually worth
using under FreeBSD.  Before this commit, all float precision functions
except exp2f() were implemented using only float precision, apparently
because Cygnus needed this in 1993 for embedded systems with slow or
inefficient double precision.  For FreeBSD, except possibly on systems
that do floating point entirely in software (very old i386 and now
arm), this just gives a more complicated implementation, many bugs,
and usually worse performance for float precision than for double
precision.  The bugs and worse performance were particulary large in
arg reduction for trig functions.  We want to divide by an approximation
to pi/2 which has as many as 1584 bits, so we should use the widest
type that is efficient and/or easy to use, i.e., double.  Use fdlibm's
__kernel_rem_pio2() to do this as Sun apparently intended.  Cygnus's
k_rem_pio2f.c is now unused.  e_rem_pio2f.c still needs to be separate
from e_rem_pio2.c so that it can be optimized for float args.  Similarly
for long double precision.

This speeds up cosf(x) on large args by a factor of about 2.  Correct
arg reduction on large args is still inherently very slow, so hopefully
these args rarely occur in practice.  There is much more efficiency
to be gained by using double precision to speed up arg reduction on
medium and small float args.
2005-10-29 08:15:29 +00:00
David Xu
babdcc8d78 Kill unused variable declaration. 2005-10-29 03:08:43 +00:00
Bruce Evans
11dc241777 Use fairly optimal minimax polynomials for __kernel_cosf() and
__kernel_sinf().  The old ones were the double-precision polynomials
with coefficients truncated to float.  Truncation is not a good way
to convert minimax polynomials to lower precision.  Optimize for
efficiency and use the lowest-degree polynomials that give a relative
error of less than 1 ulp -- degree 8 instead of 14 for cosf and degree
9 instead of 13 for sinf.  For sinf, the degree 8 polynomial happens
to be 6 times more accurate than the old degree 14 one, but this only
gives a tiny amount of extra accuracy in results -- we just need to
use a a degree high enough to give a polynomial whose relative accuracy
in infinite precision (but with float coefficients) is a small fraction
of a float ulp (fdlibm generally uses 1/32 for the small fraction, and
the fraction for our degree 8 polynomial is about 1/600).

The maximum relative errors for cosf() and sinf() are now 0.7719 ulps
and 0.7969 ulps, respectively.
2005-10-28 13:36:58 +00:00
David Xu
55ac4c3523 Link libthr to libpthread on Alpha and Sparc. 2005-10-27 10:21:23 +00:00
David Xu
38478fab7c Disconnect libc_r from buildworld, it is still kept in the tree to
provide some baseline references, but users are encouraged to use
libpthread or libthr in real world.

Discussed on: arch@
2005-10-27 03:09:20 +00:00
Bruce Evans
3b46e988e7 Use a better algorithm for reducing the error in __kernel_cos[f]().
This supersedes the fix for the old algorithm in rev.1.8 of k_cosf.c.

I want this change mainly because it is an optimization.  It helps
make software cos[f](x) and sin[f](x) faster than the i387 hardware
versions for small x.  It is also a simplification, and reduces the
maximum relative error for cosf() and sinf() on machines like amd64
from about 0.87 ulps to about 0.80 ulps.  It was validated for cosf()
and sinf() by exhaustive testing.  Exhaustive testing is not possible
for cos() and sin(), but ucbtest reports a similar reduction for the
worst case found by non-exhaustive testing.  ucbtest's non-exhaustive
testing seems to be good enough to find problems in algorithms but not
maximum relative errors when there are spikes.  E.g., short runs of
it find only 3 ulp error where the i387 hardware cos() has an error
of about 2**40 ulps near pi/2.
2005-10-26 12:36:18 +00:00
David Xu
07b6889426 Add experiment code to implement POSIX timer's SIGEV_THREAD notification. 2005-10-26 11:08:32 +00:00
David Xu
d7f119abd5 Follow the change in kernel, joiner thread just waits at thread id
address, let kernel wake it up.
2005-10-26 07:11:43 +00:00
Ruslan Ermilov
41fa1ea96a Recognize all current standard node types. 2005-10-25 20:58:30 +00:00
Bruce Evans
a92cb60b4e More fixes for arg reduction near pi/2 on systems with broken assignment
to floats (mainly i386's).  All errors of more than 1 ulp for float
precision trig functions were supposed to have been fixed; however,
compiling with gcc -O2 uncovered 18250 more such errors for cosf(),
with a maximum error of 1.409 ulps.

Use essentially the same fix as in rev.1.8 of k_rem_pio2f.c (access a
non-volatile variable as a volatile).  Here the -O1 case apparently
worked because the variable is in a 2-element array and it takes -O2
to mess up such a variable by putting it in a register.

The maximum error for cosf() on i386 with gcc -O2 is now 0.5467 (it
is still 0.5650 with gcc -O1).  This shows that -O2 still causes some
extra precision, but the extra precision is now good.

Extra precision is harmful mainly for implementing extra precision in
software.  We want to represent x+y as w+r where both "+" operations
are in infinite precision and r is tiny compared with w.  There is a
standard algorithm for this (Knuth (1981) 4.2.2 Theorem C), and fdlibm
uses this routinely, but the algorithm requires w and r to have the
same precision as x and y.  w is just x+y (calculated in the same
finite precision as x and y), and r is a tiny correction term.  The
i386 gcc bugs tend to give extra precision in w, and then using this
extra precision in the calculation of r results in the correction
mostly staying in w and being missing from r.  There still tends to
be no problem if the result is a simple expression involving w and r
-- modulo spills, w keeps its extra precision and r remains the right
correction for this wrong w.  However, here we want to pass w and r
to extern functions.  Extra precision is not retained in function args,
so w gets fixed up, but the change to the tiny r is tinier, so r almost
remains as a wrong correction for the right w.
2005-10-25 12:13:37 +00:00
David Xu
9fc171584d Put pthread_condattr_init sorted order. 2005-10-25 00:09:58 +00:00
Bruce Evans
4339c67c48 Moved the optimization for tiny x from __kernel_{cos,sin}[f](x) to
{cos_sin}[f](x) so that x doesn't need to be reclassified in the
"kernel" functions to determine if it is tiny (it still needs to be
reclassified in the cosine case for other reasons that will go away).

This optimization is quite large for exponentially distributed x, since
x is tiny for almost half of the domain, but it is a pessimization for
uniformally distributed x since it takes a little time for all cases
but rarely applies.  Arg reduction on exponentially distributed x
rarely gives a tiny x unless the reduction is null, so it is best to
only do the optimization if the initial x is tiny, which is what this
commit arranges.  The imediate result is an average optimization of
1.4% relative to the previous version in a case that doesn't favour
the optimization (double cos(x) on all float x) and a large
pessimization for the relatively unimportant cases of lgamma[f][_r](x)
on tiny, negative, exponentially distributed x.  The optimization should
be recovered for lgamma*() as part of fixing lgamma*()'s low-quality
arg reduction.

Fixed various wrong constants for the cutoff for "tiny".  For cosine,
the cutoff is when x**2/2! == {FLT or DBL}_EPSILON/2.  We round down
to an integral power of 2 (and for cos() reduce the power by another
1) because the exact cutoff doesn't matter and would take more work
to determine.  For sine, the exact cutoff is larger due to the ration
of terms being x**2/3! instead of x**2/2!, but we use the same cutoff
as for cosine.  We now use a cutoff of 2**-27 for double precision and
2**-12 for single precision.  2**-27 was used in all cases but was
misspelled 2**27 in comments.  Wrong and sloppy cutoffs just cause
missed optimizations (provided the rounding mode is to nearest --
other modes just aren't supported).
2005-10-24 14:08:36 +00:00
David Xu
710eb02de0 Include files thr_condattr_pshared.c and thr_mattr_pshare.c. 2005-10-24 05:48:32 +00:00
David Xu
5d2466eea1 Export following functions:
_pthread_condattr_getpshared
	_pthread_condattr_setpshared
	_pthread_mutexattr_getpshared
	_pthread_mutexattr_setpshared
	pthread_condattr_getpshared
	pthread_condattr_setpshared
	pthread_mutexattr_getpshared
	pthread_mutexattr_setpshared
2005-10-24 05:37:21 +00:00
David Xu
3c86291f25 Add functions pthread_mutexattr_setpshared and pthread_mutexattr_getpshared. 2005-10-24 05:35:40 +00:00
David Xu
b21a55e2d6 Add function pthread_condattr_setpshared and pthread_condattr_getpshared. 2005-10-24 05:35:14 +00:00
David Xu
7dcb6ea4f6 Export following functions:
_pthread_mutexattr_getpshared
	_pthread_mutexattr_setpshared
	pthread_condattr_getpshared
	pthread_condattr_setpshared
	pthread_mutexattr_getpshared
	pthread_mutexattr_setpshared
2005-10-24 05:20:04 +00:00
David Xu
c3d1b896b2 Add functions pthread_mutexattr_setpshared and pthread_mutexattr_getpshared. 2005-10-24 05:16:41 +00:00
Stefan Farfeleder
22b1904845 Add el_get to the NAME section.
Obtained from:	OpenBSD (via NetBSD)
2005-10-20 08:26:03 +00:00
Peter Wemm
add112ff65 Fix a well duplicated fencepost error that stopped crashdumps being
readable on certain random memory configurations.  If the libkvm consumer
tried to read something that was in the very last pdpe, pde or pte slot,
it would bogusly fail.

This is broken in RELENG_6 too.
2005-10-20 05:41:38 +00:00
Stefan Farfeleder
c86b3a98fe Make __sem_timedwait() consistent with the sem_timedwait() prototype. 2005-10-18 17:24:03 +00:00
Dag-Erling Smørgrav
a92fef8afc Implement the full range of ISO9660 number conversion routines in iso.h.
MFC after:	2 weeks
2005-10-18 13:35:08 +00:00
Tim Kientzle
2d0d7187c0 Fix installworld breakage. <sigh>
expr and printf are not available during installworld, so
use /bin/sh arithmetic expansion instead of expr and simply
give up on vanity formatting. ;-)
2005-10-14 16:32:50 +00:00
Tim Kientzle
db38abe649 1) Use GNU libtool to build shared libraries on non-FreeBSD
systems (or on FreeBSD systems when using ports).

2) Overhaul the versioning logic.  In particular,
   SHLIB_MAJOR number is now computed as "major+minor",
   which ensures library versions are the same for
   the FreeBSD build system and the portable
   libtool/autoconf/automake build system.
2005-10-13 05:51:38 +00:00
Tim Kientzle
7fb8511e34 Make some purely internal symbols static to reduce link pollution. 2005-10-12 15:38:45 +00:00
Tim Kientzle
f230dd9adb Minor style nit: tab instead of space after #define 2005-10-12 03:28:38 +00:00
Tim Kientzle
a3c4173bb8 When reading GNU-style sparse archive entries, handle
the first sparse block correctly (we used to assume
that the first sparse block was always at offset zero).
2005-10-12 03:27:46 +00:00
Tim Kientzle
52a88d3b57 In pax interchange format, use UTF8 for writing
link names, usernames, or group names that contain
non-ASCII characters.

In particular, this corrects an inconsistency reported
by Ed Maste when archiving symlinks with odd characters:
long symlinks would get preserved, short ones would
be changed.
2005-10-12 03:26:09 +00:00
Bruce Evans
74bbe8ed42 Fixed range reduction for large multiples of pi/2 on systems with
broken assignment to floats (e.g., i386 with gcc -O, but not amd64 or
ia64; i386 with gcc -O0 worked accidentally).

Use an unnamed volatile temporary variable to trick gcc -O into clipping
extra precision on assignment.  It's surprising that only 1 place needed
to be changed.

For tanf() on i386 with gcc -O, the bug caused errors > 1 ulp with a
density of 2.3% for args larger in magnitude than 128*pi/2, with a
maximum error of 1.624 ulps.

After this fix, exhaustive testing shows that range reduction for
floats works as intended assuming that it is in within a factor of
about 2^16 of working as intended for doubles.  It provides >= 8
extra bits of precision for all ranges.  On i386:

range                       max error in double/single ulps    extra precision
-----                       -------------------------------    ---------------
0 to 3*pi/4                 0x000d3132  /  0.0016              9+ bits
3*pi/4 to 128*pi/2          0x00160445  /  0.0027              8+
128*pi/2 to +Inf            0x00000030  /  0.00000009          23+
128*pi/2 up, -O0 before fix 0x00000030  /  0.00000009          23+
128*pi/2 up, -O1 before fix 0x10000000  /  0.5                 1

The 23+ bits of extra precision for large multiples corresponds to almost
perfect reduction to a pair of floats (24 extra would be perfect).

After this fix, the maximum relative error (relative to the corresponding
fdlibm double precision function) is < 1 ulp for all basic trig functions
on all 2^32 float args on all machines tested:

          amd64     ia64      i386-O0   i386-O1
	  ------    ------    ------    ------
cosf:     0.8681    0.8681    0.7927    0.5650
sinf:     0.8733    0.8610    0.7849    0.5651
tanf:     0.9708    0.9329    0.9329    0.7035
2005-10-11 07:56:05 +00:00
Bruce Evans
59b8fc1535 Fixed range reduction near (but not very near) medium-sized multiples
of pi/2 (1 line) and expand a comment about related magic (many lines).

The bug was essentially the same as for the +-pi/2 case (a mistranslated
mask), but was smaller so it only significantly affected multiples
starting near +-13*pi/2.  At least on amd64, for cosf() on all 2^32
float args, the bug caused 128 errors of >= 1 ulp, with a maximum error
of 1.2393 ulps.
2005-10-10 20:02:02 +00:00
David Xu
88676cbc2c The pthread_attr_set_createsuspend_np was broken, fix it by
replacing THR_FLAGS_SUSPENDED with THR_FLAGS_NEED_SUSPEND.
2005-10-10 12:15:07 +00:00
Bruce Evans
11cba99f67 Fix numerous errors of >= 1 ulp for cosf(x) and sinf(x) (1 line)
and add a comment about related magic (many lines)).

__kernel_cos[f]() needs a trick to reduce the error to below 1 ulp
when |x| >= 0.3 for the range-reduced x.  Modulo other bugs, naive
code that doesn't use the trick would have an error of >= 1 ulp
in about 0.00006% of cases when |x| >= 0.3 for the unreduced x,
with a maximum relative error of about 1.03 ulps.  Mistransation
of the trick from the double precision case resulted in errors in
about 0.2% of cases, with a maximum relative error of about 1.3 ulps.

The mistranslation involved not doing implicit masking of the 32-bit
float word corresponding to to implicit masking of the lower 32-bit
double word by clearing it.

sinf() uses __kernel_cosf() for half of all cases so its errors from
this bug are similar.  tanf() is not affected.

The error bounds in the above and in my other recent commit messages
are for amd64.  Extra precision for floats on i386's accidentally masks
this bug, but only if k_cosf.c is compiled with -O.  Although the extra
precision helps here, this is accidental and depends on longstanding
gcc precision bugs (not clipping extra precision on assignment...),
and the gcc bugs are mostly avoided by compiling without -O.  I now
develop libm mainly on amd64 systems to simplify error detection and
debugging.
2005-10-09 21:07:23 +00:00
Bruce Evans
a0e34da09f Oops, the last-minute optimization in rev.1.8 wasn't a good idea. The
17+17+24 bit pi/2 must only be used when subtraction of the first 2
terms in it from the arg is exact.  This happens iff the the arg in
bits is one of the 2**17[-1] values on each side of (float)(pi/2).

Revert to the algorithm in rev.1.7 and only fix its threshold for using
the 3-term pi/2.  Use the threshold that maximizes the number of values
for which the 3-term pi/2 is used, subject to not changing the algorithm
for comparing with the threshold.  The 3-term pi/2 ends up being used
for about half of its usable range (about 64K values on each side).
2005-10-09 04:29:08 +00:00
Bruce Evans
cd604283af Fixed syntax error (a missing brace) in previous commit. 2005-10-08 22:55:36 +00:00
Bruce Evans
a7b8acac04 Fixed range reduction near (but not very near) +-pi/2. A bug caused
a maximum error of 2.905 ulps for cosf(), but the algorithm for cosf()
is good for < 1 ulps and happens to give perfect rounding (< 0.5 ulps)
near +-pi/2 except for the bug.  The extra relative errors for tanf()
were similar (slightly larger).  The bug didn't affect sinf() since
sinf'(+-pi/2) is 0.

For range reduction in ~[-3pi/4, -pi/4] and ~[pi/4, 3pi/4] we must
subtract +-pi/2 and the only complication is that this must be done
in extra precision.  We have handy 17+24-bit and 17+17+24-bit
approximations to pi/2.  If we always used the former then we would
lose up to 24 bits of accuracy due to cancelation of leading bits, but
we need to keep at least 24 bits plus a guard digit or 2, and should
keep as many guard bits as efficiency permits.  So we used the
less-precise pi/2 not very near +-pi/2 and switched to using the
more-precise pi/2 very near +-pi/2.  However, we got the threshold for
the switch wrong by allowing 19 bits to cancel, so we ended up with
only 21 or 22 bits of accuracy in some cases, which is even worse than
naively subtracting pi/2 would have done.

Exhaustive checking shows that allowing only 17 bits to cancel (min.
accuracy ~24 bits) is sufficient to reduce the maximum error for cosf()
near +-pi/2 to 0.726 ulps, but allowing only 6 bits to cancel (min.
accuracy ~35-bits) happens to give perfect rounding for cosf() at
little extra cost so we prefer that.

We actually (in effect) allow 0 bits to cancel and always use the
17+17+24-bit pi/2 (min. accuracy ~41 bits).  This is simpler and
probably always more efficient too.  Classifying args to avoid using
this pi/2 when it is not needed takes several extra integer operations
and a branch, but just using it takes only 1 FP operation.

The patch also fixes misspelling of 17 as 24 in many comments.

For the double-precision version, the magic numbers include 33+53 bits
for the less-precise pi/2 and (53-32-1 = 20) bits being allowed to
cancel, so there are ~33-20 = 13 guard bits.  This is sufficient except
probably for perfect rounding.  The more-precise pi/2 has 33+33+53
bits and we still waste time classifying args to avoid using it.

The bug is apparently from mistranslation of the magic 32 in 53-32-1.
The number of bits allowed to cancel is not critical and we use 32 for
double precision because it allows efficient classification using a
32-bit comparison.  For float precision, we must use an explicit mask,
and there are fewer bits so there is less margin for error in their
allocation.  The 32 got reduced to 4 but should have been reduced
almost in proportion to the reduction of mantissa bits.
2005-10-08 22:43:55 +00:00
Bruce Evans
d31f7e4991 Fixed profiling of main() for amd64 and i386. This started rotting
in 1993 in rev.1.5 of the i386 a.out version (csu/i386/crt0.c).
Profiling uses a magic label "eprol" to delimit the start of the part
of the text section covered by profiling.  This label must be placed
before the call to main() to get main() properly profiled.  It was
placed there in rev.1.1 of crt0.c.  Rev.1.5 imported the initial
implementation of shared libraries in FreeBSD and misplaced the label.
Fortunately, the misplaced label was misspelled and the old label
wasn't removed, so the new label had no effect.  Unfortunately, when
profiling was implemented for the ELF in 1998 in rev.1.2 of
csu/i386-elf/crt1.c, only the incorrectly placed label was copied
(after fixing its name).  The bug was then copied to all other arches.
The label seems to be still misplaced in NetBSD for most arches.  It
is in common.c for most arches so it is even further from being inside
the function that calls main().

I think "eprol" is short for "end of prologue", but it must be placed
before the end of the prologue so that it covers main().  crt0.c has
it before the calls atexit(_mcleanup) and monstartup(...), but it
cannot affect these calls so I moved it after the call to monstartup().
It now also covers the call to _init() but not the newer call to
_init_tls().  Profiling of _init() seems to be harmless, and the call
to _init_tls() seems to be misplaced.

Reviewed by:	jdp (long ago, for a slightly different i386 version)
2005-10-07 22:13:17 +00:00
Brooks Davis
72bd741cfc When removing the local domain, only do so when the result will be a
host name.  This is matches the documented behaviro.  The previous
behavior would remove the domain name even if the result retained a dot.

This fixes rsh connections from a.example.com to example.com.

Reviewed by:	ceri (at least the concept)
2005-10-05 04:42:20 +00:00
Stefan Farfeleder
9dbcd4b0c0 Remove an unused variable.
Reviewed by:	ken
2005-10-04 22:00:35 +00:00
Stefan Farfeleder
6dea540edc Merge makelist rev 1.10 and map.c rev 1.22 from NetBSD. They just patch the
bug fixed in the last commit to map.c in a different way.  Follow NetBSD to
facilitate future merges.
2005-10-04 21:59:29 +00:00
Stefan Farfeleder
51890f2fed Merge NetBSD's rev. 1.49:
Fix double if (from Alexey E. Suslikov via jmc@openbsd).
While here, re-word both H_[GS]ETUNIQUE descriptions so they make
more sense. Bump date.
2005-10-04 21:51:26 +00:00
Stefan Farfeleder
bc6e20f014 Merge NetBSD's rev. 1.41:
PR/31012: Barry Naujok: libedit el_get with EL_EDITOR op does not work
Fixed as suggested.
2005-10-04 21:45:42 +00:00
Hartmut Brandt
4a6164e606 Catch up with the import of bsnmp-1.11. Add a couple of new
configuration flags to CFLAGS and set the WARNS level to 6.
2005-10-04 15:02:07 +00:00
David Xu
d1f3c70b6e Sort function names. 2005-10-04 08:28:46 +00:00
David Xu
9e49a2370c Add function pthread_timedjoin_np, the function is similar with pthread_join
except the function will return ETIMEDOUT if target thread does not exit
before specified absolute time passes.
2005-10-04 06:15:25 +00:00
Olivier Houchard
dc9e655c0b Fix a long line in copyright notice.
Pointed out by:	Gavin Atkinson gavin.atkinson ury york ac uk
2005-10-03 14:43:27 +00:00
Olivier Houchard
3507a15713 Add an asm version of strlen() for arm (how useful). 2005-10-03 14:21:49 +00:00
Olivier Houchard
9960ac47e9 libkvm bits for arm. 2005-10-03 14:21:14 +00:00
Ruslan Ermilov
ce8bf81ff2 Commenting out WARNS actually brought it up to 4. 2005-09-28 14:36:16 +00:00
Dag-Erling Smørgrav
40e48f9362 Comment out WARNS, the OpenSSL headers don't compile cleanly on some platforms. 2005-09-28 06:23:47 +00:00
Dag-Erling Smørgrav
f8ac10df9f Increase WARNS. 2005-09-26 20:34:09 +00:00
Dag-Erling Smørgrav
bd43956b81 Correct the logic for determining whether the user has already entered
a password.  Also, work around some harmless type pun warnings.

MFC after:	3 days
2005-09-26 20:33:53 +00:00
Giorgos Keramidas
727fbe7709 minor style.Makefile(5) fixes:
- WARNS before CFLAGS
- CFLAGS -DXXX before -IXXX

Approved by:	ru
2005-09-26 06:23:43 +00:00
Tim Kientzle
c4e21983bc signed/unsigned fixes (thanks to GCC4) and a few related minor style corrections. 2005-09-24 21:15:00 +00:00
Brian Somers
225721f00b Modify the code path of the ifdef NOTYET part of _kse_single_thread():
o  Don't reinitialise the atfork() handler list in the child.  We
   are meant to call the child handler, and on subsequent fork()s
   should call all three functions as normal.
o  Don't reinitialise the thread specific keyed data in the
   child after a fork.  Applications may require this for context.
o  Reinitialise curthread->tlflags after removing ourselves from
   (and reinitialising) the various internal thread lists.
o  Reinitialise __malloc_lock in the child after fork() (to balance
   our explicitly taking the lock prior to the fork()).

With these changes, it is possible to enable the NOTYET code in
thr_kern.c to allow the use of non-async-safe functions after
fork()ing from a threaded program.

Reviewed by:	Daniel Eischen <deischen@freebsd.org>
[_malloc_lock reinitialisation has since been moved to avoid polluting the
!NOTYET code]
2005-09-24 01:19:53 +00:00
Dag-Erling Smørgrav
c777c69bdc Do not use passphraseless keys for authentication unless the nullok
option was specified.

PR:		bin/81231
Submitted by:	"Daniel O'Connor" <doconnor@gsoft.com.au>
MFC after:	3 days
2005-09-22 05:35:24 +00:00
Dag-Erling Smørgrav
ea174c52f5 Narrow the use of user credentials.
Fix one case where openpam_restore_cred() might be called twice in a row.

MFC after:	3 days
2005-09-21 16:08:40 +00:00
Tim Kientzle
3be7274eed In archive_read_open(), do not set the internal archive state to
"HEADER" unless the open is successful.  Instead, leave the state as
"NEW."  In particular, if archive_read_open() fails, a subsequent call
to archive_read_next_header() will now cause an explicit assertion
failure instead of a silent segmentation fault.

This may need a little more work to fully realize the intention: If
archive_read_open() fails, you should be able to call it again on the
same archive handle to open a different archive (or the same archive
using a different mechanism).
2005-09-21 04:48:52 +00:00
Tim Kientzle
8aaa8fe733 Add a lot of error checks, based on the patches provided by Dan Lukes.
Also fixes a memory leak reported by Andrew Turner.

PR: bin/83476
Thanks to: Dan Lukes, Andrew Turner
2005-09-21 04:25:06 +00:00
Tim Kientzle
818898d384 Correct the documentation for archive_read_data_into_buffer()
Thanks to: Marcus Alves Grando
PR: docs/85854
MFC after: 7 days
2005-09-20 17:48:57 +00:00
Colin Percival
25284732cd When (re)allocating space for an array of pointers to char, use
sizeof(*list), not sizeof(**list).  (i.e., sizeof(pointer) rather than
sizeof(char)).

It is possible that this buffer overflow is exploitable, but it was
added after RELENG_5 forked and hasn't been MFCed, so this will not
receive an advisory.

Submitted by:	Vitezslav Novy
MFC after:	1 day
2005-09-19 18:43:11 +00:00
Bruce Evans
0b42281ee9 Fixed aliasing bugs in TRUNC() by using the fdlibm macros for access
to doubles as bits.  fdlibm-1.1 had similar aliasing bugs, but these
were fixed by NetBSD or Cygnus before a modified version of fdlibm was
imported in 1994.  TRUNC() is only used by tgamma() and some
implementation-detail functions.  The aliasing bugs were detected by
compiling with gcc -O2 but don't seem to have broken tgamma() on i386's
or amd64's.  They broke my modified version of tgamma().

Moved the definition of TRUNC() to mathimpl.h so that it can be fixed
in one place, although the general version is even slower than necessary
because it has to operate on pointers to volatiles to handle its arg
sometimes being volatile.  Inefficiency of the fdlibm macros slows
down libm generally, and tgamma() is a relatively unimportant part of
libm.  The macros act as if on 32-bit words in memory, so they are
hard to optimize to direct actions on 64-bit double registers for
(non-i386) machines where this is possible.  The optimization is too
hard for gcc on amd64's, and declaring variables as volatile makes it
impossible.
2005-09-19 11:28:19 +00:00
R. Imura
59fa708298 Connect smbfs build on powerpc. 2005-09-19 08:13:43 +00:00
Andrey A. Chernov
323d07b497 Just by allocating size*2 bytes we can't be sure that new size will be enough,
so change two
	if (size not enough) {
		reallocf(size*2);
	}
into
	while (size not enough) {
		reallocf(size*2);
	}
2005-09-18 17:50:58 +00:00
Christian Brueffer
9dbf9a4dca Use the correct function name as .Nm argument.
PR:		86169
Submitted by:	Toby Peterson <toby@apple.com>
MFC after:	3 days
2005-09-18 15:40:03 +00:00
Pawel Jakub Dawidek
8b28aef238 Pidfiles should be created with permission preventing users from opening
them for reading. When user can open file for reading, he can also
flock(2) it, which can lead to confusions.

Pointed out by:	green
2005-09-16 11:24:28 +00:00
Andrey A. Chernov
b9fb13f573 Cosmetic fixes to prev. commit.
Change first MAXPATHLEN to more standard PATH_MAX
Change second MAXPATHLEN to 1024 (it is temp buffer not related)
Change comment to reflect that.

Suggested by:   bde
2005-09-15 17:25:52 +00:00
Andrey A. Chernov
dedaf3ca1f Remove any hardcoded assumptions about malloc's way of allocating,
just use MAXPATHLEN. It prevents potential buffer overflow with other
malloc implementations.
(this change based on submitted patch)

PR:             86135
Submitted by:   Trevor Blackwell <tlb@tlb.org>
2005-09-14 20:35:46 +00:00
Andrey A. Chernov
369316a848 Don't reuse *pl to skip [], it is already used for {} parts in the loop above
(submitted patch slightly modified)

PR:             86038
Submitted by:   Gerd Rausch <gerd@juniper.net>
2005-09-14 19:14:32 +00:00
Pawel Jakub Dawidek
febd1f4df1 Correct type.
OK'ed by:	cperciva
2005-09-14 10:42:51 +00:00
David Schultz
26bd283f2a Add a missing ldexpf() alias for amd64.
Noticed by:	bz@, tjr@
2005-09-12 20:54:00 +00:00
Stefan Farfeleder
613100918d Include a couple of headers to ensure consistency between the prototype and
the function definition.
2005-09-12 19:52:42 +00:00
Stefan Farfeleder
a3b5200e71 - Add prototypes for __cmpdi2() and __ucmpdi2().
- Remove GCC 1 stuff.
2005-09-12 16:16:12 +00:00
Stefan Farfeleder
69053d669e Use prototypes for CHIN1() and CHIN(). 2005-09-12 16:02:54 +00:00
Stefan Farfeleder
2ba64027bc Move the declaration of __cleanup to libc_private.h as it is used in both
stdio/ and stdlib/.  Don't define __cleanup twice.
2005-09-12 13:46:32 +00:00
Stefan Farfeleder
f5365e2a65 Add a couple of missing MLINKS. 2005-09-11 20:59:52 +00:00
Stefan Farfeleder
4af29928b4 The arguments for time2posix() and posix2time() are time_t values, not
pointers.
2005-09-11 17:09:50 +00:00
Tim Kientzle
1dd0aa0c18 Style issue: Don't include <wchar.h> where it is not actually needed.
(wchar_t is defined in stddef.h, and only two files need more than that.)

Portability:  Since the wchar requirements are really quite modest,
it's easy to define basic replacements for wcslen, wcscmp, wcscpy,
etc, for use on systems that lack <wchar.h>.  In particular, this allows
libarchive to be used on older OpenBSD systems.
2005-09-10 22:58:06 +00:00
Robert Watson
f0dc021549 Add mkfifo(2) to the man page SEE ALSO list for umask(2) -- it's
mentioned in the description.

MFC after:	2 days
2005-09-10 20:47:02 +00:00
Tim Kientzle
9b98b2d5d1 Fix some errors in archive_read_data that caused failures in bsdtar's
pass-through filtering.

Thanks to: Bjoern Koenigönig
PR: bin/82878
2005-09-10 18:05:54 +00:00
Stefan Farfeleder
35a4bf1ce0 Add an MLINK for devname_r(). 2005-09-10 14:09:37 +00:00
Stefan Farfeleder
442a7dde61 The header and the man page say that sethostid() returns void, so make the
definition match.  Include <unistd.h>.
2005-09-10 13:54:42 +00:00
Stefan Farfeleder
16ca32b39f Fix parameter types of close and get members in DB. 2005-09-10 12:40:51 +00:00
Yaroslav Tykhiy
628bcb899b Fix fallout from the previous commit:
We shouldn't call chmod() if we've just used
fchmod() OK on the same file.

Approved by:	kientzle
2005-09-09 19:02:03 +00:00
Tim Kientzle
731f6a1690 Terminate metadata restore early only on failure, not success.
In particular, this bug was preventing the restore of fflags.
2005-09-05 10:23:55 +00:00
Tim J. Robbins
6595b51a7f Remove references to nonexistent "FreeBSD Security Architecture" document. 2005-09-05 09:49:33 +00:00
Stefan Farfeleder
7e4cbc3a50 Include needed headers that were obtained through <pthread.h>. Sort headers
while here.
2005-09-01 15:21:23 +00:00
Craig Rodrigues
1760096dbe Add __BEGIN_DECLS/__END_DECLS so that this header can be included in C++
programs.  Also, add include guards.

PR:		bin/44277
Submitted by:	Alex Zepeda <freebsd at blarf dot homeip dot net>
MFC after:	1 day
2005-08-31 14:57:39 +00:00
Juli Mallett
c7b40b9c7f Remove getino(3) manpage. It doesn't document what is here, what is here should
not get documented, and what it does document isn't going to come to CVS any
time in the immediate future.

Patience of a saint:	trhodes
2005-08-31 08:36:05 +00:00
Tom Rhodes
90f8e1e33a Disconnect getino.3 and remove MLINK I added.
Discussed with:	jmallett
2005-08-31 07:44:45 +00:00
Daniel Eischen
f98418eb29 Allocate a thread's tcb last so it is easier to handle failures to
malloc() siginfo.

PR:	85468
2005-08-30 12:42:00 +00:00
Gary W. Swearingen
669fe42db9 Added a sentence to explain what "span" means.
PR:             docs/84850
Submitted by:   garys
MFC after:      3 days
Approved by:    keramida
2005-08-29 20:41:58 +00:00
Daniel Eischen
f12a8f9703 Handle failure to malloc() part of the thread structure.
PR:	83457
2005-08-29 13:49:18 +00:00
Daniel Eischen
c7c5df6fdb Don't attempt to initialize the rtld lock if it can't be malloc()'d.
PR:	83452
2005-08-29 13:47:42 +00:00
Gleb Smirnoff
83c83f3e46 - Document the fact that the real length of listen queue is 1.5 more
than the value of backlog argument.
- Document the fact that a subsequent listen(2) calls on the listening
  socket change the backlog argument.
- Note that current listen queue lengths can be queried using netstat(1).

Submitted by:	Igor Sysoev <is rambler-co.ru>
Wording by:	gnn
2005-08-29 10:23:46 +00:00
Andre Oppermann
6050c8fe05 Add the function memmem(3) as found in glibc and others.
It is the binary equivalent to strstr(3).

 void *memmem(const void *big, size_t big_len,
	const void *little, size_t little_len);

Submitted by:	Pascal Gloor <pascal.gloor at spale.com>
MFC after:	3 days
2005-08-25 18:26:58 +00:00
Tom Rhodes
849aee62b2 Hook getino.3 up to the build and link it to putino.3.
PR:	83820
2005-08-25 10:22:29 +00:00
Pawel Jakub Dawidek
412fa8f114 Add a family of functions for reliable pidfiles handling.
Idea from:	jmg
Discussed on:	arch@
2005-08-24 17:21:38 +00:00
R. Imura
f373a82454 - Fix checking range of strings of struct iconv_add_in in libsmb and libkiconv,
- Add checking range of strings to iconv_sysctl_add().

Submitted by:	Rudolf Cejka
2005-08-24 12:38:26 +00:00
Dag-Erling Smørgrav
2738229eb8 Ignore HTTP_PROXY if it is defined but empty. This was already handled
correctly in the case of FTP_PROXY, because an empty FTP_PROXY has a
specific meaning ("don't use any proxy at all for ftp, even if HTTP_PROXY
is defined"), while an empty HTTP_PROXY has no meaning at all.

PR:		bin/85185
Submitted by:	Conall O'Brien <conallob=freebsd@maths.tcd.ie>
MFC after:	2 weeks
2005-08-24 12:28:05 +00:00
Stefan Farfeleder
d8f77b4529 Include <sys/types.h> and <limits.h> ourselves, don't assume they are included
through <pthread.h>.

gen/sem.c:		Prerequisite for <_semaphore.h>
net/getprotoent.c:	USHRT_MAX
net/getservent.c:	USHRT_MAX
stdio/ungetwc.c:	MB_LEN_MAX
stdio/vfwscanf.c:	MB_LEN_MAX
2005-08-20 07:59:13 +00:00
Stefan Farfeleder
ad7c49168f - Prefix MUTEX_TYPE_MAX with PTHREAD_ to avoid namespace pollution.
- Remove the macros MUTEX_TYPE_FAST and MUTEX_TYPE_COUNTING_FAST.

OK'ed by:	deischen
2005-08-19 21:31:42 +00:00
Tim J. Robbins
1ee0dbee57 Fix a boundary condition error in slow() and fast() in multibyte locales:
we must allow the character beginning at "p" to be converted to a wide
character for the purposes of EOL processing and word-boundary matching.
2005-08-17 11:37:38 +00:00
Tim J. Robbins
0eac054729 Document the fact that word-boundary matching does not work
properly in multibyte locales.
2005-08-17 11:21:15 +00:00
Robert Watson
33f23dc2fb The "Mbuf" zone was renamed "mbuf" to improve consistency, but the code
example in libmemstat.3 was not updated to take this rename into account.
Update the example.

PR:		84946
Submitted by:	Wojciech A. Koszek <dunstan at freebsd dot czest dot pl>
MFC after:	1 day
2005-08-15 10:24:20 +00:00
Tim J. Robbins
d62e8d4c7c Add an implementation of the semi-standard wcsdup() function, as found
on Microsoft and GNU systems.
2005-08-13 05:54:33 +00:00
Tim J. Robbins
0853006ff1 Change OUT from -2 to CHAR_MIN-1, making it impossible for it to
inadvertently match a negative char in the RE being compiled.

This fixes compilation of "\376" (as an ERE) and "\376\376" (as a BRE).

PR:		84740
MFC after:	1 week
2005-08-13 02:30:15 +00:00
Simon L. B. Nielsen
05fe2c1cb6 Add missing links from getgrent_r.3, getgrnam_r.3, and getgrgid_r.3 to
getgrent.3.

Submitted by:	Ulf Lilleengen <lulf@kerneled.org>
MFC after:	3 days
2005-08-12 22:46:15 +00:00
Dag-Erling Smørgrav
fd04cc7766 Change directory one level at a time, and use CDUP to back out. This is a
work in progress; it partially fixed bin/83278 and is a prerequisite to
fixing bin/83277.

PR:		bin/83277, bin/83278
2005-08-12 12:48:50 +00:00
Tim Kientzle
44938dbf6d Record an error message if there are write errors when extracting the
content of an archive entry to a file descriptor.
2005-08-10 15:02:53 +00:00
Tim Kientzle
4b9adc2fef Minor configuration fix to disable ACL support on MacOS X (which
lacks ACL_USER).

Thanks to:  Marcus Geiger, Joe Esch, and Markus Slopianka
2005-08-10 15:01:03 +00:00
Stefan Farfeleder
442861ce97 Move <sys/cdefs.h> up to reduce diff to NetBSD. 2005-08-10 13:41:31 +00:00
Stefan Farfeleder
7bcbf4cce9 Submitted to and merged from NetBSD (rev. 1.23 and 1.24):
- Don't delete the current line when typing `yy'.
- Don't use a possibly stale pointer in cv_paste().
-
2005-08-10 13:38:01 +00:00
Kenneth D. Merry
4a12d2d126 Remove a reference to compute_stats(), since it is no longer documented at
least.

Submitted by:	osa
MFC after:	1 week
2005-08-10 00:51:36 +00:00
Robert Watson
513c89ced2 Document kvm(3)-related error constants, and correct minor formatting
nits.
2005-08-09 22:19:30 +00:00
Stefan Farfeleder
cc5ed4050e NetBSD merged our typo fixes, update $NetBSD$. 2005-08-09 13:37:59 +00:00
Stefan Farfeleder
3d37ccb1e9 Merge a change I missed in the last commit. 2005-08-09 13:35:48 +00:00
Stefan Farfeleder
06ce2f8d05 Merge NetBSD's 1.25 which fixes a small bug introduced in 1.24. 2005-08-09 13:31:59 +00:00
Stefan Farfeleder
8131ad836a Include <term.h> before #undef'ing key_clear. 2005-08-08 17:17:56 +00:00
Stefan Farfeleder
c22964d7eb Fix a few typos. 2005-08-08 07:08:35 +00:00
Stefan Farfeleder
1d22b4120f Don't forget to copy the sentinel into the `help' array. It's expected to
be there.

Submitted by:	Björn König
PR:		82381
2005-08-08 07:03:50 +00:00
Stefan Farfeleder
76d00450e6 Sync libedit with recent NetBSD developments. Including improvements to the
vi-mode, removal of clause 3, cleanups and the export of the tokenization
functions.

Not included: config.h, filecomplete.{c,h}
2005-08-07 20:55:59 +00:00
Stefan Farfeleder
969f700138 Revert the replacement of realloc() with reallocf() (el.h:1.2, map.c:1.5 and
tokenizer.c:1.3).  Contrary to the commit log there were no memory leaks,
but the change introduced a bug because the free'd pointer was not zeroed
and calling the appropriate _end() function would call free() a second time.
2005-08-07 08:35:39 +00:00
Poul-Henning Kamp
3d86554c20 Respect the YES_HESIOD build variable. 2005-08-06 16:53:55 +00:00
Robert Watson
ba23fa9bd8 Teach libmemstat(3) how to extract malloc(9) statistics using kvm(3),
so that libmemstat can be used to view full memory statistics from
kernel core dumps and /dev/mem.  This is provided via a new query
function, memstat_kvm_malloc(), which is also automatically invoked
by memstat_kvm_all().  A kvm handle must be passed in.

This will allow malloc(9)-specific code to be removed from vmstat(8).
2005-08-06 13:54:03 +00:00
Stefan Farfeleder
add8fae07c Use char * when doing pointer arithmetics. 2005-08-05 07:28:26 +00:00
Robert Watson
2286854ff0 Define LIBMEMSTAT so that vm_page.h won't perform a nested include of
opt_vmpage.h.

Remove definition of _KERNEL, it is no longer required in order to
include uma_int.h, as the sensitive parts of uma_int.h (a number of
inlines depending on kernel-only constants) are now protected by
_KERNEL.
2005-08-04 10:06:39 +00:00
Daniel Eischen
2ce2892eaf Add usleep to the map files.
Noticed by:	davidxu
2005-08-03 01:54:52 +00:00
Daniel Eischen
7f2461f315 Add a cancellation point for usleep(). 2005-08-03 00:48:13 +00:00
Daniel Eischen
14d5987375 Add a cancellation point for usleep().
While here, fix sleep() so that it is also a cancellation point (a
missing weak reference prevented that).
2005-08-03 00:47:31 +00:00
Daniel Eischen
ed0b0abcf7 Make syslog() use the internal (non-cancellation point) _usleep().
Prior to this it was calling the cancellable usleep() while holding
a lock.
2005-08-03 00:45:58 +00:00
Daniel Eischen
8450917472 Make usleep() overridable by the thread libraries so they can provide
cancellation points.

Noticed by:	phk
2005-08-03 00:44:25 +00:00
Daniel Eischen
78956f2474 Add namespace #defines for usleep. 2005-08-03 00:43:14 +00:00
Tim Kientzle
01122e2ae0 Generate default fake "device" and "inode" numbers for entries
extracted from tar archives.  Otherwise, converting tar archives to
cpio format (with "bsdtar -cf out.cpio @in.tar") convert every entry
into a hard link to a single file.  This simple logic breaks hard
links, but that's better than the alternative.

MFC after: 7 days
2005-08-02 03:17:57 +00:00
Tim Kientzle
0f61624bd1 When copying time values from the main entry header to be used in the
header of the pax extension entry, clip them to ustar limits.  In particular,
this prevents an internal panic for very old files.

Thanks to: Chris Spiegel
MFC after: 7 days
2005-08-02 03:13:42 +00:00
Tim Kientzle
a2e467d35a Correct a few minor mis-statements (libarchive does support reading
GNU tar sparse files, people have extended cpio) and clarify an
important detail about pax format (that ustar-compliant archivers
can mostly read pax archives correctly).

MFC after: 7 days
2005-08-02 03:10:52 +00:00
Robert Watson
33c20d188c Add memstat_kvm_uma(), an implementation of a libmemstat(3) query routine
that knows how to extract UMA(9) allocator statistics from a core dump or
live memory image using kvm(3).  The caller is expected to provide the
necessary kvm_t handle, which is then used by libmemstat(3).

With these changes, it is trivially straight forward to re-introduce
vmstat -z support on core dumps, which was lost when UMA was introduced.

In the short term, this requires including vm/ include files that are not
intended for extra-kernel use, requiring in turn some ugliness.
2005-08-01 19:07:39 +00:00
Robert Watson
22247a2a38 Correct two libmemstat(3) bugs:
- Move memory_type_list flushing logic from memstat_mtl_free() to
  _memstat_mtl_empty(), a libmemstat-internal function that can
  be called from other parts of the library.  Invoke
  _memstat_mtl_empty() from memstat_mtl_free(), which also frees
  the containing list structure.

  Invoke _memstat_mtl_empty() instead of memstat_mtl_free() in
  various error cases in memstat_malloc.c and memstat_uma.c, which
  previously resulted in the list being freed prematurely.

- Reverse the order of updating the mt_kegfree and mt_free fields
  of the memory_type in memstat_uma.c, otherwise keg free items
  won't be counted properly for non-secondary zones.

MFC after:	3 days
2005-08-01 13:18:21 +00:00
Giorgos Keramidas
6fb9b618f5 Fix all the spelling mistakes I could find in the man pages for words
that have at least 3 characters.

MFC after:	1 week
Thanks to:	Music band ``Chingon''
		for keeping me company while searching for these.
2005-07-31 03:30:48 +00:00
Daniel Eischen
e059b9ce6c Remove an unused variable. 2005-07-29 21:49:47 +00:00
Daniel Eischen
ca7d07fa00 Catch up with the atomic_FOO_ptr() changes and silence a few warnings. 2005-07-29 21:06:09 +00:00
Diomidis Spinellis
87a236caf5 Document the ECONNRESET errno value. 2005-07-29 07:42:10 +00:00
David Xu
2ff77b9220 Cast to uintptr_t to avoid compiler warning, it was broken by
the recent atomic_ptr() change.
2005-07-28 03:34:54 +00:00
Hajimu UMEMOTO
5495564735 don't accept invalid form of an address like 1:2:3:4:5:6:7::8.
PR:		bin/84106
Obtained from:	BIND9
MFC after:	2 days
2005-07-27 14:33:36 +00:00
Colin Percival
1fcc990954 Correct a buffer overflow which can occur when decompressing a
carefully crafted deflated data stream. [1]

Correct problems in the AES-XCBC-MAC IPsec authentication algorithm. [2]

Submitted by:	suz [2]
Security:	FreeBSD-SA-05:18.zlib [1], FreeBSD-SA-05:19.ipsec [2]
2005-07-27 08:41:17 +00:00
Matthew N. Dodd
50007d443b Move initialization above point of first possible reference to
avoid overwriting ty_status values set from the 'type' field.

Previously TTY_DIALUP and TTY_NETWORK flags did not match
specified type.
2005-07-25 17:57:15 +00:00
Dag-Erling Smørgrav
c9275efacc Disable thread support in BIND. It appears to reduce performance rather
than increase it, and seems to be the cause of the memory leaks which some
users have reported.

Requested by:	dougb
MFC after:	5 days
2005-07-25 14:44:11 +00:00
Robert Watson
7f6e27372b If a retrieved UMA zone is a secondary zone, don't report keg free items,
as they actually belong to the  primary zone, and maye otherwise be
reported more than once.

MFC after:	1 day
2005-07-25 09:52:59 +00:00
Tim J. Robbins
d48c77b534 Speed up __wcsconv() (and hence the printf() %ls format):
- use wcsrtombs() instead of a wcrtomb() loop where possible.
- avoid wcrtomb() loop when output precision is small.
2005-07-24 12:12:44 +00:00
Robert Watson
e754c6bbb7 Having decided not to provide a libmemstat(3) error number to text
conversion routine, now change my mind and add one, memstat_strerror(3),
which returns a const char * pointer to a string describing the error,
to be used on the results of memstat_mtl_geterror().

While here, also correct a minor typo in the HISTORY man page.

Pointers on improving ease of internationalization would be
appreciated.

MFC after:	1 day
2005-07-24 01:41:47 +00:00
Robert Watson
70ee997ed4 Document additional aspects of libmemstat(3):
- Short description of each memory type access method.

- Descriptions of libmemstat(3) errors and memstat_mtl_geterror(3).

MFC after:	1 day
2005-07-24 01:29:30 +00:00
Robert Watson
345628080d Introduce more formal error handling for libmemstat(3):
- Define a set of libmemstat(3) error constants, which are used by all
  libmemstat(3) methods except for memstat_mtl_alloc(), which allocates
  a memory type list and may return ENOMEM via errno.

- Define a per-memory_type_list current error value, which is set when a
  call associated with a memory list fails.  This requires wrapping a
  structure around the queue(9) list head data structure, but this change
  is not visible to libmemstat(3) consumers due to using access methods.

- Add a new accessor method, memstat_mtl_geterror() to retrieve the error
  number.

- Consistently set the error number in a number of failure modes where
  previously some combination of setting errno and printf'ing error
  descriptions was used.  libmemstat(3) will now no longer print to stdio
  under any circumstances.  Returns of NULL/-1 for errors remain the
  same.

This avoids use of stdio, misuse of error numbers, and should make it
easier to program a libmemstat(3) consumer able to print useful error
messages.  Currently, no error-to-string function is provided, as I'm
unsure how to address internationalization concerns.

MFC after:	1 day
2005-07-24 01:28:54 +00:00
Pawel Jakub Dawidek
9975a9a287 Better translation. 2005-07-23 21:30:35 +00:00
Robert Watson
ddefbc898a Prefix two non-static libmemstat(3) internal functions with '_' symbols, to
try and discourage use outside the library.

Remove duplicate declaration of memstat_mtl_free() from memstat_internal.h,
as it's not internal, and the memstat.h definition suffices.
2005-07-23 21:17:15 +00:00
Jonathan Chen
c5a096e0e0 fix innetgr() returning false positives and negatives when reverse netgroup
matching is used.

PR: 35506
MFC after: 3 days
2005-07-22 22:20:26 +00:00
Hajimu UMEMOTO
85a71a15c8 Remove padding for ABI compatibility of ai_addrlen member
from struct addrinfo.  This change break ABI compatibility
on 64 bit arch.
2005-07-22 18:21:28 +00:00
Ken Smith
a84020c2b9 Bump the shared library version number of all libraries that have not
been bumped since RELENG_5.

Reviewed by:	ru
Approved by:	re (not needed for commit check but in principle...)
2005-07-22 17:19:05 +00:00
Tim J. Robbins
d2a57b3026 Add HISTORY section. 2005-07-21 10:53:27 +00:00
Tim J. Robbins
9376b9d71a Add cross-reference to nextwctype(3). 2005-07-21 10:32:17 +00:00
Tim J. Robbins
5a94ee1180 Add COMPATIBILITY and HISTORY sections. Fix typo. 2005-07-21 10:27:45 +00:00
Joseph Koshy
5138c36a1b Add COMPATIBILITY and HISTORY sections.
MFC after:	3 days
2005-07-21 06:44:54 +00:00
Joseph Koshy
79b6b08fd5 Catch with the source code. Sort a list alphabetically. Add a
HISTORY section.

MFC after:	3 days
2005-07-21 06:42:30 +00:00
Ruslan Ermilov
fce1f260f1 Drop useless with NO_PIC SHLIB_MAJOR. 2005-07-20 14:35:26 +00:00
Robert Watson
ca108fe268 UMA supports "secondary" zones, in which a second zone can be layered
on top of a primary zone, sharing the same allocation "keg".  When
reporting statistics for zones, do not report the free items in the
keg as part of the free items in the zone, or those free items will
be reported more than once: for the primary zone, and then any
secondary zones off the primary zone.  Separately record and maintain
a kegfree statistic, and export via memstat_get_kegfree(), which is
available for use if needed.  Since items free'd back to the keg are
not fully initialized, and hence may not actually be available (since
secondary zone ctor-time initialization can fail), this makes some
amount of sense.

This change corrects a bug made visible in the libmemstat(3)
modifications to netstat: mbufs freed back to the keg from the
packet zone would be counted twice, resulting in negative values
being printed in the mbuf free count.

Some further refinement of reporting relating to secondary zones may
still be required.

Reported by:	ssouhlal
MFC after:	3 days
2005-07-20 09:17:40 +00:00
Hajimu UMEMOTO
d84e21303c refer RFC 3542 rather than RFC 2292bis.
Submitted by:	Keiichi SHIMA <keiichi__at__iijlab.net>
Obtained from:	KAME
2005-07-19 18:13:58 +00:00
Hajimu UMEMOTO
d5cbe1abb0 fixed the validation code of routing header length in inet6_rth_getaddr().
reported by Delia Kecskemeti <delia.kecskemeti__at__windriver.com>

Submitted by:	Keiichi SHIMA <keiichi__at__iijlab.net>
Obtained from:	KAME
2005-07-19 18:09:44 +00:00
John-Mark Gurney
5ba593de9e remove the supposed max of 2^31, it hasn't been this small in a very
long time... i.e. since this file was imported...  (ufs1 supports much
larger files then this)...

Submitted by:	Ivan Voras
MFC after:	1 week
2005-07-18 22:27:41 +00:00
Robert Watson
919bddddb6 Bump MEMSTAT_MAXCALLER to 16. memtop(8) seems to be able to happily
consume that many slots to track snapshot-to-snapshot changes and
running totals.  And 16 is a nice round number.

MFC after:	1 week
2005-07-18 14:14:17 +00:00
Robert Watson
449ce0e42f Add __BEGIN_DECLS and __END_DECLS to make libmemstat(3) more C++-friendly.
MFC after:	1 week
2005-07-17 13:54:46 +00:00
Philippe Charnier
634eb5fb07 sync function prototype with reality. 2005-07-17 13:33:04 +00:00
Tim J. Robbins
a385e04b47 Remove confusing "single C char locales" phrase; arguments to these
functions and must now be either an unsigned char or EOF, regardless of
locale.
2005-07-17 04:11:06 +00:00
Tim J. Robbins
5b86168f54 Remove confusing "single C char locales" phrase; arguments to tolower()
and toupper() must now be either an unsigned char or EOF, regardless of
locale.
2005-07-17 03:37:00 +00:00
Jung-uk Kim
a0f887f4f3 Use better Korean translation for `trap'
Requested by:	many Korean users from bsdforum.or.kr
Submitted by:	perky
Approved by:	anholt (mentor)
2005-07-16 05:40:14 +00:00
Robert Watson
d144359bde Teach libmemstat(3) about UMA(9) failure statistics.
Requested by:	victor cruceru <victor dot cruceru at gmail dot com>
MFC after:	1 week
2005-07-15 23:39:21 +00:00
Andrey A. Chernov
e775a53b59 Add -mno-sse3 for prescott/nocona 2005-07-15 12:29:31 +00:00
Maxim Sobolev
9c007cf29e Document the fact that if MAP_FIXED request has been successful it
replaces any previous mapping to the same address.

Obtained from:	IEEE Std 1003.1, 2004 Edition
2005-07-15 11:37:25 +00:00
Robert Watson
e86bb57bbf Provide more documentation on caller-owned storage in struct memory_type,
as well as documenting MEMSTAT_MAXCALLER.

MFC after:	1 week
2005-07-15 11:28:21 +00:00
Robert Watson
ccf4e07e83 Increase the number of caller memory storage slots from 2 or 4 to
MEMSTAT_MAXCALLER (8), and expose MEMSTAT_MAXCALLER via memstat.h so
that applications can check their assumptions about how many slots
are available.

Remove 'spare' memory storage in struct malloc_type, since we now
don't expose the data structure internals to applications and rely
on accessor methods, this approach to ABI stability isn't required.

MFC after:	7 days
2005-07-15 11:19:55 +00:00
Robert Watson
09df0a9a09 Add a section on the allocator name space and its interactions with
memstat_mtl_find().

MFC after:	10 days
2005-07-15 10:23:55 +00:00
Robert Watson
3ab4da680f Re-spell wronge less wrongly as wrong.
Submitted by:	jkoshy
MFC after:	1 week
2005-07-15 10:13:50 +00:00
Christian Brueffer
f0ea72a038 - Remove MLINKS to nonexistant manpages
- Change some section numbers to match reality
- For MLINKS to manpages from ports, mention which port installs them

MFC after:	3 days
2005-07-14 20:29:08 +00:00
Robert Watson
37b40e499e Properly combine per-CPU UMA cache allocation and free counts with the
global counters maintained in the zone.

MFC after:	1 week
2005-07-14 20:01:04 +00:00
Robert Watson
1189affa8b Hook libmemstat(3) up to the build. 2005-07-14 17:59:50 +00:00
Robert Watson
0cddce4989 Add libmemstat(3), a library for use by debugging and monitoring
applications in tracking kernel memory statistics.  It provides an
abstracted interface to uma(9) and malloc(9) statistics, wrapped
around the recently added binary stream sysctls for the allocators.

Using this interface, it is easy to build monitoring tools, query
specific memory types for usage information, etc.  Facilities are
provided for binding caller-provided data to memory types,
incremental updates of memory types, and queries that span multiple
allocators.

Support for additional allocators is (relatively) easy to add.

The API for libmemstat(3) will probably change some over time as
consumers are written, and requirements evolve.  It is written to
avoid encoding ABIs for data structure layout into consuming
applications for this reason.

MFC after:	1 week
2005-07-14 17:40:02 +00:00
Robert Watson
7a6d1e6f69 Cross-reference sem_getvalue(3) from several other semaphore-related
functions.

MFC after:	3 days
2005-07-13 13:15:22 +00:00
Xin LI
ae73eb3a7f Better memory handling:
- It is acceptable to call free(3) when the given pointer itself
   is NULL, so we do not need to determine NULL before passing
   a pointer to free(3)
 - Handle failure of malloc(3)

MT6/5 Candidate

Submitted by:	Dan Lukes <dan at obluda cz>
PR:		bin/83352
2005-07-13 10:40:07 +00:00
Joseph Koshy
82c83e34dd Fix a bug in pmclog_read() that causes it to return with a false
error when a log record crosses an internal buffer boundary.

Approved by:	re (scottl)
2005-07-09 17:12:30 +00:00
Ken Smith
5adb21a681 Missed one piece of the cluster's quirk. Need to override WARNS because
if _FREEFALL_CONFIG is set gcc bails since pam_sm_setcred() in pam_krb5.c
no longer uses any of its parameters.

Pointy hat:	kensmith
Approved by:	re (scottl)
2005-07-08 14:53:45 +00:00
John Baldwin
bcd9e0dd20 - Add two new system calls: preadv() and pwritev() which are like readv()
and writev() except that they take an additional offset argument and do
  not change the current file position.  In SAT speak:
  preadv:readv::pread:read and pwritev:writev::pwrite:write.
- Try to reduce code duplication some by merging most of the old
  kern_foov() and dofilefoo() functions into new dofilefoo() functions
  that are called by kern_foov() and kern_pfoov().  The non-v functions
  now all generate a simple uio on the stack from the passed in arguments
  and then call kern_foov().  For example, read() now just builds a uio and
  calls kern_readv() and pwrite() just builds a uio and calls kern_pwritev().

PR:		kern/80362
Submitted by:	Marc Olzheim marcolz at stack dot nl (1)
Approved by:	re (scottl)
MFC after:	1 week
2005-07-07 18:17:55 +00:00
Joe Marcus Clarke
a617a18a23 Fix ptsname(3) by converting it to use devname(3) to obtain the name of
a tty device instead of the legacy minor number approach.  This is known to
fix gnome-vfs' sftp module as well as kio_sftp and kdesu on -CURRENT.

Thanks to scottl for the snprintf() approach idea.

Reviewed by:	phk
Tested by:	pav
		mich
Approved by:	re (scottl)
2005-07-07 17:48:40 +00:00
Ken Smith
2672e71736 This is sort of an MFS. Peter made these changes to the RELENG_*
branches but missed HEAD.  This patch extends his a little bit,
setting it up via the Makefiles so that adding _FREEFALL_CONFIG
to /etc/make.conf is the only thing needed to cluster-ize things
(current setup also requires overriding CFLAGS).

From Peter's commit to the RELENG_* branches:
> Add the freebsd.org custer's source modifications under #ifdefs to aid
> keeping things in sync.  For ksu:
> * install suid-root by default
> * don't fall back to asking for a unix password (ie: be pure kerberos)
> * allow custom user instances for things like www and not just root

The Makefile tweaks will be MFC-ed, the rest is already done.

MFC after:      3 days
Approved by:    re (dwhite)
2005-07-07 14:16:38 +00:00
Colin Percival
8d284299a9 Correct a buffer overflow which occurred in the handling of some
particularly corrupt deflated data streams.

Security:	FreeBSD-SA-05:16.zlib
Approved by:	re (security blanket)
2005-07-06 14:00:52 +00:00