diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-05-29 14:09:03 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-05-29 14:09:03 -0400 |
commit | 9a59faab3c0c46d2e96245e11fc71351caba1a2e (patch) | |
tree | a60bff71bb63776f54ed21338c517efd24951fa0 /src | |
parent | f48832ee15027763826c8a7ff9eeed3fc06bb499 (diff) | |
download | musl-9a59faab3c0c46d2e96245e11fc71351caba1a2e.tar.gz musl-9a59faab3c0c46d2e96245e11fc71351caba1a2e.tar.bz2 musl-9a59faab3c0c46d2e96245e11fc71351caba1a2e.tar.xz musl-9a59faab3c0c46d2e96245e11fc71351caba1a2e.zip |
add useless, obsolescent function ulimit
Diffstat (limited to 'src')
-rw-r--r-- | src/misc/ulimit.c | 19 |
1 files changed, 19 insertions, 0 deletions
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 <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; +} |