History log of /seL4-test-master/projects/musllibc/src/conf/sysconf.c
Revision Date Author Comments
# 93be56ba 18-May-2014 Rich Felker <dalias@aerifal.cx>

remove unsupported nonstandard sysconf macros and their table entries

some of these may have been from ancient (pre-SUSv2) POSIX versions;
more likely, they were from POSIX drafts or glibc interpretations of
what ancient versions of POSIX should have added (instead they made
they described functionality mandatory and/or dropped it completely).
others are purely glibc-isms, many of them ill-thought-out, like
providing ways to lookup the min/max values of types at runtime
(despite the impossibility of them changing at runtime and the
impossibility of representing ULONG_MAX in a return value of type
long).

since our sysconf implementation does not support or return meaningful
values for any of these, it's harmful to have the macros around;
applications' build scripts may detect and attempt to use them, only
to get -1/EINVAL as a result.

if removing them does break some applications, and it's determined
that the usage was reasonable, some of these could be added back on an
as-needed basis, but they should return actual meaningful values, not
junk like they were returning before.


# ff78355b 19-May-2014 Rich Felker <dalias@aerifal.cx>

rework sysconf table to treat zero entries as invalid

based on patch by Timo Teräs. previously, the value zero was used as a
literal zero, meaning that all invalid sysconf "names", which should
result in sysconf returning -1, had to be explicitly listed. (in
addition, it was not possible for sysconf to set errno to EINVAL, as
there was no distinction between -1 as an error and -1 as a valid
result.)

now, the value 0 is used for invalid/undefined slots in the table and
a new switch table entry is used for returning literal zeros.

in addition, an off-by-one error in checking against the table size is
fixed.


# 96315d27 15-Apr-2014 Rich Felker <dalias@aerifal.cx>

add _SC_PHYS_PAGES and _SC_AVPHYS_PAGES extentions to sysconf


# 6cf7d17f 15-Apr-2014 Rich Felker <dalias@aerifal.cx>

in sysconf, use getrlimit function rather than raw syscall for rlimits

the syscall is deprecated (replaced by prlimit64) and does not work
correctly on x32. this change mildly increases size, but is likely
needed anyway for newer archs that might omit deprecated syscalls.


# 233767b4 15-Apr-2014 Rich Felker <dalias@aerifal.cx>

avoid linear-time if/else special cases in sysconf

the previous handling of cases that could not fit in the 16-bit table
or which required non-constant results was extremely ugly and could
not scale. the new code remaps these keys into a contiguous range
that's efficient for a switch statement.


# d8e283df 19-Sep-2013 Rich Felker <dalias@aerifal.cx>

correct the sysconf value for RTSIG_MAX

this is the number of realtime signals available, not the maximum
signal number or total number of signals.


# b20760c0 14-Sep-2013 Szabolcs Nagy <nsz@port70.net>

support configurable page size on mips, powerpc and microblaze

PAGE_SIZE was hardcoded to 4096, which is historically what most
systems use, but on several archs it is a kernel config parameter,
user space can only know it at execution time from the aux vector.

PAGE_SIZE and PAGESIZE are not defined on archs where page size is
a runtime parameter, applications should use sysconf(_SC_PAGE_SIZE)
to query it. Internally libc code defines PAGE_SIZE to libc.page_size,
which is set to aux[AT_PAGESZ] in __init_libc and early in __dynlink
as well. (Note that libc.page_size can be accessed without GOT, ie.
before relocations are done)

Some fpathconf settings are hardcoded to 4096, these should be actually
queried from the filesystem using statfs.


# 7a34dd34 14-Sep-2013 Rich Felker <dalias@aerifal.cx>

fix overflow in sysconf for _SC_MQ_PRIO_MAX

the value of MQ_PRIO_MAX does not fit, so it needs to use OFLOW.


# bf7b7282 26-Jul-2013 Rich Felker <dalias@aerifal.cx>

a few more fixes for unistd/sysconf feature reporting


# a6d39fdf 26-Jul-2013 Rich Felker <dalias@aerifal.cx>

report presence of ADV and MSG options in unistd.h and sysconf


# 77830507 26-Jul-2013 Rich Felker <dalias@aerifal.cx>

report that posix_spawn is supported in unistd.h and sysconf


# f03db4bd 26-Jun-2013 Rich Felker <dalias@aerifal.cx>

document in sysconf and unistd.h that per-thread cpu clocks exist


# 7df42e87 11-Nov-2012 Rich Felker <dalias@aerifal.cx>

report support of TPS option in unistd.h and sysconf

also update another newish feature in sysconf, stackaddr


# 9a7fac79 12-May-2012 Rich Felker <dalias@aerifal.cx>

let sysconf accurately report # of cpus available

i've been trying out openmp and it seems like it won't be much use
without this...


# c6131259 21-Apr-2012 Rich Felker <dalias@aerifal.cx>

fix broken sysconf when correct value is -1

this caused glib to try to allocate >2gb for getpwnam_r, and probably
numerous other problems.


# 2e0c1fed 21-Mar-2012 Rich Felker <dalias@aerifal.cx>

sysconf support for dynamic limits (open files and processes)


# b3b00d11 02-Oct-2011 Rich Felker <dalias@aerifal.cx>

sysconf for PTHREAD_KEYS_MAX


# 2b0cedac 07-Jun-2011 Rich Felker <dalias@aerifal.cx>

define MQ_PRIO_MAX


# 67e793e5 07-Apr-2011 Rich Felker <dalias@aerifal.cx>

better fix sysconf pthread stack min


# 5e72cb4a 07-Apr-2011 Rich Felker <dalias@aerifal.cx>

consistency with pthread stack min in limits.h


# 81af5036 10-Mar-2011 Rich Felker <dalias@aerifal.cx>

fix sem_open and sem_close to obey posix semantics

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.


# 0b44a031 11-Feb-2011 Rich Felker <dalias@aerifal.cx>

initial check-in, version 0.5.0