summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/bits
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2015-02-20 12:24:26 -0600
committerWaldemar Brodkorb <wbx@openadk.org>2015-02-20 12:24:26 -0600
commitd4389d613cc49f776fffe5ee0f9af854e9a93074 (patch)
treeacb65e19f6482e2599e31003c9a811154580a23c /libc/sysdeps/linux/common/bits
parent42e9e0a0406473a9b017342eaffc03c85f9bb51b (diff)
parent409f14d9b5e47513d5c939120a33965997c8ceb2 (diff)
sync with uClibc
Diffstat (limited to 'libc/sysdeps/linux/common/bits')
-rw-r--r--libc/sysdeps/linux/common/bits/sched.h53
1 files changed, 34 insertions, 19 deletions
diff --git a/libc/sysdeps/linux/common/bits/sched.h b/libc/sysdeps/linux/common/bits/sched.h
index a5eb6ee55..9d05314f5 100644
--- a/libc/sysdeps/linux/common/bits/sched.h
+++ b/libc/sysdeps/linux/common/bits/sched.h
@@ -1,7 +1,6 @@
/* Definitions of constants and data structure for POSIX 1003.1b-1993
scheduling interface.
- Copyright (C) 1996-1999,2001-2003,2005,2006,2007,2008
- Free Software Foundation, Inc.
+ Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -26,14 +25,17 @@
/* Scheduling algorithms. */
-#define SCHED_OTHER 0
-#define SCHED_FIFO 1
-#define SCHED_RR 2
+#define SCHED_OTHER 0
+#define SCHED_FIFO 1
+#define SCHED_RR 2
#ifdef __USE_GNU
-# define SCHED_BATCH 3
+# define SCHED_BATCH 3
+# define SCHED_IDLE 5
+
+# define SCHED_RESET_ON_FORK 0x40000000
#endif
-#ifdef __USE_MISC
+#ifdef __USE_GNU
/* Cloning flags. */
# define CSIGNAL 0x000000ff /* Signal mask to be sent at exit. */
# define CLONE_VM 0x00000100 /* Set if VM shared between processes. */
@@ -58,7 +60,6 @@
force CLONE_PTRACE on this clone. */
# define CLONE_CHILD_SETTID 0x01000000 /* Store TID in userlevel buffer in
the child. */
-# define CLONE_STOPPED 0x02000000 /* Start in stopped state. */
# define CLONE_NEWUTS 0x04000000 /* New utsname group. */
# define CLONE_NEWIPC 0x08000000 /* New ipcs. */
# define CLONE_NEWUSER 0x10000000 /* New user namespace. */
@@ -75,7 +76,7 @@ struct sched_param
__BEGIN_DECLS
-#ifdef __USE_MISC
+#ifdef __USE_GNU
/* Clone current process. */
extern int clone (int (*__fn) (void *__arg), void *__child_stack,
int __flags, void *__arg, ...) __THROW;
@@ -85,8 +86,12 @@ extern int unshare (int __flags) __THROW;
/* Get index of currently used CPU. */
extern int sched_getcpu (void) __THROW;
+
+/* Switch process to namespace of type NSTYPE indicated by FD. */
+extern int setns (int __fd, int __nstype) __THROW;
#endif
+
__END_DECLS
#endif /* need schedparam */
@@ -124,7 +129,11 @@ typedef struct
} cpu_set_t;
/* Access functions for CPU masks. */
-# define __CPU_ZERO_S(setsize, cpusetp) \
+# if __GNUC_PREREQ (2, 91)
+# define __CPU_ZERO_S(setsize, cpusetp) \
+ do __builtin_memset (cpusetp, '\0', setsize); while (0)
+# else
+# define __CPU_ZERO_S(setsize, cpusetp) \
do { \
size_t __i; \
size_t __imax = (setsize) / sizeof (__cpu_mask); \
@@ -132,47 +141,53 @@ typedef struct
for (__i = 0; __i < __imax; ++__i) \
__bits[__i] = 0; \
} while (0)
+# endif
# define __CPU_SET_S(cpu, setsize, cpusetp) \
(__extension__ \
({ size_t __cpu = (cpu); \
- __cpu < 8 * (setsize) \
+ __cpu / 8 < (setsize) \
? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \
|= __CPUMASK (__cpu)) \
: 0; }))
# define __CPU_CLR_S(cpu, setsize, cpusetp) \
(__extension__ \
({ size_t __cpu = (cpu); \
- __cpu < 8 * (setsize) \
+ __cpu / 8 < (setsize) \
? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \
&= ~__CPUMASK (__cpu)) \
: 0; }))
# define __CPU_ISSET_S(cpu, setsize, cpusetp) \
(__extension__ \
({ size_t __cpu = (cpu); \
- __cpu < 8 * (setsize) \
- ? ((((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \
+ __cpu / 8 < (setsize) \
+ ? ((((const __cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \
& __CPUMASK (__cpu))) != 0 \
: 0; }))
# define __CPU_COUNT_S(setsize, cpusetp) \
__sched_cpucount (setsize, cpusetp)
-# define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \
+# if __GNUC_PREREQ (2, 91)
+# define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \
+ (__builtin_memcmp (cpusetp1, cpusetp2, setsize) == 0)
+# else
+# define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \
(__extension__ \
- ({ __cpu_mask *__arr1 = (cpusetp1)->__bits; \
- __cpu_mask *__arr2 = (cpusetp2)->__bits; \
+ ({ const __cpu_mask *__arr1 = (cpusetp1)->__bits; \
+ const __cpu_mask *__arr2 = (cpusetp2)->__bits; \
size_t __imax = (setsize) / sizeof (__cpu_mask); \
size_t __i; \
for (__i = 0; __i < __imax; ++__i) \
if (__arr1[__i] != __arr2[__i]) \
break; \
__i == __imax; }))
+# endif
# define __CPU_OP_S(setsize, destset, srcset1, srcset2, op) \
(__extension__ \
({ cpu_set_t *__dest = (destset); \
- __cpu_mask *__arr1 = (srcset1)->__bits; \
- __cpu_mask *__arr2 = (srcset2)->__bits; \
+ const __cpu_mask *__arr1 = (srcset1)->__bits; \
+ const __cpu_mask *__arr2 = (srcset2)->__bits; \
size_t __imax = (setsize) / sizeof (__cpu_mask); \
size_t __i; \
for (__i = 0; __i < __imax; ++__i) \