提交 9a59faab 编写于 作者: R Rich Felker

add useless, obsolescent function ulimit

上级 f48832ee
#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;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册