Last change
on this file since 399 was 389, checked in by coas-nagasima, 5 years ago |
ビルドが通るよう更新
|
-
Property svn:eol-style
set to
native
-
Property svn:mime-type
set to
text/x-csrc;charset=UTF-8
|
File size:
368 bytes
|
Line | |
---|
1 | #include <sys/resource.h>
|
---|
2 | #include <ulimit.h>
|
---|
3 | #include <stdarg.h>
|
---|
4 |
|
---|
5 | long ulimit(int cmd, ...)
|
---|
6 | {
|
---|
7 | struct rlimit rl;
|
---|
8 | getrlimit(RLIMIT_FSIZE, &rl);
|
---|
9 | if (cmd == UL_SETFSIZE) {
|
---|
10 | long val;
|
---|
11 | va_list ap;
|
---|
12 | va_start(ap, cmd);
|
---|
13 | val = va_arg(ap, long);
|
---|
14 | va_end(ap);
|
---|
15 | rl.rlim_cur = 512ULL * val;
|
---|
16 | if (setrlimit(RLIMIT_FSIZE, &rl)) return -1;
|
---|
17 | }
|
---|
18 | return rl.rlim_cur / 512;
|
---|
19 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.