summaryrefslogtreecommitdiff
path: root/lib/libc
Commit message (Collapse)AuthorAgeFilesLines
* - In pipe() return the error returned by pipe_create(), rather thenGleb Smirnoff2006-01-301-1/+3
| | | | | | | | | | | hardcoded ENFILES, which is incorrect. pipe_create() can fail due to ENOMEM. - Update manual page, describing ENOMEM return code. Reviewed by: arch Notes: svn path=/head/; revision=155035
* If the sysctl kern.pts.enable doesn't exist, check that /dev/ptmx is there,Olivier Houchard2006-01-291-2/+7
| | | | | | | | | and if so, use the pts system. Suggested by: rwatson Notes: svn path=/head/; revision=154965
* Remove unwarranted uses of 'goto'.Jason Evans2006-01-271-203/+153
| | | | Notes: svn path=/head/; revision=154890
* Add NO_MALLOC_EXTRAS, so that various extra features that can causeJason Evans2006-01-271-3/+16
| | | | | | | | | | | | performance degradation can be disabled via something like the following in /etc/malloc.conf: CFLAGS+=-DNO_MALLOC_EXTRAS Suggested by: deischen Notes: svn path=/head/; revision=154887
* Fix the type of a statistics counter (unsigned --> unsigned long).Jason Evans2006-01-271-1/+1
| | | | Notes: svn path=/head/; revision=154886
* Clean up statistics gathering and printing.Jason Evans2006-01-271-71/+64
| | | | Notes: svn path=/head/; revision=154882
* Remove debug printf.Pawel Jakub Dawidek2006-01-261-1/+0
| | | | Notes: svn path=/head/; revision=154857
* Optimize arena_bin_pop() to reduce the number of separator operations.Jason Evans2006-01-261-13/+10
| | | | | | | | | | | 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. Notes: svn path=/head/; revision=154853
* Make getttyent() report what the pts ptys as well.Olivier Houchard2006-01-261-1/+38
| | | | Notes: svn path=/head/; revision=154838
* ptsname() bits for pts.Olivier Houchard2006-01-261-5/+45
| | | | Notes: svn path=/head/; revision=154836
* Make the %V{is} extension handle a NULL pointer like %s does: output "(null)"Poul-Henning Kamp2006-01-255-1/+187
| | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=154815
* Remove a redundant variable assignment in arena_reg_frag_alloc().Jason Evans2006-01-251-1/+0
| | | | Notes: svn path=/head/; revision=154798
* If no coalesced exact-fit small regions are available, but delayed exact-Jason Evans2006-01-251-173/+186
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=154797
* Make the 'C' and 'c' malloc options consistent with other options; 'C'Jason Evans2006-01-231-2/+2
| | | | | | | doubles the cache size, and 'c' halves the cache size. Notes: svn path=/head/; revision=154700
* In arena_chunk_reg_alloc(), try to avoid touching the last page in theJason Evans2006-01-231-7/+24
| | | | | | | | chunk during initialization, in order to avoid physically backing the page unless data are allocated there. Notes: svn path=/head/; revision=154699
* Back out the previous change to rename.2. The previous rename()Don Lewis2006-01-223-9/+8
| | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=154691
* rename(), rmdir(), and undelete() fail with EPERM if the last componentDon Lewis2006-01-213-0/+9
| | | | | | | | | of the path is "..". MFC after: 3 days Notes: svn path=/head/; revision=154655
* Use uintptr_t rather than size_t when casting pointers to integers. Also,Jason Evans2006-01-201-44/+45
| | | | | | | | | | fix the few remaining casting style(9) errors that remained after the functional change. Reported by: jmallett Notes: svn path=/head/; revision=154562
* Revert addtion of assertions in revision 1.99. These assertions causeJason Evans2006-01-191-7/+0
| | | | | | | | | 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. Notes: svn path=/head/; revision=154557
* Add assertions that detect some forms of region separator corruption.Jason Evans2006-01-191-0/+7
| | | | Notes: svn path=/head/; revision=154556
* Remove loops in arena_coalesce(). They are no longer necessary, now thatJason Evans2006-01-191-4/+5
| | | | | | | | internal allocation does not rely on recursive arena use (base_arena was removed in revision 1.95). Notes: svn path=/head/; revision=154555
* Make all internal variables and functions static.Jason Evans2006-01-191-12/+15
| | | | | | | Reported by: ache Notes: svn path=/head/; revision=154549
* Return NULL if there is an OOM error during initialization, rather thanJason Evans2006-01-191-35/+50
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=154546
* Add a separate simple internal base allocator and remove base_arena, so thatJason Evans2006-01-161-151/+175
| | | | | | | | | | | | | 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(). Notes: svn path=/head/; revision=154421
* Define NO_TLS on ia64. The dynamic TLS implementation on ia64 isMarcel Moolenaar2006-01-161-0/+1
| | | | | | | | | | | | 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). Notes: svn path=/head/; revision=154415
* Replace malloc(), calloc(), posix_memalign(), realloc(), and free() withJason Evans2006-01-132-1107/+4597
| | | | | | | | | | a scalable concurrent allocator implementation. Reviewed by: current@ Approved by: phk, markm (mentor) Notes: svn path=/head/; revision=154306
* Fix a bitwise logic error in posix_memalign().Jason Evans2006-01-121-2/+2
| | | | | | | Reported by: glebius Notes: svn path=/head/; revision=154263
* Use posix_memalign() in valloc() rather than making assumptions aboutJason Evans2006-01-122-20/+20
| | | | | | | | | the alignment of malloc()ed memory. Approved by: markm (mentor) Notes: svn path=/head/; revision=154252
* In preparation for a new malloc implementation:Jason Evans2006-01-125-66/+160
| | | | | | | | | | | | | | | | * 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) Notes: svn path=/head/; revision=154248
* I wrote getnetconfig where I meant getnetpath in the previous revision.Ceri Davies2006-01-111-2/+2
| | | | Notes: svn path=/head/; revision=154224
* Add references to fhopen, fhstat, getfh, lgetfh and fhstatfs.Greg Lehey2006-01-103-0/+6
| | | | | | | Pointed out by: Antony Curtis <antony@mysql.com> Notes: svn path=/head/; revision=154202
* o Document the possibility of putting 'b' in the flag field.Ceri Davies2006-01-061-5/+11
| | | | | | | | | | 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. Notes: svn path=/head/; revision=154080
* Document the recently-added EINVAL behavior.Diomidis Spinellis2006-01-051-1/+7
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=154050
* gmon now supported on powerpcPeter Grehan2005-12-291-2/+0
| | | | Notes: svn path=/head/; revision=153815
* The minbrk symbol is hidden the same on powerpc as other FreeBSD platforms.Peter Grehan2005-12-291-1/+1
| | | | Notes: svn path=/head/; revision=153814
* Add a64l(), l64a(), and l64a_r() XSI extentions. These functions convertTom Rhodes2005-12-244-5/+290
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=153707
* Add abort2 manual page.Poul-Henning Kamp2005-12-232-1/+100
| | | | | | | | Submitted by: "Wojciech A. Koszek" <dunstan@freebsd.czest.pl> Edited by: phk Notes: svn path=/head/; revision=153683
* Explicitely use a "signed char" instead of a "char", for those archs whereOlivier Houchard2005-12-221-2/+2
| | | | | | | char defaults to unsigned. Notes: svn path=/head/; revision=153641
* Implement ELF symbol versioning using GNU semantics. This code aimsAlexander Kabaev2005-12-181-0/+9
| | | | | | | | | | | | 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. Notes: svn path=/head/; revision=153515
* Make our ELF64 type definitions match standards. In particular thisMarcel Moolenaar2005-12-181-3/+3
| | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=153504
* Add an extensible version of our *printf(3) implementation to libcPoul-Henning Kamp2005-12-169-0/+2054
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=153486
* With current pthread implementations, a mutex initialization willDavid Xu2005-12-163-9/+19
| | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=153467
* Sort .Xr by section number.David Xu2005-12-138-14/+14
| | | | | | | Submitted by: ru Notes: svn path=/head/; revision=153376
* /* You're not supposed to hit this problem */Poul-Henning Kamp2005-12-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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@ Notes: svn path=/head/; revision=153375
* Add cross references to siginfo.3.David Xu2005-12-1310-3/+13
| | | | Notes: svn path=/head/; revision=153370
* Fix markeup.David Xu2005-12-061-1/+2
| | | | | | | Submitted by: ru Notes: svn path=/head/; revision=153161
* Fix markup.David Xu2005-12-051-5/+13
| | | | | | | Submitted by: ru Notes: svn path=/head/; revision=153109
* Document SIGEV_NONE and SIGEV_SIGNAL.David Xu2005-12-051-0/+15
| | | | Notes: svn path=/head/; revision=153101
* Fix prototype.Ruslan Ermilov2005-12-031-1/+1
| | | | Notes: svn path=/head/; revision=153048
* Fix type of argument.Ruslan Ermilov2005-12-031-1/+1
| | | | Notes: svn path=/head/; revision=153047