"Hrvoje" == Hrvoje Niksic <hniksic(a)arsdigita.com>
writes:
Hrvoje> A third, and IMHO best, solution would be for XEmacs to raise its
own
Hrvoje> stack size if it notices it to be too small. It's
quite easy to
do
Hrvoje> for someone who has access to a Digital Unix system.
I think that once again Hrvoje is right. Althouh I have access to
Digital Unix system I'm afraid that fix is not easy enough that I
could do it, but I can try if no-one else will. For start, should
the stack size be checked when starting XEmacs or can stack size be
increased just when it has been exceeded?
I'm not sure if you can raise the stack size once your program has started.
I know that you can do it for threads on digital unix very simply. We could
put code like this where appropriate.
static int __check_stack_requirements(int necessary)
{
#ifdef RLIMIT_STACK
struct rlimit rl;
if (getrlimit(RLIMIT_STACK,&rl) == 0)
{
if (rl.rlim_cur >= necessary)
{
/* Everything will work just fine... */
return (0);
}
if (rl.rlim_max < necessary)
{
/* Maximum stack size is still too small...
** Should we just fail to start?
*/
return (-1);
}
rl.rlim_cur = necessary;
if (setrlimit(RLIMIT_STACK, &rl))
{
/* Error when setting new stack size... */
return (-1);
}
return (0);
#else
return (0);
#endif
}
and then do something like:
if (__check_stack_requirements(min_required_by_regex_c))
{
stderr_out ("Your regexps will be hosed...\n");
abort();
}
-bp