summaryrefslogtreecommitdiffstats
path: root/lib/libc
Commit message (Collapse)AuthorAgeFilesLines
* Remove some now-unused macros.jhb2008-01-151-3/+1
| | | | MFC after: 1 week
* Put back the openpty(3) and ptsname(3) fixes but don't disable ptsname(3)jhb2008-01-151-46/+31
| | | | | on pts(4) devices this time. This fixes the issues while leaving pts(4) enabled on HEAD.
* Back out last commit, since it accidentally broke pts.cperciva2008-01-151-37/+48
| | | | | The security fix will be re-committed soon, hopefully without breaking anything.
* In getttyent(3), if /etc/ttys doesn't end in a newline, don'tdas2008-01-151-1/+1
| | | | | | | freak out and keep trying to expand the buffer until realloc() fails. PR: 114398
* Fix issues which allow snooping on ptys. [08:01]cperciva2008-01-142-50/+39
| | | | | | | Fix an off-by-one error in inet_network(3). [08:02] Security: FreeBSD-SA-08:01.pty Security: FreeBSD-SA-08:02.libc
* Changing 'r' to a size_t in the previous commit turned quicksortdas2008-01-141-4/+5
| | | | | | | into slowsort for some sequences because different parts of the code used 'r' to store two different things, one of which was signed. Clean things up by splitting 'r' into two variables, and use a more meaningful name.
* Use size_t to avoid overflow when sorting arrays larger than 2 GB.das2008-01-132-2/+3
| | | | | PR: 111085 MFC after: 2 weeks
* Add a feature_present(3) function which checks to see if a named kerneljhb2008-01-103-2/+137
| | | | | | feature is present by checking the kern.features sysctl MIB. MFC after: 1 week
* Add a new file descriptor type for IPC shared memory objects and use it tojhb2008-01-085-335/+161
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | implement shm_open(2) and shm_unlink(2) in the kernel: - Each shared memory file descriptor is associated with a swap-backed vm object which provides the backing store. Each descriptor starts off with a size of zero, but the size can be altered via ftruncate(2). The shared memory file descriptors also support fstat(2). read(2), write(2), ioctl(2), select(2), poll(2), and kevent(2) are not supported on shared memory file descriptors. - shm_open(2) and shm_unlink(2) are now implemented as system calls that manage shared memory file descriptors. The virtual namespace that maps pathnames to shared memory file descriptors is implemented as a hash table where the hash key is generated via the 32-bit Fowler/Noll/Vo hash of the pathname. - As an extension, the constant 'SHM_ANON' may be specified in place of the path argument to shm_open(2). In this case, an unnamed shared memory file descriptor will be created similar to the IPC_PRIVATE key for shmget(2). Note that the shared memory object can still be shared among processes by sharing the file descriptor via fork(2) or sendmsg(2), but it is unnamed. This effectively serves to implement the getmemfd() idea bandied about the lists several times over the years. - The backing store for shared memory file descriptors are garbage collected when they are not referenced by any open file descriptors or the shm_open(2) virtual namespace. Submitted by: dillon, peter (previous versions) Submitted by: rwatson (I based this on his version) Reviewed by: alc (suggested converting getmemfd() to shm_open())
* Enable both sbrk(2)- and mmap(2)-based memory acquisition methods byjasone2008-01-032-19/+20
| | | | | | | | | default. This has the disadvantage of rendering the datasize resource limit irrelevant, but without this change, legitimate uses of more memory than will fit in the data segment are thwarted by default. Fix chunk_alloc_mmap() to work correctly if initial mapping is not chunk-aligned and mapping extension fails.
* Fix a major chunk-related memory leak in chunk_dealloc_dss_record(). [1]jasone2007-12-311-65/+56
| | | | | | | | Clean up DSS-related locking and protect all pertinent variables with dss_mtx (remove dss_chunks_mtx). This fixes race conditions that could cause chunk leaks. Reported by: [1] kris
* Fix a bug related to sbrk() calls that could cause address space leaks.jasone2007-12-311-186/+268
| | | | | | | | | | | | | | | | | | | | | | | | | This is a long-standing bug, but until recent changes it was difficult to trigger, and even then its impact was non-catastrophic, with the exception of revision 1.157. Optimize chunk_alloc_mmap() to avoid the need for unmapping pages in the common case. Thanks go to Kris Kennaway for a patch that inspired this change. Do not maintain a record of previously mmap'ed chunk address ranges. The original intent was to avoid the extra system call overhead in chunk_alloc_mmap(), which is no longer a concern. This also allows some simplifications for the tree of unused DSS chunks. Introduce huge_mtx and dss_chunks_mtx to replace chunks_mtx. There was no compelling reason to use the same mutex for these disjoint purposes. Avoid memset() for huge allocations when possible. Maintain two trees instead of one for tracking unused DSS address ranges. This allows scalable allocation of multi-chunk huge objects in the DSS. Previously, multi-chunk huge allocation requests failed if the DSS could not be extended.
* Back out premature commit of previous version.jasone2007-12-281-183/+113
|
* Maintain two trees instead of one (old_chunks --> old_chunks_{ad,szad}) injasone2007-12-281-113/+183
| | | | | | | | | order to support re-use of multi-chunk unused regions within the DSS for huge allocations. This generalization is important to correct function when mmap-based allocation is disabled. Avoid zeroing re-used memory in the DSS unless it really needs to be zeroed.
* Release chunks_mtx for all paths through chunk_dealloc().jasone2007-12-281-1/+4
| | | | Reported by: kris
* Add the 'D' and 'M' run time options, and use them to control whetherjasone2007-12-272-315/+492
| | | | | | | | | | | | | | | | | | memory is acquired from the system via sbrk(2) and/or mmap(2). By default, use sbrk(2) only, in order to support traditional use of resource limits. Additionally, when both options are enabled, prefer the data segment to anonymous mappings, in order to coexist better with large file mappings in applications on 32-bit platforms. This change has the potential to increase memory fragmentation due to the linear nature of the data segment, but from a performance perspective this is mitigated by the use of madvise(2). [1] Add the ability to interpret integer prefixes in MALLOC_OPTIONS processing. For example, MALLOC_OPTIONS=lllllllll can now be specified as MALLOC_OPTIONS=9l. Reported by: [1] rwatson Design review: [1] alc, peter, rwatson
* Fix a typo in regards to the ENOENT error.jhb2007-12-271-1/+1
| | | | | | PR: docs/118929 Submitted by: mymtom of hotmail MFC after: 3 days
* Clean up some of the pts(4) vs pty(4) stuff in grantpt(3) and friends:jhb2007-12-211-22/+23
| | | | | | | | | | - Use PTY* for all pty(4) related constants. - Use PTMX* for all pts(4) related constants. - Consistently use _PATH_DEV PTMX rather than "/dev/ptmx". - Revert 1.7 and properly fix it by using the correct prefix string for pts(4) masters. MFC after: 3 days
* Reduce lock contention for simple cases.imp2007-12-191-16/+22
| | | | | | # this really should be done with pthread_once, but I've debugged this code. Reviewed by: arch@
* Add note about other systems.imp2007-12-191-0/+3
|
* Move all the xprintf-related symbols to FBSDprivate_1.0.das2007-12-181-9/+13
| | | | Discussed with: deischen, kan, phk
* Since nan() is supposed to work the same as strtod("nan(...)", NULL),das2007-12-184-12/+0
| | | | | | | | | | | | my original implementation made both use the same code. Unfortunately, this meant libm depended on a vendor header at compile time and previously- unexposed vendor bits in libc at runtime. Hence, I just wrote my own version of the relevant vendor routine. As it turns out, mine has a factor of 8 fewer of lines of code, and is a bit more readable anyway. The strtod() and *scanf() routines still use vendor code. Reviewed by: bde
* Use fixed point integer math instead of floating point math whenjasone2007-12-181-42/+47
| | | | | | | | | | calculating run sizes. Use of the floating point unit was a potential pessimization to context switching for applications that do not otherwise use floating point math. [1] Reformat cpp macro-related comments to improve consistency. Submitted by: das
* Catch up with vfprintf.c,v 1.77.das2007-12-181-0/+1
|
* Moved logging out of the nss_method_lookup() in order not tobushman2007-12-171-9/+13
| | | | flood logs with failed fallback method lookup attempts.
* Refactor features a bit in order to make it possible to disable lazyjasone2007-12-171-52/+127
| | | | | | | | | deallocation and dynamic load balancing via the MALLOC_LAZY_FREE and MALLOC_BALANCE knobs. This is a non-functional change, since these features are still enabled when possible. Clean up a few things that more pedantic compiler settings would cause complaints over.
* Implement and document nan(), nanf(), and nanl(). This commitdas2007-12-161-4/+23
| | | | | | | adds two new directories in msun: ld80 and ld128. These are for long double functions specific to the 80-bit long double format used on x86-derived architectures, and the 128-bit format used on sparc64, respectively.
* Export gdtoa's __ULto{x,Q}_D2A routine in a private namespace sodas2007-12-165-0/+17
| | | | libm can use it.
* Arrange so that the NaN returned by strtod("nan", NULL) is the same asdas2007-12-165-27/+27
| | | | the NaN returned by strtod("nan()", NULL).
* Increment the version namespace for 8.0-current. New symbols anddeischen2007-12-141-0/+5
| | | | symbols whose ABI has changed should be added to FBSD_1.1.
* Update posix_openpt(3) to handle 512 ptys. This was missed in the earlierjhb2007-12-131-2/+2
| | | | | | pty(4) changes. MFC after: 3 days
* Remove license clause 3 to agree with the now-standard BSD license.wes2007-12-123-14/+0
| | | | Prompted by: Glenn Halperin, Symbian Software
* Implementing 'fallback' nsswitch source. 'fallback' source is usedbushman2007-12-123-116/+220
| | | | | | | | | | | | when particular function can't be found in nsswitch-module. For example, getgrouplist(3) will use module-supplied 'getgroupmembership' function (which can work in an optimal way for such source as LDAP) and will fall back to the stanard iterate-through-all-groups implementation otherwise. PR: ports/114655 Submitted by: Michael Hanselmann <freebsd AT hansmi DOT ch> Reviewed by: brooks (mentor)
* Remove 3rd clause of licensephantom2007-12-121-4/+0
| | | | Per request of: glenn halperin at symbian.com
* Fix typo in the commentache2007-12-111-1/+1
|
* Remove some test instrumentation. (The Symbol.map changes broke it anyway.)das2007-12-092-8/+0
|
* Fix handling of subnormals on i386/ia64/amd64.das2007-12-091-2/+0
| | | | PR: 85080
* Make the warning a bit less 'broad' then it used to be. The accessremko2007-12-081-1/+10
| | | | | | | | | is seems to be a problem for SUID applications, which we like to prevent as much as possible. PR: docs/39530 Submitted by: Soren Spies <sspies at apple dot com> MFC After: 3 days
* Merge BIND 9.4.2 into main chunk.ume2007-12-032-18/+25
|
* This commit was generated by cvs2svn to compensate for changes in r174223,ume2007-12-031-2/+2
|\ | | | | | | which included commits to RCS files with non-trunk default branches.
| * Vendor import of BIND 9.4.2ume2007-12-033-21/+32
| |
| * Vendor import of BIND 9.4.1ume2007-06-031-2/+7
| |
* | Since jb@ fixed the type of dd_lock in <dirent.h>, these casts are nodes2007-12-034-11/+11
| | | | | | | | longer required.
* | In scanf, round according to the current rounding mode.das2007-12-037-8/+20
| |
* | Only zero large allocations when necessary (for calloc()).jasone2007-11-281-1/+1
| |
* | Add _pthread_mutex_init_calloc_cb to libc's map, for which malloc definesjasone2007-11-271-0/+1
| | | | | | | | a stub.
* | Document the B and L MALLOC_OPTIONS.jasone2007-11-271-1/+26
| |
* | Implement dynamic load balancing of thread-->arena mapping, based on lockjasone2007-11-271-58/+297
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | contention. The intent is to dynamically adjust to load imbalances, which can cause severe contention. Use pthread mutexes where possible instead of libc "spinlocks" (they aren't actually spin locks). Conceptually, this change is meant only to support the dynamic load balancing code by enabling the use of spin locks, but it has the added apparent benefit of substantially improving performance due to reduced context switches when there is moderate arena lock contention. Proper tuning parameter configuration for this change is a finicky business, and it is very much machine-dependent. One seemingly promising solution would be to run a tuning program during operating system installation that computes appropriate settings for load balancing. (The pthreads adaptive spin locks should probably be similarly tuned.)
* | Implement lazy deallocation of small objects. For each arena, maintain ajasone2007-11-271-0/+218
| | | | | | | | | | | | | | | | | | | | | | vector of slots for lazily freed objects. For each deallocation, before doing the hard work of locking the arena and deallocating, try several times to randomly insert the object into the vector using atomic operations. This approach is particularly effective at reducing contention for multi-threaded applications that use the producer-consumer model, wherein one producer thread allocates objects, then multiple consumer threads deallocate those objects.
* | Avoid re-zeroing memory in calloc() when possible.jasone2007-11-271-143/+218
| |
OpenPOWER on IntegriCloud