summaryrefslogtreecommitdiff
path: root/include/limits.h
AgeCommit message (Collapse)AuthorFilesLines
2013-04-04eliminate gcc dependency for testing char signedness in limits.hRich Felker1-1/+1
2013-02-01pthread stack treatment overhaul for application-provided stacks, etc.Rich Felker1-2/+2
the main goal of these changes is to address the case where an application provides a stack of size N, but TLS has size M that's a significant portion of the size N (or even larger than N), thus giving the application less stack space than it expected or no stack at all! the new strategy pthread_create now uses is to only put TLS on the application-provided stack if TLS is smaller than 1/8 of the stack size or 2k, whichever is smaller. this ensures that the application always has "close enough" to what it requested, and the threshold is chosen heuristically to make sure "sane" amounts of TLS still end up in the application-provided stack. if TLS does not fit the above criteria, pthread_create uses mmap to obtain space for TLS, but still uses the application-provided stack for actual call frame stack. this is to avoid wasting memory, and for the sake of supporting ugly hacks like garbage collection based on assumptions that the implementation will use the provided stack range. in order for the above heuristics to ever succeed, the amount of TLS space wasted on POSIX TSD (pthread_key_create based) needed to be reduced. otherwise, these changes would preclude any use of pthread_create without mmap, which would have serious memory usage and performance costs for applications trying to create huge numbers of threads using pre-allocated stack space. the new value of PTHREAD_KEYS_MAX is the minimum allowed by POSIX, 128. this should still be plenty more than real-world applications need, especially now that C11/gcc-style TLS is now supported in musl, and most apps and libraries choose to use that instead of POSIX TSD when available. at the same time, PTHREAD_STACK_MIN has been decreased. it was originally set to PAGE_SIZE back when there was no support for TLS or application-provided stacks, and requests smaller than a whole page did not make sense. now, there are two good reasons to support requests smaller than a page: (1) applications could provide pre-allocated stacks smaller than a page, and (2) with smaller stack sizes, stack+TLS+TSD can all fit in one page, making it possible for applications which need huge numbers of threads with minimal stack needs to allocate exactly one page per thread. the new value of PTHREAD_STACK_MIN, 2k, is aligned with the minimum size for sigaltstack.
2012-11-26fix missing limits when only _BSD_SOURCE is definedRich Felker1-1/+1
the missing check did not affect the default profile, since it has both _XOPEN_SOURCE and _BSD_SOURCE defined, but it did break programs which explicitly define _BSD_SOURCE, causing it to be the only feature test macro present.
2012-09-07default features: make musl usable without feature test macrosRich Felker1-0/+2
the old behavior of exposing nothing except plain ISO C can be obtained by defining __STRICT_ANSI__ or using a compiler option (such as -std=c99) that predefines it. the new default featureset is POSIX with XSI plus _BSD_SOURCE. any explicit feature test macros will inhibit the default. installation docs have also been updated to reflect this change.
2012-05-14missing limit LOGIN_NAME_MAXRich Felker1-0/+1
2012-03-20limits.h: support gcc's -funsigned-charRich Felker1-2/+10
some software apparently uses this and breaks with musl due to mismatching definitions...
2011-06-25move all limits that don't vary out of bits/limits.h, into main limits.hRich Felker1-0/+22
2011-06-07define MQ_PRIO_MAXRich Felker1-0/+1
2011-03-29implement POSIX timersRich Felker1-0/+1
this implementation is superior to the glibc/nptl implementation, in that it gives true realtime behavior. there is no risk of timer expiration events being lost due to failed thread creation or failed malloc, because the thread is created as time creation time, and reused until the timer is deleted.
2011-03-10fix sem_open and sem_close to obey posix semanticsRich Felker1-0/+1
multiple opens of the same named semaphore must return the same pointer, and only the last close can unmap it. thus the ugly global state keeping track of mappings. the maximum number of distinct named semaphores that can be opened is limited sufficiently small that the linear searches take trivial time, especially compared to the syscall overhead of these functions.
2011-03-03preliminaries to adding POSIX semaphoresRich Felker1-0/+1
2011-02-14extensive header cleanup for standards conformance & correctnessRich Felker1-2/+3
thanks to Peter Mazinger (psm) for pointing many of these issues out and submitting a patch on which this commit is loosely based
2011-02-14begin namespace-cleanup of standard C headersRich Felker1-1/+7
2011-02-13reorganize thread exit code, make pthread_exit call cancellation handlers (pt2)Rich Felker1-1/+2
2011-02-12initial check-in, version 0.5.0v0.5.0Rich Felker1-0/+101