refactor headers, especially alltypes.h, and improve C++ ABI compat
[musl] / include / sys / resource.h
index a9ec3bc..0cfbcf4 100644 (file)
@@ -1,9 +1,18 @@
 #ifndef        _SYS_RESOURCE_H
 #define        _SYS_RESOURCE_H
 
+#ifdef __cplusplus
+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>
 
@@ -45,6 +54,11 @@ int getrusage (int, struct rusage *);
 int getpriority (int, id_t);
 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_PROCESS 0
 #define PRIO_PGRP    1
 #define PRIO_USER    2
@@ -67,7 +81,23 @@ int setpriority (int, id_t, int);
 #define RLIMIT_NPROC   6
 #define RLIMIT_MEMLOCK 8
 #define RLIMIT_LOCKS   10
+#define RLIMIT_SIGPENDING 11
+#define RLIMIT_MSGQUEUE 12
+#define RLIMIT_NICE    13
+#define RLIMIT_RTPRIO  14
+#define RLIMIT_NLIMITS 15
 
+#define RLIM_NLIMITS RLIMIT_NLIMITS
 
+#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
+#define getrlimit64 getrlimit
+#define setrlimit64 setrlimit
+#define rlimit64 rlimit
+#define rlim64_t rlim_t
+#endif
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif