mirror of
https://git.musl-libc.org/git/musl
synced 2025-01-11 00:48:35 +03:00
add useless, obsolescent function ulimit
This commit is contained in:
parent
f48832ee15
commit
9a59faab3c
19
src/misc/ulimit.c
Normal file
19
src/misc/ulimit.c
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user