add mlock2 linux syscall wrapper
[musl] / include / sys / resource.h
index 9536ba3..70d793d 100644 (file)
@@ -6,27 +6,25 @@ extern "C" {
 #endif
 
 #include <features.h>
+#include <sys/time.h>
 
 #define __NEED_id_t
-#define __NEED_time_t
-#define __NEED_struct_timeval
 
 #ifdef _GNU_SOURCE
 #define __NEED_pid_t
 #endif
 
 #include <bits/alltypes.h>
+#include <bits/resource.h>
 
 typedef unsigned long long rlim_t;
 
-struct rlimit
-{
+struct rlimit {
        rlim_t rlim_cur;
        rlim_t rlim_max;
 };
 
-struct rusage
-{
+struct rusage {
        struct timeval ru_utime;
        struct timeval ru_stime;
        /* linux extentions, but useful */
@@ -57,14 +55,19 @@ int setpriority (int, id_t, int);
 
 #ifdef _GNU_SOURCE
 int prlimit(pid_t, int, const struct rlimit *, struct rlimit *);
+#define prlimit64 prlimit
 #endif
 
+#define PRIO_MIN (-20)
+#define PRIO_MAX 20
+
 #define PRIO_PROCESS 0
 #define PRIO_PGRP    1
 #define PRIO_USER    2
 
 #define RUSAGE_SELF     0
-#define RUSAGE_CHILDREN 1
+#define RUSAGE_CHILDREN (-1)
+#define RUSAGE_THREAD   1
 
 #define RLIM_INFINITY (~0ULL)
 #define RLIM_SAVED_CUR RLIM_INFINITY
@@ -75,11 +78,13 @@ int prlimit(pid_t, int, const struct rlimit *, struct rlimit *);
 #define RLIMIT_DATA    2
 #define RLIMIT_STACK   3
 #define RLIMIT_CORE    4
+#ifndef RLIMIT_RSS
 #define RLIMIT_RSS     5
-#define RLIMIT_NOFILE  7
-#define RLIMIT_AS      9
 #define RLIMIT_NPROC   6
+#define RLIMIT_NOFILE  7
 #define RLIMIT_MEMLOCK 8
+#define RLIMIT_AS      9
+#endif
 #define RLIMIT_LOCKS   10
 #define RLIMIT_SIGPENDING 11
 #define RLIMIT_MSGQUEUE 12
@@ -90,6 +95,9 @@ int prlimit(pid_t, int, const struct rlimit *, struct rlimit *);
 #define RLIM_NLIMITS RLIMIT_NLIMITS
 
 #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
+#define RLIM64_INFINITY RLIM_INFINITY
+#define RLIM64_SAVED_CUR RLIM_SAVED_CUR
+#define RLIM64_SAVED_MAX RLIM_SAVED_MAX
 #define getrlimit64 getrlimit
 #define setrlimit64 setrlimit
 #define rlimit64 rlimit