int getpriority(int, int);
int setpriority(int, int, int);
+#ifdef _POSIX_SOURCE
+
+#include <sys/time.h>
+
+typedef unsigned long rlim_t;
+
+#define RLIM_INFINITY ((rlim_t) -1)
+#define RLIM_SAVED_CUR RLIM_INFINITY
+#define RLIM_SAVED_MAX RLIM_INFINITY
+
+struct rlimit
+{
+ rlim_t rlim_cur;
+ rlim_t rlim_max;
+};
+
+#define RLIMIT_CORE 1
+#define RLIMIT_CPU 2
+#define RLIMIT_DATA 3
+#define RLIMIT_FSIZE 4
+#define RLIMIT_NOFILE 5
+#define RLIMIT_STACK 6
+#define RLIMIT_AS 7
+
+int getrlimit(int resource, struct rlimit *rlp);
+
+#endif /* defined(_POSIX_SOURCE) */
+
#endif
#endif
+#ifdef _POSIX_SOURCE
+_PROTOTYPE( int getdtablesize, (void) );
+#endif
+
#endif /* _UNISTD_H */
random.c \
realpath.c \
rindex.c \
+ rlimit.c \
setenv.c \
setgroups.c \
settimeofday.c \
--- /dev/null
+/* getdtablesize, getrlimit Author: Erik van der Kouwe
+ * query resource consumtion limits 4 December 2009
+ *
+ * Based on these specifications:
+ * http://www.opengroup.org/onlinepubs/007908775/xsh/getdtablesize.html
+ * http://www.opengroup.org/onlinepubs/007908775/xsh/getrlimit.html
+ */
+
+#include <errno.h>
+#include <limits.h>
+#include <sys/resource.h>
+#include <unistd.h>
+
+int getdtablesize(void)
+{
+ return OPEN_MAX;
+}
+
+int getrlimit(int resource, struct rlimit *rlp)
+{
+ rlim_t limit;
+
+ switch (resource)
+ {
+ case RLIMIT_CORE:
+ /* no core currently produced */
+ limit = 0;
+ break;
+
+ case RLIMIT_CPU:
+ case RLIMIT_DATA:
+ case RLIMIT_FSIZE:
+ case RLIMIT_STACK:
+ case RLIMIT_AS:
+ /* no limit enforced (however architectural limits
+ * may apply)
+ */
+ limit = RLIM_INFINITY;
+ break;
+
+ case RLIMIT_NOFILE:
+ limit = OPEN_MAX;
+ break;
+
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+
+ /* return limit */
+ rlp->rlim_cur = limit;
+ rlp->rlim_max = limit;
+ return 0;
+}
+
--- /dev/null
+.TH GETDTABLESIZE 3 "December 4, 2009"
+.UC 4
+.SH NAME
+getdtablesize \- query maximum number of open files
+.SH SYNOPSIS
+.nf
+.ft B
+#include <unistd.h>
+
+int getdtablesize(void);
+.fi
+.SH DESCRIPTION
+getdtablesize returns the number of files that may be open at the same time
+in a process.
+.SH "RETURN VALUE
+The number of files that may be open at the same time in a process is returned.
--- /dev/null
+.TH GETRLIMIT 3 "December 4, 2009"
+.UC 4
+.SH NAME
+getrlimit \- query resource consumption limits
+.SH SYNOPSIS
+.nf
+.ft B
+#include <sys/resource.h>
+
+int getrlimit(int \fIresource\fP, struct rlimit *\fIrlp\fP);
+.fi
+.SH DESCRIPTION
+getrlimit queries the current resource limit regarding the specified
+\fIresource\fP. This can be one of the following: RLIMIT_CORE, RLIMIT_CPU,
+RLIMIT_DATA, RLIMIT_FSIZE, RLIMIT_NOFILE, RLIMIT_STACK or RLIMIT_AS.
+The soft limit is specified in \fIrlp\fP\->rlim_cur and the hard limit in
+\fIrlp\fP\->rlim_max. On MINIX, these are currently always the same.
+A value of RLIM_INFINITY specifies that no limit is enforced, although
+architectural limits may still apply.
+.SH "RETURN VALUE
+If the function succeeds, 0 is returned.
+If the function fails, -1 is returned and errno is set to indicate the
+cause of the failure.