From 9a59faab3c0c46d2e96245e11fc71351caba1a2e Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sun, 29 May 2011 14:09:03 -0400 Subject: [PATCH] add useless, obsolescent function ulimit --- src/misc/ulimit.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/misc/ulimit.c diff --git a/src/misc/ulimit.c b/src/misc/ulimit.c new file mode 100644 index 00000000..f0eee3a0 --- /dev/null +++ b/src/misc/ulimit.c @@ -0,0 +1,19 @@ +#include +#include +#include + +long ulimit(int cmd, ...) +{ + struct rlimit rl; + getrlimit(RLIMIT_FSIZE, &rl); + if (cmd == UL_SETFSIZE) { + long val; + va_list ap; + va_start(ap, cmd); + val = va_arg(ap, long); + va_end(ap); + rl.rlim_cur = 512ULL * val; + if (setrlimit(RLIMIT_FSIZE, &rl)) return -1; + } + return rl.rlim_cur / 512; +} -- 2.25.1