mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Use dynamic maximum configuration values when necessary (#370)
This commit fixes an issue with how ksh was obtaining the value of
NGROUPS_MAX. On some systems this setting can be changed (e.g., on
illumos adding 'set ngroups_max=32' to /etc/system then rebooting
changes NGROUPS_MAX from 16 to 32). Ksh was using NGROUPS_MAX with
the assumption it's a static value, which could cause issues on
systems where it isn't static. This bugfix is inspired by the one
from <b1362c3a5>, although it
has been expanded a bit to account for OPEN_MAX as well.
src/cmd/ksh93/sh/init.c, src/lib/libcmd/fds.c:
- Rename the getconf() macro to astconf_long() and move it to ast.h
to prevent redundancy. Other sections of the code have been
modified to use this macro for astconf() to account for
dynamic settings.
- An equivalent macro for unsigned long values (astconf_ulong) has
been added.
- Prefer sysconf(3) where available. It has better performance as it
returns a numeric value directly instead of via string
conversion.
- The astconf_long and astconf_ulong macros have been documented in
the ast(3) man page.
This commit is contained in:
parent
fc752b574a
commit
c2ac69b2d5
15 changed files with 81 additions and 27 deletions
|
|
@ -44,6 +44,8 @@ ast \- miscellaneous libast support
|
|||
#include <ast.h>
|
||||
|
||||
char* astconf(const char* \fIname\fP, const char* \fIpath\fP, const char* \fIvalue\fP);
|
||||
long astconf_long(\fIarg\fP);
|
||||
unsigned long astconf_ulong(\fIarg\fP);
|
||||
Ast_confdisc_t astconfdisc(Ast_confdisc_t new_notify);
|
||||
void astconflist(Sfio_t* stream, const char* path, int flags);
|
||||
off_t astcopy(int \fIrfd\fP, int \fIwfd\fP, off_t \fIn\fP);
|
||||
|
|
@ -155,6 +157,30 @@ User defined
|
|||
values may also be set and queried, but these should probably have
|
||||
some form of vendor prefix to avoid being stomped by future standards.
|
||||
.PP
|
||||
.L astconf_long
|
||||
and
|
||||
.L astconf_ulong
|
||||
are macros that call either
|
||||
.I sysconf
|
||||
or
|
||||
.LR astconf ,
|
||||
preferring
|
||||
.I sysconf
|
||||
if it's available.
|
||||
.L astconf_long
|
||||
returns a signed long value while
|
||||
.L astconf_ulong
|
||||
returns an unsigned long value.
|
||||
The argument passed to these macros may be one of the following:
|
||||
.EX
|
||||
CONF_ARG_MAX
|
||||
CONF_CHILD_MAX
|
||||
CONF_CLK_TCK
|
||||
CONF_NGROUPS_MAX
|
||||
CONF_OPEN_MAX
|
||||
CONF_PAGESIZE
|
||||
.EE
|
||||
.PP
|
||||
.L astconfdisc
|
||||
registers a discipline function
|
||||
.EX
|
||||
|
|
@ -259,7 +285,7 @@ and
|
|||
are set to
|
||||
.LR 0 .
|
||||
If
|
||||
.I ioctl (2)
|
||||
.IR ioctl (2)
|
||||
methods fail then the environment variable
|
||||
.L LINES
|
||||
is used to set
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue