Browse Source

Fix issue with RUSAGE constants not being in C headers if negative

Jeremy Soller 6 năm trước cách đây
mục cha
commit
463c9f386c

+ 9 - 0
include/bits/sys/resource.h

@@ -0,0 +1,9 @@
+#ifndef _BITS_SYS_RESOURCE_H
+#define _BITS_SYS_RESOURCE_H
+
+#define	RUSAGE_SELF 0
+#define	RUSAGE_CHILDREN (-1)
+#define RUSAGE_BOTH (-2)
+#define	RUSAGE_THREAD 1
+
+#endif /* _BITS_SYS_RESOURCE_H */

+ 1 - 0
src/sys_resource/cbindgen.toml

@@ -1,5 +1,6 @@
 sys_includes = ["sys/types.h", "stdint.h", "sys/time.h"]
 include_guard = "_SYS_RESOURCE_H"
+trailer = "#include <bits/sys/resource.h>"
 language = "C"
 
 # WORKAROUND:

+ 5 - 4
src/sys_resource/src/lib.rs

@@ -9,10 +9,11 @@ extern crate sys_time;
 use platform::types::*;
 use sys_time::timeval;
 
-pub const RUSAGE_SELF: c_int = 0;
-pub const RUSAGE_CHILDREN: c_int = -1;
-pub const RUSAGE_BOTH: c_int = -2;
-pub const RUSAGE_THREAD: c_int = 1;
+// Exported in bits file
+const RUSAGE_SELF: c_int = 0;
+const RUSAGE_CHILDREN: c_int = -1;
+const RUSAGE_BOTH: c_int = -2;
+const RUSAGE_THREAD: c_int = 1;
 
 type rlim_t = u64;