Add sched_getattr()/sched_setattr().
Still a questionable ABI (because the struct changes size over time without changing its name), but it's in glibc 2.41, so my assumption is that _not_ having it is likely to be more disruptive than the ABI issues going forward. (Hopefully no-one was planning on passing these structs between separately compiled libraries anyway!)
Bug: http://b/183240349
Change-Id: I80c39900b70af7e84913e547f38f656efa3e16ec
diff --git a/libc/include/sched.h b/libc/include/sched.h
index 58dd9a6..c68ebf0 100644
--- a/libc/include/sched.h
+++ b/libc/include/sched.h
@@ -37,6 +37,7 @@
#include <bits/timespec.h>
#include <linux/sched.h>
+#include <linux/sched/types.h>
__BEGIN_DECLS
@@ -236,6 +237,22 @@
int sched_getaffinity(pid_t __pid, size_t __set_size, cpu_set_t* _Nonnull __set);
/**
+ * [sched_setattr(2)](https://man7.org/linux/man-pages/man2/sched_setattr.2.html)
+ * sets the scheduling attributes for the given thread.
+ *
+ * Returns 0 on success and returns -1 and sets `errno` on failure.
+ */
+int sched_setattr(pid_t __pid, struct sched_attr* _Nonnull __attr, unsigned __flags) __INTRODUCED_IN(37);
+
+/**
+ * [sched_getattr(2)](https://man7.org/linux/man-pages/man2/sched_getattr.2.html)
+ * gets the scheduling attributes for the given thread.
+ *
+ * Returns 0 on success and returns -1 and sets `errno` on failure.
+ */
+int sched_getattr(pid_t __pid, struct sched_attr* _Nonnull __attr, unsigned __size, unsigned __flags) __INTRODUCED_IN(37);
+
+/**
* [CPU_ZERO](https://man7.org/linux/man-pages/man3/CPU_ZERO.3.html) clears all
* bits in a static CPU set.
*/