Commit Graph

5204 Commits

Author SHA1 Message Date
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
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
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
Hajimu UMEMOTO
65e96449c1 Vendor import of BIND 9.3.2 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