Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

RE: PATCH: maxfilelocks in ulimit output



> 
> > Seems that it's treating RLIMIT_AS and RLIMIT_RSS as
> > "identifiers", because they compare equally in the #if.
> 
> I'm told that it's impossible to do a preprocessor compare because of
> the enum.  So to get this to work we'd need to remove something to
> configure or elsewhere.

Untested idea (not having the relevant system and time :(

AC_DEFUN(zsh_TEST_LIMIT_VALUE,[
echo > get-limit-value.c << EOF

main()
{
#ifdef $1
printf("%d", $1);
#else
printf("%d", -1);
#endif
return 0;
}
EOF

cc -o get-limit-value get-limit-value.c

val=`get-limit-value`
if test "$val" -ge 0; then
AC_DEFINE(ZSH_$1, $val)
fi
]

later on

zsh_TEST_LIMIT_VALUE(RLIMIT_AS)
zsh_TEST_LIMIT_VALUE(RLIMIT_RSS)
...

and in code use ZSH_... instead of original values.

Ugly as sin but it will work.

-andrey



Messages sorted by: Reverse Date, Date, Thread, Author