2007-10-07 17:14:02 +05:30
|
|
|
#include <config.h>
|
|
|
|
|
2007-11-11 05:16:11 +05:30
|
|
|
#ident "$Id$"
|
2007-10-07 17:17:01 +05:30
|
|
|
|
2007-10-07 17:14:02 +05:30
|
|
|
#if HAVE_ULIMIT_H
|
|
|
|
#include <ulimit.h>
|
|
|
|
#ifndef UL_SETFSIZE
|
|
|
|
#ifdef UL_SFILLIM
|
|
|
|
#define UL_SETFSIZE UL_SFILLIM
|
|
|
|
#else
|
|
|
|
#define UL_SETFSIZE 2
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#elif HAVE_SYS_RESOURCE_H
|
2007-10-07 17:15:23 +05:30
|
|
|
#include <sys/time.h> /* for struct timeval on sunos4 */
|
2007-10-07 17:14:02 +05:30
|
|
|
/* XXX - is the above ok or should it be <time.h> on ultrix? */
|
|
|
|
#include <sys/resource.h>
|
|
|
|
#endif
|
2007-10-07 17:15:23 +05:30
|
|
|
void set_filesize_limit (int blocks)
|
2007-10-07 17:14:02 +05:30
|
|
|
{
|
|
|
|
#if HAVE_ULIMIT_H
|
2007-10-07 17:15:23 +05:30
|
|
|
ulimit (UL_SETFSIZE, blocks);
|
2007-10-07 17:14:02 +05:30
|
|
|
#elif defined(RLIMIT_FSIZE)
|
|
|
|
struct rlimit rlimit_fsize;
|
|
|
|
|
|
|
|
rlimit_fsize.rlim_cur = rlimit_fsize.rlim_max = 512L * blocks;
|
2007-10-07 17:15:23 +05:30
|
|
|
setrlimit (RLIMIT_FSIZE, &rlimit_fsize);
|
2007-10-07 17:14:02 +05:30
|
|
|
#endif
|
|
|
|
}
|