Commit Graph

10157 Commits

Author SHA1 Message Date
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
Dag-Erling Smørgrav
d3cf5f1524 Use the correct login class when setting a new password.
PR:		65557, 72949
Submitted by:	Stephen P. Cravey <clists@gotbrains.org>
Approved by:	re (scottl)
MFC after:	2 weeks
2005-07-05 18:42:18 +00:00
Joseph Koshy
86a655492a - Update the CPU version check to recognize P4/EMT64 CPUs. [1]
- Allow libpmc(3) to support P4/EMT64 PMCs on the amd64 architecture
  and AMD K8 PMCs on the i386. [2]

Submitted by:	ps [1]
Pointy hat:	myself [2]
Approved by:	re (scottl)
2005-07-03 16:33:22 +00:00
Xin LI
1c70a91b10 Minor grammar fix
Submitted by:	Wojciech A. Koszek [dunstan at freebsd czest pl]
Approved by:	re (hrs)
2005-07-03 12:35:11 +00:00
Scott Long
dd3d1a98d5 Fix the alpha build by using the correct argument types for _kvm_kvatop().
Submitted by: marcel
Approved by: re (implicit)
2005-07-02 05:49:29 +00:00
Joseph Koshy
151392465f MFP4:
- pmcstat(8) gprof output mode fixes:

  lib/libpmc/pmclog.{c,h}, sys/sys/pmclog.h:
  + Add a 'is_usermode' field to the PMCLOG_PCSAMPLE event
  + Add an 'entryaddr' field to the PMCLOG_PROCEXEC event,
    so that pmcstat(8) can determine where the runtime loader
    /libexec/ld-elf.so.1 is getting loaded.

  sys/kern/kern_exec.c:
  + Use a local struct to group the entry address of the image being
    exec()'ed and the process credential changed flag to the exec
    handling hook inside hwpmc(4).

  usr.sbin/pmcstat/*:
  + Support "-k kernelpath", "-D sampledir".
  + Implement the ELF bits of 'gmon.out' profile generation in a new
    file "pmcstat_log.c".  Move all log related functions to this
    file.
  + Move local definitions and prototypes to "pmcstat.h"

- Other bug fixes:
  + lib/libpmc/pmclog.c: correctly handle EOF in pmclog_read().
  + sys/dev/hwpmc_mod.c: unconditionally log a PROCEXIT event to all
    attached PMCs when a process exits.
  + sys/sys/pmc.h: correct a function prototype.
  + Improve usage checks in pmcstat(8).

Approved by:	re (blanket hwpmc)
2005-06-30 19:01:26 +00:00
Hiten Pandya
a1601503f5 Use 'manual page' instead of 'man page' for consistency.
Approved by:	re (hrs)
2005-06-30 13:18:15 +00:00
Ruslan Ermilov
8b7475ed75 Tidy up the markup.
Approved by:	re (blanket manpages)
2005-06-30 06:35:51 +00:00
Paul Saab
da2ef70999 Match _kvm_kvatop to it's prototype in kvm_i386.c. This unbreaks
the build.

Approved by:	re
2005-06-30 01:25:21 +00:00
Peter Wemm
3b4399f6a7 Clean out the leftovers from the i386_set_gsbase() TLS conversion.
Like on libthr, there is an i386_set_gsbase() stub implementation here
to avoid libc.so.5 issues.  This should likely be a weak symbol and I
expect this will be fixed soon.

Approved by:	re
2005-06-29 23:15:36 +00:00
Peter Wemm
e55a0cd805 Support crash dumps > 4GB in size on 32 bit platforms. _kvm_kvatop()
returned an lseek offset in a "u_long *" value, which can't express >4GB
offsets on 32 bit machines (eg: PAE).  Change to "off_t *" for all.

Support ELF crashdumps on i386 and amd64.

Support PAE crashdumps on i386.  This is done by auto-detecting the
presence of the IdlePDPT which means that PAE is active.

I used Marcel's _kvm_pa2off strategy and ELF header reader for ELF support
on amd64.  Paul Saab ported the amd64 changes to i386 and we implemented
the PAE support from there.

Note that gdb6 in the src tree uses whatever libkvm supports.  If you want
to debug an old crash dump, you might want to keep an old libkvm.so handy
and use LD_PRELOAD or the like.  This does not detect the old raw dump
format.

Approved by: re
2005-06-29 22:39:41 +00:00
Ruslan Ermilov
9abe909b54 - Tidy up the markup.
- Clarify the sections on "Cascading P4 PMCs" and
  "Precise Event Based Sampling" (1)
- Bump document date.

Reviewed by:	jkoshy
Submitted by:	jkoshy (1)
Approved by:	re (blanket)
2005-06-24 16:56:24 +00:00
Ruslan Ermilov
f711ce99e5 Tidy up the markup.
Reviewed by:	jkoshy
Approved by:	re (blanket)
2005-06-24 16:13:36 +00:00
Peter Wemm
2cfe3fda19 Set ki_tdev to NODEV rather than NULL.
Approved by:  re
2005-06-24 00:37:04 +00:00
David Xu
3adc17c503 Fix off-by-one nanosecond bug in macro TIMESPEC_ADD.
Reviewed by: deischen
Approved by: re (dwhite)
MFC after  : 4 days
2005-06-22 22:38:56 +00:00
David Xu
86a07ac068 Fix off-by-one nanosecond in macro TIMESPEC_ADD.
Reviewed by: deischen
Approved by: re (dwhite)
MFC after  : 4 days
2005-06-22 22:35:49 +00:00
John Baldwin
afc7f38c6b Clear devinfo_generation in devinfo_free() since we are freeing all of the
cached state.  Otherwise, a subsequent call to devinfo_init() would succeed
without reading the device tree from the kernel thinking that the cached
state was up to date since the generation count was the same.  However,
since the cached state was actually free'd, attempts to examine the tree
after the second devinfo_init() would fail.

Reported by:	Juho Vuori juho dot vuori at kepa dot fi
Submitted by:	Stefan Farfeleder stefan at fafoe dot narf dot at
Approved by:	re (dwhite)
MFC after:	1 week
2005-06-22 15:20:11 +00:00
Stefan Farfeleder
882cf65dd6 Add the functions _Qp_cmp() and _Qp_cmpe() as described in the Sparc
Compliance Definition.  On sparc64, GCC emits _Qp_cmp() calls for its
__builtin_isfoo() functions which are used for C99's isfoo() macros.

Approved by:	re(dwhite)
PR:		73782
2005-06-21 21:13:07 +00:00
Dag-Erling Smørgrav
0d13f5f0c6 Update for OpenPAM Figwort.
Approved by:	re (kensmith)
2005-06-17 08:14:42 +00:00
Ruslan Ermilov
01293bdb90 Markup nit.
Approved by:	re (blanket)
2005-06-16 21:56:03 +00:00
Ruslan Ermilov
70db9cd000 Fixed compile warning.
Approved by:	re (blanket)
2005-06-16 21:55:45 +00:00
Ruslan Ermilov
2d641ab1ec Removed redundnt empty line.
Approved by:	re (blanket)
2005-06-16 21:53:41 +00:00
Ruslan Ermilov
48856b0042 Markup fixes.
Approved by:	re
2005-06-16 19:01:07 +00:00
Ruslan Ermilov
f789cb8293 Assorted markup fixes.
Approved by:	re
2005-06-15 19:04:04 +00:00
Robert Watson
bbc0285dc8 Remove incorrect BUGS entry: libthr does support process-scope thread
scheduling.

MFC after:	1 week
Submitted by:	davidxu
Approved by:	re (scottl)
2005-06-15 15:21:10 +00:00
Ruslan Ermilov
d3b3ec17a8 When IPC_NOWAIT is set and there is no message, msgrcv() fails
with errno set to ENOMSG.

PR:		docs/82217
Submitted by:	delphij
Approved by:	re (blanket)
2005-06-14 10:56:02 +00:00
Dag-Erling Smørgrav
30d0a60aed Don't use a cast as an lvalue.
Add a redundant test to make it painfully obvious to the reader that this
code does not support IPv6.

Approved by:	re (dwhite)
MFC after:	1 week
2005-06-13 21:18:52 +00:00
Robert Watson
5335c6bc6a Add a stub libthr(3) man page to document what it is and why, as well as
to point at libmap.conf(5).  This will help answer questions about what
and why it is, although not in great detail.

Approved by:	re (scottl)
MFC after:	1 week
MFC note:	When MFC'd, don't MFC mention of work not yet MFC'd.
2005-06-11 15:27:56 +00:00
Jacques Vidrine
a8e0b2e8ab Remove rexecd(8), a server that implements a particularly insecure
method of executing commands remotely.  There are no rexec clients in
the FreeBSD tree, and the client function rexec(3) is present only in
libcompat.  It has been documented as "obsolete" since 4.3BSD, and its
use has been discouraged in the man page for over 10 years.
2005-06-10 20:52:36 +00:00
Craig Rodrigues
e5d54f7733 Fix the wording in this man page so that it
reflects the actual behavior of the API
for listing extended attributes.

PR:		docs/79261
Submitted by:	rodrigc
Reviewed by:	rwatson, kan
Approved by:	das (mentor)
2005-06-10 16:54:17 +00:00
Dag-Erling Smørgrav
57341fbcf3 Use appropriate error codes for each facility instead of just PAM_AUTH_ERR.
Noticed by:	pjd
2005-06-10 06:16:13 +00:00
Joseph Koshy
1455fcd32d Fix tinderbox breakage. 2005-06-10 03:45:04 +00:00
Joseph Koshy
f263522a45 MFP4:
- Implement sampling modes and logging support in hwpmc(4).

- Separate MI and MD parts of hwpmc(4) and allow sharing of
  PMC implementations across different architectures.
  Add support for P4 (EMT64) style PMCs to the amd64 code.

- New pmcstat(8) options: -E (exit time counts) -W (counts
  every context switch), -R (print log file).

- pmc(3) API changes, improve our ability to keep ABI compatibility
  in the future.  Add more 'alias' names for commonly used events.

- bug fixes & documentation.
2005-06-09 19:45:09 +00:00
Dag-Erling Smørgrav
40e0db94af Revert the commits that made libssh an INTERNALLIB; they caused too much
trouble, especially on amd64.

Requested by:	ru
2005-06-07 09:31:28 +00:00
Gregory Neil Shapiro
3852b24c31 Add a new source file in sendmail 8.13.4 2005-06-07 04:18:25 +00:00
Dag-Erling Smørgrav
e4c2fedcc7 Fix libssh dependency. 2005-06-06 19:01:01 +00:00
Tim Kientzle
495b0c0d52 Minor clean up for flags restoration: Use fchflags/lchflags when
available, stub out flags restore on platforms that don't support it,
update autoconf to probe for fchflags and lchflags support.
2005-06-04 22:30:36 +00:00
Tim Kientzle
48864d8c25 Sort archive_entry_ctime/archive_entry_ctime_nsec correctly. 2005-06-04 22:26:23 +00:00
Tim Kientzle
f87c3529a8 Support libarchive with C++ by adding appropriate conditional
extern "C" declarations.
2005-06-04 22:24:04 +00:00
Tim Kientzle
43b1ef9bc2 Fix one error in the example usage of the archive_write API and fill
in a few missing details.  The example code here is now a complete,
functioning example program.
2005-06-04 22:19:25 +00:00
Alan Cox
2ca32bcc02 Update .Dd value. 2005-06-04 19:44:09 +00:00
Alan Cox
bbe7bbdfee Eliminate the original method of requesting notification of aio_read(2) and
aio_write(2) completion through kevent(2).  This method does not work on
64-bit architectures.  It was deprecated in FreeBSD 4.4.  See revisions
1.87 and 1.70.2.7.

Change aio_physwakeup() to call psignal(9) directly rather than indirectly
through a timeout(9).  Discussed with: bde

Correct a bug introduced in revision 1.65 that could result in premature
delivery of a signal if an lio_listio(2) consisted of a mixture of
direct/raw and queued I/O operations.  Observed by: tegge

Eliminate a field from struct kaioinfo that is now unused.

Reviewed by: tegge
2005-06-04 19:16:33 +00:00
Jens Schweikhardt
e201f9ecd1 Release n_hibma's maintainership due to his ENOTIME.
Discussed with, okayed, authorized, requested by, on behalf of:	n_hibma (MAINTAINER)
2005-06-04 10:58:39 +00:00
Ruslan Ermilov
5142c5f201 Fix the source path. 2005-06-04 10:48:21 +00:00
Warner Losh
46813f9674 Missed rwatson's redundancy 2005-06-03 15:50:55 +00:00
Warner Losh
474a2ca954 Remove libz and pppd redundancy 2005-06-03 15:25:13 +00:00
Hajimu UMEMOTO
e217163c6d bump SHLIB_MAJOR as libpcap refers getnetbyname(3).
Noticed by:	ru
2005-06-03 09:41:26 +00:00
David E. O'Brien
b9a30e8043 Match sys/boot in ensure GCC does not use x86 FP registers in integer code.
Submitted by:	Pawel Worach <pawel.worach@gmail.com>
2005-06-03 06:55:22 +00:00
Hajimu UMEMOTO
360a23ab31 reflect type change of n_net and getnetbyaddr(3). 2005-06-03 04:44:54 +00:00
Hajimu UMEMOTO
ad0fab44e2 - Remove padding for ABI compatibility of n_net member from struct
netent.
- Change 1st argument of getnetbyaddr() to an uint32_t on 64 bit
  arch as well to confirm to POSIX-2001.

These changes break ABI compatibility on 64 bit arch.
There is similar padding issue for ai_addrlen of struct addrinfo.
However, it is leaved as is for now.

Discussed on:	arch@, standards@ and current@
X-MFC after:	never
2005-06-03 03:32:06 +00:00
Scott Long
e462283052 Provide missing implementations for archive_entry_ctime() and
archive_entry_ctime_nano()
2005-06-01 18:20:02 +00:00
Tim Kientzle
0f412b97da Remove the C99-specific __func__ that is one of the few barrier to
compiling on IRIX and Solaris.  Remove the "archive_check_magic" macro
that existed only to provide __func__ to the underlying __archive_check_magic
function.

Thanks to: Darin Broady
MFC after: 14 days
2005-06-01 15:52:39 +00:00
Tim Kientzle
f65d1d5147 <Ooops> Two lines got dropped from the previous commit. Apologies.
MFC after: 14 days
2005-06-01 15:46:47 +00:00
Tim Kientzle
3a2a859dd4 A minor refinement to "pax" output: Remove suid/sgid/sticky bits
from mode before using mode for extended attributes entry, copy
mtime/atime/ctime to extended attributes entry so it's a little more
clear that it corresponds to the like-named regular entry.

MFC after: 14 days
2005-06-01 15:44:23 +00:00
Stefan Farfeleder
a4229919e2 Initialise `hex' at the top of the file, ISO C requires that an array with
internal linkage has a complete type.
2005-05-31 21:19:14 +00:00
David E. O'Brien
c0a87c26b3 Back out revision 1.51, it is wrong. We don't litter -I's within lib
Makefiles to get headers from /usr/src vs. the standard include paths.
2005-05-31 20:39:53 +00:00
John Baldwin
ac0a0594f6 Use %z to print size_t values. 2005-05-31 20:01:58 +00:00
John Baldwin
7ab17e6d01 Just use uintptr_t and intptr_t rather than requiring each arch to provide
explicit int/long typedefs.
2005-05-31 20:01:18 +00:00
John Baldwin
884f050a62 Add a missing END() to quiet a warning. 2005-05-31 19:58:23 +00:00
John Baldwin
2bd979f7a3 Mark _thread_exit() and __sys_exit() as __dead2 to quiet some warnings. 2005-05-31 19:57:23 +00:00
John Baldwin
94e7919893 Style tweak. 2005-05-31 19:56:52 +00:00
Doug Rabson
8d7681bb7f Add support for XMM registers in GDB for x86 processors that support
SSE (or its successors).

Reviewed by: marcel, davidxu
MFC After: 2 weeks
2005-05-31 09:43:04 +00:00
Maxim Sobolev
55f88dd25e Make bzip2 support working again after bzip2 upgrade. This time commit
BZ_NO_COMPRESS support to the bzip2 sources directly (yes, this takes file
off the vendor branch, but looks like bzip2 maintainer doesn't care), so that
it will not be removed when the next upgrade is performed. Also, add a short
note on how to test bzip2 support.

Pointy hat to:  obrien

Correct comment (libz -> libbz2) and remove useless full path to zutil.h
while I am here.
2005-05-29 21:56:38 +00:00
Maxim Sobolev
422d5081e1 Add missed ${.CURDIR}/../../contrib/bzip2 into include search path, otherwise
old version of bzlib.h can be picked up from the /usr/include.
2005-05-29 21:05:58 +00:00
Sam Leffler
0b27443f51 update for import of v0.9.1-096 2005-05-29 18:12:46 +00:00
Hajimu UMEMOTO
d6fd3ed8ab reduce cast.
MFC after:	1 week
2005-05-27 20:44:57 +00:00
Maksim Yevmenkin
43d33de948 Do not tread 128-bit UUID as int128. Provide separate macros to get/put
128-bit UUID libsdp(3). Fix 128-bit UUID printing in sdpcontrol(8).

MFC after:	3 days
2005-05-27 19:11:33 +00:00
Stefan Farfeleder
1470d46611 Fix long (and long long) to long double, unsigned to long double and unsigned
long (and unsigned long long) to long double conversions.
- Add a parameter that specifies the position of the sign bit to the _QP_TTOQ
  macro, previously it always looked at bit 31.  Pass a negative number to
  disable sign inspection for unsigned types.  This fixes _Qp_xtoq(),
  _Qp_uitoq() and _Qp_uxtoq().
- In the functions __fpu_itof() and __fpu_xtof(), look at the sign bit to
  decide whether we're doing a conversion from an unsigned type.  If so, don't
  negate the mantissa if the integer exceeds the biggest signed number.

PR:		55773
Patch by:	Stephen Paskaluk (based upon)
MFC after:	2 weeks
2005-05-27 10:00:22 +00:00
Poul-Henning Kamp
90d93f7141 Check for NULL pointer return.
Spotted by:	marcus
2005-05-24 10:10:38 +00:00
Tim Kientzle
b33c1067f8 Start to address the race issue between restoring a file's contents
and restoring the metadata.  In particular, the metadata-restore
functions now all accept a file descriptor and a pathname.  If the
file descriptor is set and the platform supports the appropriate
syscall, restore the metadata through the file descriptor.  Otherwise,
restore it through the pathname.  This is complicated by varying
syscall support (FreeBSD has an fchmod(2) but no fchflags(2), for
example) and because non-file entries don't have an fd to use in
restoring attributes (for example, mknod(2) doesn't return a file
handle).

MFC after: 14 days
2005-05-21 19:45:56 +00:00
Tim Kientzle
21805f33bf Correct return values in myopen() and myclose() in Example code.
Bug: docs/79318
Thanks to: Derek Tattersall
MFC after: 7 days
2005-05-21 19:38:19 +00:00
Hajimu UMEMOTO
77cf61aeb0 reduce strlen() call. 2005-05-20 15:39:20 +00:00
Hajimu UMEMOTO
8a4d3d8400 use reentrant.h and simplify. 2005-05-20 15:17:08 +00:00
Hajimu UMEMOTO
532e65b886 check return value of ttyname_r(). 2005-05-20 14:59:20 +00:00
Hajimu UMEMOTO
db297254fe ttyname_r() didn't pass correct buffer size to devname_r(). 2005-05-20 14:56:55 +00:00
Philippe Charnier
d36dd0b78e Remove unused variables. 2005-05-20 13:09:49 +00:00
Philippe Charnier
e479377e63 Remove unused variable. Shorten the path to WARNS=6 compliance. 2005-05-20 12:55:38 +00:00
Philippe Charnier
109a0e6b26 Remove unused variables. Whitespace cleaning. 2005-05-20 12:46:34 +00:00
Peter Wemm
d9d99c5478 Fix libstand on amd64. Rev 1.46 (obrien) removed the -I. that the
bzip2 support provided, and amd64 depended on.  Amd64 has a custom
${.OBJDIR}/machine symlink in it and the -I. picked this up.  Without
it, the libstand code was being compiled in 32 bit mode, but with 64 bit
machine headers.
2005-05-20 03:18:19 +00:00
Doug Rabson
6f21c8127a Align the stack to a 16 byte boundary so that we can safely call functions
that use SSE. The compiler does attempt to do this in main() but not very
successfully - it still manages to use unaligned offsets from %ebp in some
cases. Also we need to have an aligned stack in case something uses SSE
via _init().

MFC After: 1 week
2005-05-19 07:36:07 +00:00
Doug Rabson
0ff6455012 Keep the stack aligned to a 16 byte boundary when calling init functions
so that we don't cause a bus error if they start storing SSE math stuff
on the stack.

MFC After: 1 week
2005-05-19 07:31:06 +00:00
David E. O'Brien
af753a20e9 Clean up an additional file. 2005-05-17 17:48:26 +00:00
David E. O'Brien
311d73f68e Don't use a patch w/in /usr/src. Programmatically change files when needed. 2005-05-17 17:46:29 +00:00
David E. O'Brien
d09dcfcfe9 Re-enable support for bzip2'ed compressed filesystems. 2005-05-17 16:22:54 +00:00
David E. O'Brien
1e2e63f657 Temporarily disable support for bzip2'ed compressed filesystems, until a
maintainable why of handling them is created.
2005-05-17 01:44:37 +00:00
Ruslan Ermilov
228f8c4f8b Make <runefile.h> internal to libc.
Suggested by:	phantom
2005-05-16 09:32:41 +00:00
Hajimu UMEMOTO
036ae3dd79 - The ai_addrlen of a struct addrinfo used to be a size_t, per
RFC 2553.  In XNS5.2, and subsequently in POSIX-2001 and RFC
  3493, it was changed to a socklen_t.  And, the n_net of a
  struct netent used to be an unsigned long integer.  In XNS5,
  and subsequently in POSIX-2001, it was changed to an uint32_t.
  To accomodate for this while preserving ABI compatibility with
  the old interface, we need to prepend or append 32 bits of
  padding, depending on the (LP64) architecture's endianness.
- Correct 1st argument of getnetbyaddr() to uint32_t on 32
  bit arch.  Stay as is on 64 bit arch for ABI backward
  compatibility for now.

Reviewed by:	das, peter
MFC after:	2 weeks
2005-05-15 20:15:15 +00:00
George V. Neville-Neil
fd57e549e0 Submitted by: Jinmei Tatuya, Hajimu Umemoto
Reviewed by:	rwatson at freebsd dot org
Approved by:	rwatson at freebsd dot org
MFC after:	1 week

Fix the matchlen() function so that it handles the IPv4 (AF_INET)
case correctly.  Until now it has been treating IPv4 addresses
as if they were IPv6 which could lead to corruption errors.
2005-05-14 19:43:10 +00:00
Xin LI
68b749ff2f Revert to old ttyname_r behavior that when _ioctl() returns 0 (SUCCEEDED),
return the buffer immediately.  This will permit ssh and/or PAM logins
broken by previous commit.

The (potential) underlying problem is still under investigation.

Point hat to:	me
2005-05-14 14:03:21 +00:00
Stefan Farfeleder
c29f424e01 The header glue.h should provide just a declaration for the variable
__sglue, not a definition.

PR:		80378
Submitted by:	John Engelhart <johne@zang.com>
MFC after:	1 week
2005-05-13 21:12:34 +00:00
Hajimu UMEMOTO
d928d41c84 NI_WITHSCOPEID cleanup
Reviewed by:	des
2005-05-13 20:51:09 +00:00
Hajimu UMEMOTO
946e41f142 raise readability bit. 2005-05-13 17:56:53 +00:00
Hajimu UMEMOTO
f8997ca2f4 free ypbuf only when yp_match() succeed. 2005-05-13 17:30:03 +00:00
Hajimu UMEMOTO
4f10131848 NI_WITHSCOPEID cleanup. Neither RFC 2553 nor RFC 3493 defines
NI_WITHSCOPEID, and our getaddrinfo(3) does nothing special
for it, now.
2005-05-13 16:31:11 +00:00
Xin LI
8dcb56dc78 Provide more POSIX-complaint ttyname_r(3) interface[1], which is slightly
different from what has been offered in libc_r (the one spotted in the
original PR which is found in libthr has already been removed by David's
commit, which is rev. 1.44 of lib/libthr/thread/thr_private.h):
	- Use POSIX standard prototype for ttyname_r, which is,
		int ttyname_r(int, char *, size_t);
	  Instead of:
	  	char *ttyname_r(int, char *, size_t);
	  This is to conform IEEE Std 1003.1, 2004 Edition [1].
	- Since we need to use standard errno for return code, include
	  errno.h in ttyname.c
	- Update ttyname(3) implementation according to reflect the API
	  change.
	- Document new ttyname_r(3) behavior
	- Since we already make use of a thread local storage for
	  ttyname(3), remove the BUGS section.
	- Remove conflicting ttyname_r related declarations found in libc_r.

Hopefully this change should not have changed the API/ABI, as the ttyname_r
symbol was never introduced before the last unistd.h change which happens a
couple of days before.

[1] http://www.opengroup.org/onlinepubs/009695399/functions/ttyname.html

Requested by:	Tom McLaughlin <tmclaugh sdf lonestar org>
Through PR:	threads/76938
Patched by:	Craig Rodrigues <rodrigc crodrigues org> (with minor changes)
Prompted by:	mezz@
2005-05-13 16:27:30 +00:00
Xin LI
f73fd5bd75 Connect MLINKS for ttyname_r(3), and add prototype into unistd.h. 2005-05-11 14:07:25 +00:00
Xin LI
f57a875fa0 Avoid (unnecessarily) casting away const within uuid_is_nil. 2005-05-11 13:18:10 +00:00
Tim Kientzle
85e66aedb4 Document zlib update procedure and provide future maintainers a
snapshot of the current state of the import.

MFC after:	2 weeks
2005-05-11 03:50:50 +00:00
Tim Kientzle
42307a8f43 Since the FreeBSD local modifications are mostly trivial (consisting
primarily of pointless $FreeBSD$ tags), sync most files in HEAD with
those in the ZLIB branch.  This minimizes the differences between
HEAD and ZLIB and should simplify future imports.

After this, there are only three files with local modifications
(gzio.c, minigzip.c, and zconf.h) and two non-vendor files
(Makefile, zopen.c).  The rest exactly match the vendor distribution.

PR:		i386/76294
MFC after:	2 weeks
2005-05-11 03:47:48 +00:00
Tim Kientzle
0e35a97bf9 archive_entry_set_link is supposed to update whichever link field
(symlink or hardlink) is already set.  Instead, it was always setting
the hardlink field.  In particular, this caused GNU tar format long
symlinks to be interpreted as hardlinks.

Thanks to: Brooks Davis
MFC after: 7 days
2005-05-08 19:10:41 +00:00
Daniel Eischen
7f8fa2cf47 Prevent these functions from using stack outside of their frame.
Reported by:	Marc Olzheim <marcolz at stack dot nl>
OK'd by:	das
2005-05-06 15:44:20 +00:00
David Xu
0fa2f94316 Fix race by using atomic operation, with this change, both libpthread
and libthr now can run profiling on SMP.
2005-05-06 07:37:01 +00:00
Gleb Smirnoff
e0408a6edc Build userland libalias using src/sys/netinet/libalias.
Reviewed by:	ru
Repocopy by:	peter
2005-05-04 12:49:44 +00:00
Giorgos Keramidas
e3446e1f8e Document the fact that accept(2) may return EINVAL when addrlen is
negative (in addition to returning EINVAL when called on a descriptor
that is not a socket).

Submitted by:	Arne H Juul <arnej@europe.yahoo-inc.com>
PR:		docs/80587
2005-05-04 11:09:26 +00:00
Dag-Erling Smørgrav
bc8695dc6c The correct description for mode "w" is
(((truncate to zero length) or (create)) (text file)) (for writing)
and not
  ((truncate file to zero length) or (create text file)) (for writing)

MFC after:	1 week
2005-05-04 08:12:44 +00:00
Hajimu UMEMOTO
d21de89a71 do mutex lock for each yp calls. with this,
http://cvsweb.netbsd.org/bsdweb.cgi/src/regress/lib/libpthread/resolv/
is working.
2005-05-03 20:30:31 +00:00
Xin LI
603c9c1dc5 Cleanup for getgrouplist(3):
- Use /*- instead of /* for copyright section
 - Include unistd.h for prototype of it
 - Sort and separate includes as described in style(9)
 - ANSIfy the function defination
 - Use const for the traversing iterator
2005-05-03 16:20:03 +00:00
Hajimu UMEMOTO
1ccfa322aa fix signed/unsigned comparison warnings.
Obtained from:	NetBSD
2005-05-03 16:13:31 +00:00
Xin LI
2f22da5d97 Include paths.h for prototype of getbootfile(3). 2005-05-03 15:28:07 +00:00
Hajimu UMEMOTO
943db5a2ab the 3rd argument of getsockname() should be socklen_t*.
Submitted by:	stefanf
2005-05-02 04:43:32 +00:00
Joseph Koshy
c5153e190b Add convenience APIs pmc_width() and pmc_capabilities() to -lpmc.
Have pmcstat(8) and pmccontrol(8) use these APIs.

Return PMC class-related constants (PMC widths and capabilities)
with the OP GETCPUINFO call leaving OP PMCINFO to return only the
dynamic information associated with a PMC (i.e., whether enabled,
owner pid, reload count etc.).

Allow pmc_read() (i.e., OPS PMCRW) on active self-attached PMCs to
get upto-date values from hardware since we can guarantee that the
hardware is running the correct PMC at the time of the call.

Bug fixes:
 - (x86 class processors) Fix a bug that prevented an RDPMC
   instruction from being recognized as permitted till after the
   attached process had context switched out and back in again after
   a pmc_start() call.

   Tighten the rules for using RDPMC class instructions: a GETMSR
   OP is now allowed only after an OP ATTACH has been done by the
   PMC's owner to itself.  OP GETMSR is not allowed for PMCs that
   track descendants, for PMCs attached to processes other than
   their owner processes.

 - (P4/HTT processors only) Fix a bug that caused the MI and MD
   layers to get out of sync.  Add a new MD operation 'get_config()'
   as part of this fix.

 - Allow multiple system-mode PMCs at the same row-index but on
   different CPUs to be allocated.

 - Reject allocation of an administratively disabled PMC.

Misc. code cleanups and refactoring.  Improve a few comments.
2005-05-01 14:11:49 +00:00
Hajimu UMEMOTO
f468e837a1 oops, we don't need previous change. 2005-05-01 12:37:12 +00:00
Hajimu UMEMOTO
6bd1d1a192 make it compilable without YP definition. 2005-05-01 12:08:57 +00:00
Hajimu UMEMOTO
8592d23a9f don't see RES_USE_INET6 when called from getipnodeby*(). 2005-05-01 07:39:45 +00:00
Hajimu UMEMOTO
e84892eb74 oops, gethostbyaddr(3) must return h_addr as an IPv4-mapped
IPv6 address when RES_USE_INET6 was set, according to RFC 2133
section 6.2.
2005-04-30 20:07:01 +00:00
Hajimu UMEMOTO
6964622dd0 handling RES_USE_INET6 better. 2005-04-30 19:28:31 +00:00
Hajimu UMEMOTO
e4f846efec _ht_gethostbyaddr didn't handle RES_USE_INET6 correctly. 2005-04-30 18:46:27 +00:00
Hajimu UMEMOTO
e692b6186a _gethostbynisname() didn't support RES_USE_INET6. 2005-04-30 18:37:35 +00:00