projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f48832e
)
add useless, obsolescent function ulimit
author
Rich Felker
<dalias@aerifal.cx>
Sun, 29 May 2011 18:09:03 +0000
(14:09 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Sun, 29 May 2011 18:09:03 +0000
(14:09 -0400)
src/misc/ulimit.c
[new file with mode: 0644]
patch
|
blob
diff --git a/src/misc/ulimit.c
b/src/misc/ulimit.c
new file mode 100644
(file)
index 0000000..
f0eee3a
--- /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;
+}