Commit Graph

5317 Commits

Author SHA1 Message Date
Hajimu UMEMOTO
f62c4786e1 Vendor import of BIND 9.3.2 2006-05-21 11:10:07 +00:00
Craig Rodrigues
e6d1e46944 Remove reference to "System call restart" in intro(2). intro(2) does not
have such a reference.  Add a reference instead to SA_RESTART in
sigaction(2).
2006-05-20 21:49:03 +00:00
Maxim Konovalov
3953c11715 o .Xr strtonum(3).
MFC after:	1 week
2006-05-20 21:11:35 +00:00
Jung-uk Kim
1761ec1040 Correct decoding a string containing '/'.
PR:		97485
Submitted by:	Mikko Tyolajarvi < mbsd at pacbell dot net >
2006-05-19 19:06:38 +00:00
Giorgos Keramidas
79652c510a * Document the fact that non-superusers cannot change file flags for
objects with SF_IMMUTABLE, SF_APPEND, or SF_NOUNLINK.
* Document that non-superusers cannot set or clear any SF_* flag
  (setting fails with EPERM, clearing is silently ignored).
* Document that superusers cannot change any flag if one of
  SF_IMMUTABLE, SF_APPEND, SF_NOUNLINK is set and securelevel is
  greater than 0.
* Document SF_SNAPSHOT and note that it is maintained by the
  system and is, for this reason, impossible to set to clear by
  any user.

PR:             docs/33877
Submitted by:   harti
Help by:        George Marsellis <gam9478@njit.edu>
MFC after:      1 week
2006-05-16 20:24:41 +00:00
Hajimu UMEMOTO
3da59cd007 Fix gethostbyaddr() prototype to conform to IEEE Std 1003.1:
http://www.opengroup.org/onlinepubs/009695399/functions/gethostbyaddr.html

gethostbyaddr_r() is changed as well.
It breaks ABI backward compatibility on 64 bit arch.  So, we fix it
on 32 bit arch only for now.

Reported by:	Rostislav Krasny <rosti.bsd@gmail.com>
2006-05-12 15:37:23 +00:00
David Xu
3a31b448c0 Save errno before calling pthread_mutex_lock because pthread_mutex_lock
may change errno unexpectly.
2006-05-11 09:10:33 +00:00
Jason Evans
3212b810d8 Increase the minimum chunk size by a power of two (32kB --> 64kB, assuming
4kB pages), in order to avoid dangerous rounding error when calculating
fullness limits during run promotion/demotion.

Convert a structure bitfield to a normal field in areana_run_t.  This should
have been changed along with the other fields in revision 1.120.
2006-05-10 00:07:45 +00:00
Brian S. Dean
de76bc3609 A few minor wording changes and a clarification about error conditions. 2006-05-03 17:33:29 +00:00
Hajimu UMEMOTO
b947683ce1 Fix alignment problem on AMD64.
Reported by:	Pascal Hofstee <caelian__at__gmail.com>
Submitted by:	Michael Bushkov <bushman__at__rsu.ru>
Tested by:	Pascal Hofstee <caelian__at__gmail.com>
2006-05-02 23:02:32 +00:00
Hajimu UMEMOTO
eb59e992e1 cache' couldn't co-exist with compat'.
Submitted by:	"Michael Bushkov" <bushman__at__rsu.ru>
2006-04-30 21:25:00 +00:00
Hajimu UMEMOTO
06a99fe36f - Extend the nsswitch to support Services, Protocols and Rpc
databases.
- Make nsswitch support caching.

Submitted by:	Michael Bushkov <bushman__at__rsu.ru>
Sponsored by:	Google Summer of Code 2005
2006-04-28 12:03:38 +00:00
Jason Evans
f7768b9f34 Change the semantics of brk_max to dynamically deal with data segment
bounds. [1]

Modify logic for utilizing the data segment, such that it is possible to
create huge allocations there.

Shrink the data segment when deallocating a chunk, if it is at the end of
the data segment.

Rename chunk_size to csize in huge_malloc(), in order to avoid masking a
static variable of the same name. [1]

Reported by:	Paul Allen <nospam@ugcs.caltech.edu>
2006-04-27 01:03:00 +00:00
Daniel Eischen
babd660805 Oops, correct the weak reference (s/fclose/fcloseall).
Spotted by:	Antoine Brodin (antoine _dot_ brodin _at_ laposte _dot_ net)
2006-04-22 16:47:59 +00:00
Daniel Eischen
ca7f278f1d Now that libc has fcloseall(), remove _cleanup() from the list
of FreeBSD private symbols.
2006-04-22 15:11:33 +00:00
Daniel Eischen
b62c955c52 Add fcloseall() to libc. This removes the need to export _cleanup().
Linux also provides an fcloseall() implementation.

Discussed on:	arch
2006-04-22 15:09:15 +00:00
Tom Rhodes
38467e931c Update for rev 1.205 of vm_mmap.c.
Submitted by:	fanf
2006-04-21 07:22:55 +00:00
Ceri Davies
c499f23b6e Correct usage example.
PR:		docs/95059
Submitted by:	Jos Backus
MFC after:	4 days
2006-04-18 21:37:24 +00:00
Maxim Konovalov
9b63b79ee0 o dbm_close(3) returns void not zero or anything else. Touch .Dd.
PR:		docs/80070
Submitted by:	Aleksej Saushev
MFC after:	2 weeks
2006-04-16 16:33:26 +00:00
Marius Strobl
f2189783c9 For _Qp_{fge,fgt,fle,flt}() the SCD states that "Exceptions mimic fcmpeq",
this means they should set the cmpe flag when calling __fpu_compare().

Submitted by:	stefanf
MFC after:	2 weeks
2006-04-16 14:32:53 +00:00
Hajimu UMEMOTO
d3ac2b30d4 - make reentrant version of netdb functions glibc style API, and
expose them to outside of libc.
- make netdb functions NSS friendly.

Reviewed by:	arch@ and current@ (no objection)
2006-04-15 16:20:27 +00:00
Daniel Eischen
797f4fb875 Don't export __gdtoa. The only known ports that rely on
this or the deprecated POSIX functions {e,g,f}cvt() have
newer versions that do not (rely on them).

Requested by:	marius
2006-04-15 15:35:20 +00:00
Maxim Konovalov
6ad8b89261 o Document SO_NOSIGPIPE, touch .Dd.
PR:		docs/78479
Submitted by:	Mikko Tyolajarvi
MFC after:	2 weeks
2006-04-15 13:37:35 +00:00
Ruslan Ermilov
1427d59bee List pwritev in the NAME section. 2006-04-14 19:34:07 +00:00
Jens Schweikhardt
e4b2624f46 s/soley/solely 2006-04-13 18:19:44 +00:00
Marius Strobl
ea84e2b899 - Move _Qp_* and __dtoul from FBSDprivate to the list of FBSD_1.0 symbols
as well as add __sparc_utrap_install to FBSD_1.0; these are required by
  the SCD libc 64 psABI and thus meant to be officially exported symbols.
- Remove the __fpu_* entries as well as the __sigtramp entry altogether as
  these are internal to the libc FPU emulation and the signal trampoline
  initialization in sigaction(2) respectively and thus don't need to be
  externally visible.
- Add __sparc_utrap_setup to the list of FBSDprivate symbols as it's used
  in src/lib/csu/sparc64/crt1.c to initialize the libc FPU emulation (I
  think alternatively src/lib/csu/sparc64/crt1.c could be changed to use
  __sparc_utrap_install instead, at the expense of increasing the size of
  executables a bit).
- Add an entry for the vfork symbol to the FBSD_1 list and entries for it's
  associated symbols generated by the RSYSCALL() macro to the FBSDprivate
  list. There's some magic in place that automatically generates code for
  vfork() if there's no explicit MD code for it so it might make sense to
  move these symbols from the MD symbol map files to a MI one.

The last two changes make the libc symbol versioning useable on sparc64.

Ok'ed by:	deischen
2006-04-11 19:43:36 +00:00
Christian Brueffer
ba1cb6f3ea Document that VIS_CSTYLE encodes space (040) as '\s'.
PR:		95546
Submitted by:	Jan Schaumann <jschauma@netmeister.org>
MFC after:	3 days
2006-04-09 16:39:43 +00:00
Hajimu UMEMOTO
f76963aba1 Don't test if RES_INIT is set to see res_state structure is
initialized.  Some application may reset RES_INIT.  Use the
way in __res_vinit(), instead.
2006-04-08 18:19:35 +00:00
Jason Evans
f90cbdf17f Add an unreachable return statement, in order to avoid a compiler warning
for non-standard optimization levels.

Reported by:	Michael Zach <zach@webges.com>
2006-04-05 18:46:24 +00:00
Jason Evans
50ff9670e2 Only initialize the first per-chunk page map element for free runs. This
makes run split/coalesce operations of complexity lg(n) rather than n.
2006-04-05 04:15:12 +00:00
Jason Evans
94fc7dc0d5 Add malloc_usable_size() to the RETURN VALUES section. 2006-04-04 20:27:53 +00:00
Jason Evans
cf01f0d7c5 Add init_lock, and use it to protect against allocator initialization
races.  This isn't currently necessary for libpthread or libthr, but
without it external threads libraries like the linuxthreads port are
not safe to use.

Reported by:	ganbold@micom.mng.net
2006-04-04 19:46:28 +00:00
Jason Evans
1c6d5bde6c Refactor per-run bitmap manipulation functions so that bitmap offsets only
have to be calculated once per allocator operation.

Make nil const.

Update various comments.

Remove/avoid division where possible.

For the one division operation that remains in the critical path, add a
switch statement that has a case for each small size class, and do division
with a constant divisor in each case.  This allows the compiler to generate
optimized code that does not use hardware division [1].

Obtained from:	peter [1]
2006-04-04 03:51:47 +00:00
Poul-Henning Kamp
75239a017f Add missing #if's for NO_FLOATING_POINT 2006-04-01 19:06:54 +00:00
Hajimu UMEMOTO
3c3c80e4c8 fix indent. 2006-04-01 15:53:39 +00:00
Daniel Eischen
9fe1984e64 Add __gdtoa to the list of FreeBSD private symbols. Unfortunately,
this is used by some 3rd party applications when {e,f,g}cvt() are
not found.  POSIX defines the xcvt() funtions but says they are
deprecated in favor or sprintf().  We'll import these functions
from OpenBSD and remove __gdtoa() from the exported interfaces
when libc version is bumped.
2006-04-01 02:56:09 +00:00
Jason Evans
cd70100e5d Optimize runtime performance, primary using the following techniques:
* Avoid choosing an arena until it's certain that an arena is needed
    for allocation.

  * Convert division/multiplication to bitshifting where possible.

  * Avoid accessing TLS variables in single-threaded code.

  * Reduce the amount of pointer dereferencing.

  * Move lock acquisition in critical paths to only protect the the code
    that requires synchronization, and completely remove locking where
    possible.
2006-03-30 20:25:52 +00:00
Hajimu UMEMOTO
eb27a220f8 Expose res_update and friends again. At least, ports/mail/spamilter
uses them.
Now, we have res_nupdate and res_nmkupdate as well, but they are
still based on our old resolver for binary backward compatibility.
So, they don't provide new features such as TSIG support.

Reported by:	pointyhat via kris
2006-03-30 20:15:53 +00:00
Tom Rhodes
639dab2286 Fix a bug where, for 6-byte sequences, the top 6 bits get compared to
111111 rather than the top 7 bits being compared against 1111110 causing
illegal bytes fe and ff being treated the same as legal bytes fc and fd.
2006-03-30 09:04:12 +00:00
Daniel Eischen
4c6aab055d Add __collate_load_error and __collate_range_cmp to the list of
FBSDprivate locale symbols.  These functions are needed by
libcompat.

Add _cleanup to the list of stdio FBSDprivate symbols.  Some
third party applications use this.  This will be removed and
replaced by fcloseall() once libc version is bumped.

Add _res to the list of resolv symbols.

Found by:	portbuilder runs (thanks Kris!)
2006-03-30 04:37:08 +00:00
Jason Evans
6b2c15da6a Add malloc_usable_size(3).
Discussed with:		arch@
2006-03-28 22:16:04 +00:00
Dag-Erling Smørgrav
a0da77c91d Add semaphore functions, and remove some dupes from the #if 0 section. 2006-03-28 18:48:49 +00:00
Dag-Erling Smørgrav
23a8b7859b Add a bunch of missing pthread functions, and move out-of-order functions. 2006-03-28 16:41:06 +00:00
Hajimu UMEMOTO
1259a17acd If the query choked with EDNS0, retry without EDNS0.
Obtained from:	res_nquery() of BIND9.
2006-03-28 07:42:57 +00:00
David Xu
c0d2338cdd Allocate space for thread pointer, this allows thread library to access
its pointer from begin, and simplifies _get_curthread() in libthr.
2006-03-28 06:09:24 +00:00
Jason Evans
9f9bc9367c Allow the 'n' option to decrease the number of arenas below the default,
to as little as one arena.  Also, limit the number of arenas to avoid a
potential invariant violation in base_alloc().
2006-03-26 23:41:35 +00:00
Jason Evans
4328edf534 Add comments and reformat/rearrange code. There are no significant
functional changes in this commit.
2006-03-26 23:37:25 +00:00
Hajimu UMEMOTO
90d1d883e9 - Use ANSI C prototype.
- Remove trailing space.
2006-03-25 11:46:37 +00:00
Jason Evans
0c21f9eda7 Convert TINY_MIN_2POW from a cpp macro to tiny_min_2pow (a variable), and
determine its value at run time according to other relevant values.  This
avoids the creation of runs that are incompletely utilized, as long as
pagesize isn't too large (>32kB, given the current RUN_MIN_REGS_2POW
setting).

Increase the size of several structure bitfields in arena_run_t in order
to avoid integer overflow in the case that a run's header does not overlap
with the space that is usable as application allocation regions.  Given
the tiny_min_2pow change, this fix has no additional impact unless
pagesize is >32kB.

Reported by:	kris
2006-03-24 22:13:49 +00:00
Hajimu UMEMOTO
aebc6ec293 When res_nquerydomain() returns SERVFAIL, we should try next domain. 2006-03-24 13:30:10 +00:00
Hajimu UMEMOTO
d05ad2ab4d When res_send() fails, we should reserve an error code. 2006-03-24 04:49:30 +00:00
Jason Evans
efafcfa7fb Add USE_BRK-specific code in malloc_init_hard() to allow the first
internally used chunk to start at the beginning of the heap, rather
than at a chunk-aligned address.  This reduces mapped memory somewhat
for 32-bit architectures.

Add the arena_run_link_t type and use it wherever a run object is only
used as a ring 'header'.  This saves approximately 40 kB of memory per
arena.

Remove an obsolete (no longer used) code path from base_alloc(), which
supported the internal allocation of objects larger than the chunk
size.

Enhance chunk_dealloc() to cache chunk addresses for all deallocated
chunks.  This has no impact for most programs, but has the potential
to reduce VM map fragmentation for programs that use huge
allocations.
2006-03-24 00:28:08 +00:00
Peter Wemm
c8cd6b70e2 Document that the documented 2GB mmap limit is actually a
documentation bug.  We switched to page indexes some time around
FreeBSD 2.2.  The actual 'len' limit is the maximum file size or what
will fit in your address space, whichever comes first.  It should be
possible to make 1TB files on 32 bit systems, but of course address space
runs out long before then.
2006-03-23 23:37:06 +00:00
Dag-Erling Smørgrav
3a51513f8b It's not enough to provide symbol map files; you also have to add them
to ${SYM_MAPS}.  This unbreaks world with SYMVER_ENABLED.

Pointy hat to:	ume
2006-03-23 16:55:13 +00:00
Hajimu UMEMOTO
db01a0940f We have gmtime_r(3). 2006-03-21 18:31:24 +00:00
Hajimu UMEMOTO
5342d17f09 Update the resolver in libc to BIND9's one.
Since, res_sendsigned(3) and the friends use MD5 functions, it is
hard to include them without having MD5 functions in libc.  So,
res_sendsigned(3) is not merged into libc.

Since, res_update(3) in BIND9 is not binary compatible with our
res_update(3), res_update(3) is leaved as is, except some
necessary modifications.
The res_update(3) and the friends are not essential part of the
resolver.  They are not defined in resolv.h but defined in
res_update.h separately in BIND9.  Further, they are not called from
our tree.  So, I hide them from our resolv.h, but leave them only
for binary backward compatibility (perhaps, no one calls them).

Since, struct __res_state_ext is not exposed in BIND9, I hide it
from our resolv.h.  And, global variable _res_ext is removed.  It
breaks binary backward compatibility.  But, since it is not used from
outside of our libc, I think it is safe.

Reviewed by:	arch@ (no objection)
2006-03-21 16:11:11 +00:00
Hajimu UMEMOTO
ab96eeabe8 - Merge our local changes.
- Exclude unnecessary functions for us.
2006-03-21 15:37:16 +00:00
Hajimu UMEMOTO
73feb28508 Oops, remove the file I imported into wrong place. 2006-03-21 15:07:04 +00:00
Hajimu UMEMOTO
03970c5728 This commit was generated by cvs2svn to compensate for changes in r156954,
which included commits to RCS files with non-trunk default branches.
2006-03-21 15:07:04 +00:00
Hajimu UMEMOTO
65e96449c1 Vendor import of BIND 9.3.2 2006-03-21 15:03:19 +00:00
Hajimu UMEMOTO
29537ed89c This commit was generated by cvs2svn to compensate for changes in r156952,
which included commits to RCS files with non-trunk default branches.
2006-03-21 15:03:19 +00:00
Xin LI
f1fa5b4f51 When we are doing initialization against q, use its own size, not
the size of q2.  This should be a no-op because q and q2 are of
the same type.

Submitted by:	Alexey Dobriyan <adobriyan gmail com>
2006-03-21 12:39:29 +00:00
Jason Evans
c07ee180bc Separate completely full runs from runs that are merely almost full, so
that no linear searching is necessary if we resort to allocating from a
run that is known to be mostly full.  There are pathological edge cases
that could have caused severely degraded performance, and this change
fixes that.
2006-03-20 04:05:05 +00:00
Jason Evans
bd6a7799c4 Optimize realloc() to reallocate in place if the old and new sizes are
close enough to each other that reallocation would allocate a new region
of the same size.  This improves the performance of repeated incremental
reallocations by up to three orders of magnitude. [1]

Fix arena_new() to properly constrain run size if a small chunk size was
specified during runtime configuration.

Suggested by:	se [1]
2006-03-19 18:28:06 +00:00
Ruslan Ermilov
fcaa466865 Provide alternate default for SHLIBDIR before bsd.own.mk does this.
Reported by:	phk
2006-03-18 11:01:06 +00:00
Ruslan Ermilov
e1fe3dba5c Reimplementation of world/kernel build options. For details, see:
http://lists.freebsd.org/pipermail/freebsd-current/2006-March/061725.html

The src.conf(5) manpage is to follow in a few days.

Brought to you by:	imp, jhb, kris, phk, ru (all bugs are mine)
2006-03-17 18:54:44 +00:00
Jason Evans
2d07e432d4 Modify allocation policy, in order to avoid excessive fragmentation for
allocation patterns that involve a relatively even mixture of many
different size classes.

Reduce the chunk size from 16 MB to 2 MB.  Since chunks are now carved up
using an address-ordered first best fit policy, VM map fragmentation is
much less likely, which makes smaller chunks not as much of a risk.  This
reduces the virtual memory size of most applications.

Remove redzones, since program buffer overruns are no longer as likely to
corrupt malloc data structures.

Remove the C MALLOC_OPTIONS flag, and add H and S.
2006-03-17 09:00:27 +00:00
Daniel Eischen
96e022f7f3 Allow bsd.lib.mk to generate the symbol version map. 2006-03-16 15:16:23 +00:00
Ruslan Ermilov
d7ce16692e Fix comment. 2006-03-16 14:27:17 +00:00
Ruslan Ermilov
3029eff743 Desupport the undocumented NO_QUAD option, just don't compile
the quad support on 64-bit platforms.
2006-03-16 14:22:19 +00:00
Ruslan Ermilov
91545fccf9 Add a non-optional newline after ".Bx". 2006-03-15 14:45:45 +00:00
Andre Oppermann
7727f485de Revert previous changes as we do support the .Ox macro for OpenBSD.
Pointed out by:	ceri, ru, delphij
2006-03-15 14:05:41 +00:00
Andrey A. Chernov
7768950fe3 POSIXed strtoll() (and ours one too) can set errno to EINVAL, so check
it first.

Approved by:    andre
2006-03-14 19:53:03 +00:00
Andre Oppermann
b0b2326781 Fix HISTORY and point to OpenBSD. 2006-03-14 17:01:21 +00:00
Andre Oppermann
c74dfa2faf Import of OpenBSD's strtonum(3) which is a nicer version of strtoll(3)
providing proper error checking and other improvements.

Obtained from:	OpenBSD
Requested by:	flz (to port Open[BGP|OSPF]D)
MFC after:	3 days
2006-03-14 16:57:30 +00:00
Daniel Eischen
ed323e898c ns_name_skip was recently redefined to __ns_name_skip
like the others in <include/arpa/nameser.h>.

Submitted by:	ume
2006-03-13 04:49:40 +00:00
Daniel Eischen
e6f18831f2 Make _spinunlock() point to the spinunlock stub, not the
spinlock stub.
2006-03-13 01:17:39 +00:00
Daniel Eischen
6fad3aaf15 Add each directory's symbol map file to SYM_MAPS. 2006-03-13 01:15:01 +00:00
Daniel Eischen
c053f1f8ac Add hooks to build libc with symbol versioning. This is
disabled by default; add SYMVER_ENABLED=true to /etc/make.conf
to enable it.  libc should get a version bump before this is
enabled by default.

Reviewed by:	davidxu
2006-03-13 00:56:02 +00:00
Daniel Eischen
cce72e8860 Add symbol maps and initial symbol version definitions to libc.
Reviewed by:	davidxu
2006-03-13 00:53:21 +00:00
David Xu
764fc0fbfc Add entries for new pthread stubs. 2006-03-10 09:58:18 +00:00
David Xu
be957ba522 Remove mq.c, the POSIX mqueue is implemented in librt.
Suggested by: deischen
2006-03-08 23:42:41 +00:00
Daniel Eischen
f4cd2a5b5c Add some more pthread stubs so that librt can use them.
The thread jump table has been resorted, so you need to
keep libc, libpthread, and libthr in sync.

Submitted by:	xu
2006-03-05 18:10:28 +00:00
Christian Brueffer
f92b647c38 Remove a useless word.
PR:		94087
Submitted by:	Tadaaki Nagao <nagao@iij.ad.jp>
MFC after:	3 days
2006-03-05 10:32:15 +00:00
Jesus R. Camou
68dac191af Sync with actual code.
PR:		docs/87681
Noticed by:	Andreas Kohn <andreas@syndrom23.de>
Reviewed by:	brooks
Approved by:	trhodes (mentor)
MFC after:	3 days
2006-03-03 13:58:43 +00:00
Poul-Henning Kamp
981332f102 Fix the %Q printf extension to behave as expected 2006-03-02 08:53:45 +00:00
Hajimu UMEMOTO
3a0b3b6739 Handle the errors returned by res_querydomain() in same manner.
Reported by:	yar
Tested by:	yar, Rostislav Krasny <rosti.bsd__at__gmail.com>
MFC after:	1 week
2006-03-01 15:53:49 +00:00
David Xu
b8211fabf1 Disconnect mqueue from buildworld, as I will implement it in seperated
library.
2006-03-01 06:25:46 +00:00
Daniel Eischen
0411773be7 Const'ify arguments to a couple of functions to fix breakage
with -O2.
2006-02-28 16:02:26 +00:00
Xin LI
30b86e872b Don't do a time travel to 12006... 2006-02-28 07:36:25 +00:00
Daniel Eischen
235baf269e Staticize a couple of functions.
Remove a few unused locks.

Remove locks from application namespace.
2006-02-27 22:10:59 +00:00
Daniel Eischen
fc9ae54dca Correct a comment.
Staticize two tables thare are not visible in <resolv.h>
and which are also local in Solaris' libresolv.

Remove two functions that are not referenced in libc nor
anywhere else I can find, not visible in <resolv.h> and
which are also local in Solaris libresolv.
2006-02-27 22:08:16 +00:00
Wojciech A. Koszek
9d0e4617f3 Fix typo in manual page reference.
Approved by:	cognet (mentor)
MFC after:	3 days
2006-02-26 23:01:11 +00:00
Hajimu UMEMOTO
12d96fe63f Sync inet_net_pton() and inet_net_ntop() with latest BIND9's includes
an IPv6 support.

PR:		kern/93740
Submitted by:	Rudolf Cejka <cejkar__at__fit.vutbr.cz>
Obtained from:	BIND9
MFC after:	1 week
2006-02-26 05:44:21 +00:00
Hajimu UMEMOTO
5ecccefb4a - Just query 'as is', if there is a trailing dot in the name.
- Don't query 'as is' twice.

PR:		bin/62139
Reported by:	Rostislav Krasny <rosti.bsd__at__gmail.com>
Tested by:	Rostislav Krasny <rosti.bsd__at__gmail.com>
Obtained from:	BIND9 (with some modification)
MFC after:	1 week
2006-02-24 16:53:42 +00:00
Yaroslav Tykhiy
36ab780431 Tell the truth about a) how to get the first fileid, and
b) what return values from kldstat(2) can be expected.

Bump .Dd.

MFC after:	3 days
2006-02-22 15:11:12 +00:00
Brad Davis
209462832d - Massage wording to make it easier to understand and fix some grammar.
Submitted by:	sbahra at gwu dot edu
Reviewed by:	ru@
Approved by:	ceri@
MFC after:	3 days
2006-02-16 09:56:31 +00:00
Alexander Kabaev
129d4752a0 Remove extra slash from pty slave device name returned by ptsname. 2006-02-13 00:04:04 +00:00
Poul-Henning Kamp
8dcefe6112 Remove spurious "union arg" from printf.h
Make sure to always print something in the alternate time format.
2006-02-04 14:35:01 +00:00
Jason Evans
d8a1377b1b Fix calculation of the number of arenas to use on multi-processor systems. 2006-02-04 01:11:30 +00:00
Joel Dahl
fbf9b468d5 Expand contractions. 2006-02-01 14:33:14 +00:00
Poul-Henning Kamp
f0107b2c5d Add missing 's' suffix on alternate rendition of time. 2006-01-31 08:09:37 +00:00
Gleb Smirnoff
61fb9bd80c - In pipe() return the error returned by pipe_create(), rather then
hardcoded ENFILES, which is incorrect. pipe_create() can fail due
  to ENOMEM.
- Update manual page, describing ENOMEM return code.

Reviewed by:	arch
2006-01-30 08:25:04 +00:00
Olivier Houchard
9b1fa2482e If the sysctl kern.pts.enable doesn't exist, check that /dev/ptmx is there,
and if so, use the pts system.

Suggested by:	rwatson
2006-01-29 00:02:57 +00:00
Jason Evans
4fae5e8fda Remove unwarranted uses of 'goto'. 2006-01-27 07:46:22 +00:00
Jason Evans
a3d0ab47a6 Add NO_MALLOC_EXTRAS, so that various extra features that can cause
performance degradation can be disabled via something like the following
in /etc/malloc.conf:

	CFLAGS+=-DNO_MALLOC_EXTRAS

Suggested by:	deischen
2006-01-27 04:42:10 +00:00
Jason Evans
7138ef5b1d Fix the type of a statistics counter (unsigned --> unsigned long). 2006-01-27 04:36:39 +00:00
Jason Evans
842e5e3d91 Clean up statistics gathering and printing. 2006-01-27 02:36:44 +00:00
Pawel Jakub Dawidek
c3b878a8c6 Remove debug printf. 2006-01-26 11:15:08 +00:00
Jason Evans
499168546f Optimize arena_bin_pop() to reduce the number of separator operations.
Remove the block of code that tries to use delayed regions in LIFO order,
since from a policy perspective, it conflicts with LRU caching of newly
coalesced regions in arena_undelay().  There are numerous policy
alternatives, and it isn't readily obvious which (if any) is superior;
this change at least has the virtue of being consistent with policy.
2006-01-26 08:11:23 +00:00
Olivier Houchard
af09c34069 Make getttyent() report what the pts ptys as well. 2006-01-26 01:34:26 +00:00
Olivier Houchard
67c7201e18 ptsname() bits for pts. 2006-01-26 01:33:55 +00:00
Poul-Henning Kamp
6dbacee284 Make the %V{is} extension handle a NULL pointer like %s does: output "(null)"
Add %M{essage} extension which prints an errno value as the
corresponding string if possible or numerically otherwise.

It is not currently possible to do the syslog(3) like %m extension
because errno would need to get capatured on entry to the first
function in the printf family, so %M requires you to supply errno
as an argument.

Add %Q{uote} extension which will print a string in double quotes with
appropriate back-slash escapes (only) if necessary.
2006-01-25 12:45:24 +00:00
Jason Evans
0653ddb655 Remove a redundant variable assignment in arena_reg_frag_alloc(). 2006-01-25 05:41:02 +00:00
Jason Evans
b97aec1d61 If no coalesced exact-fit small regions are available, but delayed exact-
fit regions are available, use the delayed regions in LIFO order, in order
to increase locality of reference.  We might expect this to cause delayed
regions to be removed from the delay ring buffer more often (since we're
now re-using more recently buffered regions), but numerous tests indicate
that the overall impact on memory usage tends to be good (reduced
fragmentation).

Re-work arena_frag_reg_alloc() so that when large free regions are
exhausted, it uses small regions in a way that favors contiguous allocation
of sequentially allocated small regions.  Use arena_frag_reg_alloc() in
this capacity, rather than directly attempting over-fitting of small
requests when no large regions are available.

Remove the bin overfit statistic, since it is no longer relevant due to
the arena_frag_reg_alloc() changes.

Do not specify arena_frag_reg_alloc() as an inline function.  It is too
large to benefit much from being inlined, and it is also called in two
places, only one of which is in the critical path (the other call bloated
arena_reg_alloc()).

Call arena_coalesce() for a region before caching it with
arena_mru_cache().

Add assertions that detect the attempted caching of adjacent free regions,
so that we notice this problem when it is first created, rather than in
arena_coalesce(), when it's too late to know how the problem arose.

Reported by:    Hans Blancke
2006-01-25 04:21:22 +00:00
Jason Evans
ad4e4c676f Make the 'C' and 'c' malloc options consistent with other options; 'C'
doubles the cache size, and 'c' halves the cache size.
2006-01-23 03:32:38 +00:00
Jason Evans
5531d7fdc6 In arena_chunk_reg_alloc(), try to avoid touching the last page in the
chunk during initialization, in order to avoid physically backing the
page unless data are allocated there.
2006-01-23 03:19:01 +00:00
Don Lewis
3700c24576 Back out the previous change to rename.2. The previous rename()
behaviour of returning EINVAL when ".." is passed as either argument
has been restored.

rmdir("..") now returns EINVAL instead of EPERM.  Document the
previously undocumented behaviour of rmdir(".") returning EINVAL
as required by POSIX and SUSv3.  Bump the man page change date.

undelete("..") now returns EINVAL instead of EPERM.  Bump the man
page change date.

MFC after:	3 days
2006-01-22 19:49:37 +00:00
Don Lewis
af0c232ba6 rename(), rmdir(), and undelete() fail with EPERM if the last component
of the path is "..".

MFC after:	3 days
2006-01-21 20:45:45 +00:00
Jason Evans
677bc78b39 Use uintptr_t rather than size_t when casting pointers to integers. Also,
fix the few remaining casting style(9) errors that remained after the
functional change.

Reported by:	jmallett
2006-01-20 03:11:11 +00:00
Jason Evans
5d11758a9f Revert addtion of assertions in revision 1.99. These assertions cause
problems in cases where regions are faked up for the purposes of red-black
tree searches, since those faked region headers reside on the stack, rather
than in a malloc chunk.
2006-01-19 19:20:42 +00:00
Jason Evans
ea41be77ba Add assertions that detect some forms of region separator corruption. 2006-01-19 19:08:11 +00:00
Jason Evans
a3bb22bc8e Remove loops in arena_coalesce(). They are no longer necessary, now that
internal allocation does not rely on recursive arena use (base_arena was
removed in revision 1.95).
2006-01-19 18:37:30 +00:00
Jason Evans
a4922fdaf5 Make all internal variables and functions static.
Reported by:	ache
2006-01-19 07:23:13 +00:00
Jason Evans
2addd81287 Return NULL if there is an OOM error during initialization, rather than
allowing the error to be fatal.

Move a label in order to make sure to properly handle errors in malloc(0).

Reported by:	Alastair D'Silva, Saneto Takanori
2006-01-19 02:11:05 +00:00
Jason Evans
3842ca4db5 Add a separate simple internal base allocator and remove base_arena, so that
there is never any need to recursively call the main allocation functions.

Remove recursive spinlock support, since it is no longer needed.

Allow chunks to be as small as the page size.

Correctly propagate OOM errors from arena_new().
2006-01-16 05:13:49 +00:00
Marcel Moolenaar
707ca316b6 Define NO_TLS on ia64. The dynamic TLS implementation on ia64 is
broken for non-threaded shared processes in that __tls_get_addr()
assumes the thread pointer is always initialized. This is not the
case. When arenas_map is referenced in choose_arena() and it is
defined as a thread-local variable, it will result in a SIGSEGV.

PR: ia64/91846 (describes the TLS/ia64 bug).
2006-01-16 00:32:46 +00:00
Jason Evans
24b6d11c34 Replace malloc(), calloc(), posix_memalign(), realloc(), and free() with
a scalable concurrent allocator implementation.

Reviewed by:	current@
Approved by:	phk, markm (mentor)
2006-01-13 18:38:56 +00:00
Jason Evans
352219015d Fix a bitwise logic error in posix_memalign().
Reported by:	glebius
2006-01-12 18:09:25 +00:00
Jason Evans
43326ef72b Use posix_memalign() in valloc() rather than making assumptions about
the alignment of malloc()ed memory.

Approved by:	markm (mentor)
2006-01-12 09:29:38 +00:00
Jason Evans
52828c0e9c In preparation for a new malloc implementation:
* Add posix_memalign().

  * Move calloc() from calloc.c to malloc.c.  Add a calloc() implementation in
    rtld-elf in order to make the loader happy (even though calloc() isn't
    used in rtld-elf).

  * Add _malloc_prefork() and _malloc_postfork(), and use them instead of
    directly manipulating __malloc_lock.

Approved by:	phk, markm (mentor)
2006-01-12 07:28:21 +00:00
Ceri Davies
a3df483296 I wrote getnetconfig where I meant getnetpath in the previous revision. 2006-01-11 13:57:15 +00:00
Greg Lehey
3b4c974228 Add references to fhopen, fhstat, getfh, lgetfh and fhstatfs.
Pointed out by: Antony Curtis <antony@mysql.com>
2006-01-10 23:24:47 +00:00
Ceri Davies
1e1e1fce56 o Document the possibility of putting 'b' in the flag field.
While we don't use the NC_BROADCAST value of nc_flag anywhere in the
  RPC code, it is parseable by getnetconfigent(3) from /etc/netconfig.

o Clean up some "see below"'s that were cut and pasted from netconfig.h.
2006-01-06 19:39:16 +00:00
Diomidis Spinellis
79a7950c48 Document the recently-added EINVAL behavior.
MFC after:	1 week
2006-01-05 08:55:56 +00:00
Peter Grehan
ec9cc1fc12 gmon now supported on powerpc 2005-12-29 04:10:52 +00:00
Peter Grehan
7d65909eed The minbrk symbol is hidden the same on powerpc as other FreeBSD platforms. 2005-12-29 04:09:38 +00:00
Tom Rhodes
257551c6a0 Add a64l(), l64a(), and l64a_r() XSI extentions. These functions convert
between a 32-bit integer and a radix-64 ASCII string.  The l64a_r() function
is a NetBSD addition.

PR:		51209 (based on submission, but very different)
Reviewed by:	bde, ru
2005-12-24 22:37:59 +00:00
Poul-Henning Kamp
4c13606d1e Add abort2 manual page.
Submitted by:	"Wojciech A. Koszek" <dunstan@freebsd.czest.pl>
Edited by:	phk
2005-12-23 12:27:42 +00:00
Olivier Houchard
80c276c1f5 Explicitely use a "signed char" instead of a "char", for those archs where
char defaults to unsigned.
2005-12-22 14:23:54 +00:00
Alexander Kabaev
0eb88f2029 Implement ELF symbol versioning using GNU semantics. This code aims
to be compatible with symbol versioning support as implemented by
GNU libc and documented by http://people.redhat.com/~drepper/symbol-versioning
and LSB 3.0.

Implement dlvsym() function to allow lookups for a specific version of
a given symbol.
2005-12-18 19:43:33 +00:00
Marcel Moolenaar
757686b115 Make our ELF64 type definitions match standards. In particular this
means:
o  Remove Elf64_Quarter,
o  Redefine Elf64_Half to be 16-bit,
o  Redefine Elf64_Word to be 32-bit,
o  Add Elf64_Xword and Elf64_Sxword for 64-bit entities,
o  Use Elf_Size in MI code to abstract the difference between
   Elf32_Word and Elf64_Word.
o  Add Elf_Ssize as the signed counterpart of Elf_Size.

MFC after: 2 weeks
2005-12-18 04:52:37 +00:00
Poul-Henning Kamp
75067f4f70 Add an extensible version of our *printf(3) implementation to libc
on probationary terms:  it may go away again if it transpires it is
a bad idea.

This extensible printf version will only be used if either
    environment variable USE_XPRINTF is defined
or
    one of the extension functions are called.
or
    the global variable __use_xprintf is set greater than zero.

In all other cases our traditional printf implementation will
be used.

The extensible version is slower than the default printf, mostly
because less opportunity for combining I/O operation exists when
faced with extensions.  The default printf on the other hand
is a bad case of spaghetti code.

The extension API has a GLIBC compatible part and a FreeBSD version
of same.  The FreeBSD version exists because the GLIBC version may
run afoul of our FILE * locking in multithreaded programs and it
even further eliminate the opportunities for combining I/O operations.

Include three demo extensions which can be enabled if desired: time
(%T), hexdump (%H) and strvis (%V).

%T can format time_t (%T), struct timeval (%lT) and struct timespec (%llT)
   in one of two human readable duration formats:
	"%.3llT" -> "20349.245"
	"%#.3llT" -> "5h39m9.245"

%H will hexdump a sequence of bytes and takes a pointer and a length
   argument.  The width specifies number of bytes per line.
	"%4H" -> "65 72 20 65"
	"%+4H" -> "0000 65 72 20 65"
	"%#4H" -> "65 72 20 65  |er e|"
	"%+#4H" -> "0000 65 72 20 65  |er e|"

%V will dump a string in strvis format.
	"%V" -> "Hello\tWor\377ld"	(C-style)
	"%0V" -> "Hello\011Wor\377ld"	(octal)
	"%+V" -> "Hello%09Wor%FFld"	(http-style)

Tests, comments, bugreports etc are most welcome.
2005-12-16 18:56:39 +00:00
David Xu
3b52e4d1b7 With current pthread implementations, a mutex initialization will
allocate a memory block. sscanf calls __svfscanf which in turn calls
fread, fread triggers mutex initialization but the mutex is not
destroyed in sscanf, this leads to memory leak. To avoid the memory
leak and performance issue, we create a none MT-safe version of fread:
__fread, and instead let __svfscanf call __fread.

PR: threads/90392
Patch submitted by: dhartmei
MFC after: 7 days
2005-12-16 02:50:53 +00:00
David Xu
412295fdbd Sort .Xr by section number.
Submitted by: ru
2005-12-13 13:43:35 +00:00
Poul-Henning Kamp
b384108ed6 /* You're not supposed to hit this problem */
For some denormalized long double values, a bug in __hldtoa() (called
from *printf()'s %A format) results in a base 16 digit being rounded
up from 0xf to 0x10.

When this digit is subsequently converted to string format, an index
of 10 reaches past the end of the uppper-case hex/char array, picking
up whatever the code segment happen to contain at that address.

This mostly seem to be some character from the upper half of the
byte range.

When using the %a format instead of %A, the first character past
the end of the lowercase hex/char table happens to be index 0 in
the uppercase hex/char table hextable and therefore the string
representation features a '0', which is supposedly correct.

This leads me to belive that the proper fix _may_ be as simple as
masking all but the lower four bits off after incrementing a hex-digit
in libc/gdtoa/_hdtoa.c:roundup().  I worry however that the upper
bit in 0x10 indicates a carry not carried.

Until das@ or bde@ finds time to visit this issue, extend the
hexdigit arrays with a 17th index containing '?' so that we get a
invalid but consistent and printable output in both %a and %A formats
whenever this bug strikes.

This unmasks the bug in the %a format therefore solving the real
issue may both become easier and more urgent.

Possibly related to:	PR 85080
With help by:		bde@
2005-12-13 13:23:27 +00:00
David Xu
e9e7495667 Add cross references to siginfo.3. 2005-12-13 03:05:58 +00:00
David Xu
f2a77c2a7c Fix markeup.
Submitted by: ru
2005-12-06 09:52:54 +00:00
David Xu
52cf88e2ef Fix markup.
Submitted by: ru
2005-12-05 09:31:49 +00:00
David Xu
8c1e5ef215 Document SIGEV_NONE and SIGEV_SIGNAL. 2005-12-05 04:44:39 +00:00