zte's code,first commit
Change-Id: I9a04da59e459a9bc0d67f101f700d9d7dc8d681b
diff --git a/ap/build/uClibc/libc/sysdeps/linux/common/ulimit.c b/ap/build/uClibc/libc/sysdeps/linux/common/ulimit.c
new file mode 100644
index 0000000..8be4a37
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/common/ulimit.c
@@ -0,0 +1,48 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <sys/syscall.h>
+
+#include <stdarg.h>
+#include <unistd.h>
+#include <ulimit.h>
+#include <sys/resource.h>
+
+
+long int ulimit(int cmd, ...)
+{
+ va_list va;
+ struct rlimit limit;
+ long int result = -1;
+ va_start (va, cmd);
+ switch (cmd) {
+ /* Get limit on file size. */
+ case UL_GETFSIZE:
+ if (getrlimit(RLIMIT_FSIZE, &limit) == 0)
+ result = limit.rlim_cur / 512; /* bytes to 512 byte blocksize */
+ break;
+ /* Set limit on file size. */
+ case UL_SETFSIZE:
+ result = va_arg (va, long int);
+ if ((rlim_t) result > RLIM_INFINITY / 512) {
+ limit.rlim_cur = RLIM_INFINITY;
+ limit.rlim_max = RLIM_INFINITY;
+ } else {
+ limit.rlim_cur = result * 512;
+ limit.rlim_max = result * 512;
+ }
+ result = setrlimit(RLIMIT_FSIZE, &limit);
+ break;
+ case __UL_GETOPENMAX:
+ result = sysconf(_SC_OPEN_MAX);
+ break;
+ default:
+ __set_errno(EINVAL);
+ }
+ va_end (va);
+ return result;
+}