diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-03-28 10:55:26 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-03-28 10:55:26 +0000 |
commit | 3bd1aa475df61ad8f14bb9af929dcac4a2de81c8 (patch) | |
tree | db666858fadbbd41484ee14cd5c2500ca77f4d9f /sysdeps | |
parent | eec8b6cae586451deadf30c371f7b5e4c9d573d1 (diff) | |
download | glibc-3bd1aa475df61ad8f14bb9af929dcac4a2de81c8.tar.gz glibc-3bd1aa475df61ad8f14bb9af929dcac4a2de81c8.tar.xz glibc-3bd1aa475df61ad8f14bb9af929dcac4a2de81c8.zip |
Update.
2004-03-28 Ulrich Drepper <drepper@redhat.com> * sysdeps/unix/sysv/linux/sysconf.c (__sysconf): Handle _SC_SIGQUEUE_MAX.
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/unix/sysv/linux/sysconf.c | 61 |
1 files changed, 35 insertions, 26 deletions
diff --git a/sysdeps/unix/sysv/linux/sysconf.c b/sysdeps/unix/sysv/linux/sysconf.c index 6fae5590f5..de07e8062f 100644 --- a/sysdeps/unix/sysv/linux/sysconf.c +++ b/sysdeps/unix/sysv/linux/sysconf.c @@ -32,6 +32,8 @@ static long int posix_sysconf (int name); long int __sysconf (int name) { + const char *procfname = NULL; + switch (name) { #ifdef __NR_clock_getres @@ -47,37 +49,44 @@ __sysconf (int name) #endif case _SC_NGROUPS_MAX: - { - /* Try to read the information from the /proc/sys/kernel/ngroups_max - file. */ - int fd = open_not_cancel_2 ("/proc/sys/kernel/ngroups_max", O_RDONLY); - if (fd != -1) - { - /* This is more than enough, the file contains a single - integer. */ - char buf[32]; - ssize_t n; - n = TEMP_FAILURE_RETRY (read_not_cancel (fd, buf, - sizeof (buf) - 1)); - close_not_cancel_no_status (fd); - - if (n > 0) - { - /* Terminate the string. */ - buf[n] = '\0'; - - char *endp; - long int res = strtol (buf, &endp, 10); - if (endp != buf && (*endp == '\0' || *endp == '\n')) - return res; - } - } - } + /* Try to read the information from the /proc/sys/kernel/ngroups_max + file. */ + procfname = "/proc/sys/kernel/ngroups_max"; + break; + + case _SC_SIGQUEUE_MAX: + /* The /proc/sys/kernel/rtsig-max file contains the answer. */ + procfname = "/proc/sys/kernel/rtsig-max"; break; default: break; } + + if (procfname != NULL) + { + int fd = open_not_cancel_2 (procfname, O_RDONLY); + if (fd != -1) + { + /* This is more than enough, the file contains a single integer. */ + char buf[32]; + ssize_t n; + n = TEMP_FAILURE_RETRY (read_not_cancel (fd, buf, sizeof (buf) - 1)); + close_not_cancel_no_status (fd); + + if (n > 0) + { + /* Terminate the string. */ + buf[n] = '\0'; + + char *endp; + long int res = strtol (buf, &endp, 10); + if (endp != buf && (*endp == '\0' || *endp == '\n')) + return res; + } + } + } + return posix_sysconf (name); } |