* 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

@ -143,7 +143,8 @@ memory. The value should set reasonably high so as not to interfer with normal
program operation.
\fBzzuf\fR uses the \fBsetrlimit\fR() call to set memory usage limitations and
relies on the operating system's ability to enforce such limitations.
relies on the operating system's ability to enforce such limitations. This
option is not available on the OpenBSD system.
.TP
\fB\-n\fR, \fB\-\-network\fR
Fuzz the application's network input. By default \fBzzuf\fR only fuzzes files.

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