* Handle architectures that don't have RLIMIT_AS (like OpenBSD).

This commit is contained in:
Sam Hocevar
2007-02-08 17:23:48 +00:00
committed by sam
parent b79efda114
commit e551756f05
2 changed files with 11 additions and 2 deletions

View File

@@ -75,6 +75,14 @@
# define SIGKILL 9
#endif
#if defined RLIMIT_AS
# define ZZUF_RLIMIT_CONST RLIMIT_AS
#elif defined RLIMIT_VMEM
# define ZZUF_RLIMIT_CONST RLIMIT_VMEM
#else
# undef HAVE_SETRLIMIT
#endif
/* We use file descriptor 17 as the debug channel */
#define DEBUG_FILENO 17
#define DEBUG_FILENO_STR "17"
@@ -572,7 +580,7 @@ static void spawn_children(struct opts *opts)
struct rlimit rlim;
rlim.rlim_cur = opts->maxmem * 1000000;
rlim.rlim_max = opts->maxmem * 1000000;
setrlimit(RLIMIT_AS, &rlim);
setrlimit(ZZUF_RLIMIT_CONST, &rlim);
}
#endif