[PATCH] POSIX sysconf() hooks via read-only sysctls

From: Chris Wing (wingc@engin.umich.edu)
Date: Fri Jan 07 2000 - 18:28:52 EST


Hi. Since my latest 32-bit UID patches still apply fine to 2.3.38pre1, I
decided to put together an experimental patch to implement bits of POSIX
sysconf() using read-only sysctls. (pursuant to recent discussion)

The result is against 2.3.38pre1 and can downloaded at:

http://www.engin.umich.edu/caen/systems/Linux/code/misc/linux-sysconf.patch

It adds a new sysctl category appropriately named 'sysconf'. I've tried
to add the bare minimum number of sysctl elements necessary to get at
everything in POSIX sysconf() relevant to the kernel. Most of POSIX
sysconf() strictly deals with C library issues.

Here's what it looks like:

[wing@linux wing]$ cd /proc/sys/sysconf/
[wing@linux sysconf]$ ls
arg_max ngroups_max pii_internet_dgram semaphores
avphys_pages nprocessors_conf pii_internet_stream shared_memory_objects
child_max nprocessors_onln pii_socket sigqueue_max
clk_tck open_max priority_scheduling synchronized_io
iov_max pagesize realtime_signals timers
message_passing phys_pages sem_nsems_max xopen_shm
mq_open_max pii_internet sem_value_max

[wing@linux sysconf]$ cat arg_max clk_tck iov_max ngroups_max
131072
100
1024
32
[wing@linux sysconf]$ cat nprocessors_conf nprocessors_onln
1
1
[wing@linux sysconf]$ cat pagesize phys_pages avphys_pages
4096
31703
19074
[wing@linux sysconf]$ cat mq_open_max sem_nsems_max sem_value_max
32768
250
32767

et cetera.

Advantages:
        - it is now possible to query several kernel constants that were
          previously difficult to discover easily at runtime
        - uses existing sysctl framework; no new system calls, parsing
          functions, etc. need to be added to kernel

Disadvantages:
        - extra sysctl tables, variables make kernel slightly bigger

Ulrich, would a patch similar to this help out glibc's implementation of
sysconf()?

Thanks,
Chris Wing
wingc@engin.umich.edu

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jan 15 2000 - 21:00:11 EST