add useless, obsolescent function ulimit

This commit is contained in:
Rich Felker 2011-05-29 14:09:03 -04:00
parent f48832ee15
commit 9a59faab3c
1 changed files with 19 additions and 0 deletions

19
src/misc/ulimit.c Normal file
View File

@ -0,0 +1,19 @@
#include <sys/resource.h>
#include <ulimit.h>
#include <stdarg.h>
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;
}