bionic/recv.c \
bionic/sched_cpualloc.c \
bionic/sched_cpucount.c \
- bionic/sched_getcpu.c \
bionic/semaphore.c \
bionic/send.c \
bionic/setpgrp.c \
bionic/sbrk.cpp \
bionic/scandir.cpp \
bionic/sched_getaffinity.cpp \
+ bionic/sched_getcpu.cpp \
bionic/setegid.cpp \
bionic/__set_errno.cpp \
bionic/seteuid.cpp \
int lremovexattr(const char*, const char*) all
int __statfs64:statfs64(const char*, size_t, struct statfs*) arm,mips,x86
int statfs(const char*, struct statfs*) aarch64,x86_64
-long unshare(unsigned long) all
int swapon(const char*, int) all
int swapoff(const char*) all
int sched_get_priority_min(int policy) all
int sched_rr_get_interval(pid_t pid, struct timespec* interval) all
int sched_setaffinity(pid_t pid, size_t setsize, const cpu_set_t* set) all
+int setns(int, int) all
+int unshare(int) all
int __sched_getaffinity:sched_getaffinity(pid_t pid, size_t setsize, cpu_set_t* set) all
-int __getcpu:getcpu(unsigned* cpu, unsigned* node, void* unused) all
+int __getcpu:getcpu(unsigned*, unsigned*, void*) all
# io priorities
int ioprio_set(int which, int who, int ioprio) all
syscall_src += arch-aarch64/syscalls/setgid.S
syscall_src += arch-aarch64/syscalls/setgroups.S
syscall_src += arch-aarch64/syscalls/setitimer.S
+syscall_src += arch-aarch64/syscalls/setns.S
syscall_src += arch-aarch64/syscalls/setpgid.S
syscall_src += arch-aarch64/syscalls/setpriority.S
syscall_src += arch-aarch64/syscalls/setregid.S
--- /dev/null
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setns)
+ stp x29, x30, [sp, #-16]!
+ mov x29, sp
+ str x8, [sp, #-16]!
+
+ mov x8, __NR_setns
+ svc #0
+
+ ldr x8, [sp], #16
+ ldp x29, x30, [sp], #16
+
+ cmn x0, #(MAX_ERRNO + 1)
+ cneg x0, x0, hi
+ b.hi __set_errno
+
+ ret
+END(setns)
syscall_src += arch-arm/syscalls/setgid.S
syscall_src += arch-arm/syscalls/setgroups.S
syscall_src += arch-arm/syscalls/setitimer.S
+syscall_src += arch-arm/syscalls/setns.S
syscall_src += arch-arm/syscalls/setpgid.S
syscall_src += arch-arm/syscalls/setpriority.S
syscall_src += arch-arm/syscalls/setregid.S
--- /dev/null
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setns)
+ mov ip, r7
+ ldr r7, =__NR_setns
+ swi #0
+ mov r7, ip
+ cmn r0, #(MAX_ERRNO + 1)
+ bxls lr
+ neg r0, r0
+ b __set_errno
+END(setns)
syscall_src += arch-mips/syscalls/setgid.S
syscall_src += arch-mips/syscalls/setgroups.S
syscall_src += arch-mips/syscalls/setitimer.S
+syscall_src += arch-mips/syscalls/setns.S
syscall_src += arch-mips/syscalls/setpgid.S
syscall_src += arch-mips/syscalls/setpriority.S
syscall_src += arch-mips/syscalls/setregid.S
--- /dev/null
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <asm/unistd.h>
+ .text
+ .globl setns
+ .align 4
+ .ent setns
+
+setns:
+ .set noreorder
+ .cpload $t9
+ li $v0, __NR_setns
+ syscall
+ bnez $a3, 1f
+ move $a0, $v0
+ j $ra
+ nop
+1:
+ la $t9,__set_errno
+ j $t9
+ nop
+ .set reorder
+ .end setns
syscall_src += arch-x86/syscalls/setgid.S
syscall_src += arch-x86/syscalls/setgroups.S
syscall_src += arch-x86/syscalls/setitimer.S
+syscall_src += arch-x86/syscalls/setns.S
syscall_src += arch-x86/syscalls/setpgid.S
syscall_src += arch-x86/syscalls/setpriority.S
syscall_src += arch-x86/syscalls/setregid.S
--- /dev/null
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setns)
+ pushl %ebx
+ pushl %ecx
+ mov 12(%esp), %ebx
+ mov 16(%esp), %ecx
+ movl $__NR_setns, %eax
+ int $0x80
+ cmpl $-MAX_ERRNO, %eax
+ jb 1f
+ negl %eax
+ pushl %eax
+ call __set_errno
+ addl $4, %esp
+ orl $-1, %eax
+1:
+ popl %ecx
+ popl %ebx
+ ret
+END(setns)
syscall_src += arch-x86_64/syscalls/setgid.S
syscall_src += arch-x86_64/syscalls/setgroups.S
syscall_src += arch-x86_64/syscalls/setitimer.S
+syscall_src += arch-x86_64/syscalls/setns.S
syscall_src += arch-x86_64/syscalls/setpgid.S
syscall_src += arch-x86_64/syscalls/setpriority.S
syscall_src += arch-x86_64/syscalls/setregid.S
--- /dev/null
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(setns)
+ movl $__NR_setns, %eax
+ syscall
+ cmpq $-MAX_ERRNO, %rax
+ jb 1f
+ negl %eax
+ movl %eax, %edi
+ call __set_errno
+ orq $-1, %rax
+1:
+ ret
+END(setns)
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
+
#define _GNU_SOURCE 1
#include <sched.h>
-extern int __getcpu(unsigned *cpu, unsigned *node, void* unused);
-
-int sched_getcpu(void)
-{
- unsigned cpu;
- if (__getcpu(&cpu, NULL, NULL) < 0)
- return 0;
+extern "C" int __getcpu(unsigned*, unsigned*, void*);
- return (int)cpu;
+int sched_getcpu() {
+ unsigned cpu;
+ int rc = __getcpu(&cpu, NULL, NULL);
+ if (rc == -1) {
+ return -1; // errno is already set.
+ }
+ return cpu;
}
#include <sys/cdefs.h>
#include <sys/time.h>
+#include <linux/sched.h>
+
__BEGIN_DECLS
-#define SCHED_NORMAL 0
-#define SCHED_OTHER 0
-#define SCHED_FIFO 1
-#define SCHED_RR 2
+/* This name is used by glibc, but not by the kernel. */
+#define SCHED_OTHER SCHED_NORMAL
struct sched_param {
- int sched_priority;
+ int sched_priority;
};
-extern int sched_setscheduler(pid_t, int, const struct sched_param *);
+extern int sched_setscheduler(pid_t, int, const struct sched_param*);
extern int sched_getscheduler(pid_t);
extern int sched_yield(void);
-extern int sched_get_priority_max(int policy);
-extern int sched_get_priority_min(int policy);
-extern int sched_setparam(pid_t, const struct sched_param *);
-extern int sched_getparam(pid_t, struct sched_param *);
-extern int sched_rr_get_interval(pid_t pid, struct timespec *tp);
-
-#define CLONE_VM 0x00000100
-#define CLONE_FS 0x00000200
-#define CLONE_FILES 0x00000400
-#define CLONE_SIGHAND 0x00000800
-#define CLONE_PTRACE 0x00002000
-#define CLONE_VFORK 0x00004000
-#define CLONE_PARENT 0x00008000
-#define CLONE_THREAD 0x00010000
-#define CLONE_NEWNS 0x00020000
-#define CLONE_SYSVSEM 0x00040000
-#define CLONE_SETTLS 0x00080000
-#define CLONE_PARENT_SETTID 0x00100000
-#define CLONE_CHILD_CLEARTID 0x00200000
-#define CLONE_DETACHED 0x00400000
-#define CLONE_UNTRACED 0x00800000
-#define CLONE_CHILD_SETTID 0x01000000
-#define CLONE_STOPPED 0x02000000
-
-#ifdef _GNU_SOURCE
-extern int clone(int (*fn)(void *), void *child_stack, int flags, void* arg, ...);
-extern int unshare(int);
-#endif
+extern int sched_get_priority_max(int);
+extern int sched_get_priority_min(int);
+extern int sched_setparam(pid_t, const struct sched_param*);
+extern int sched_getparam(pid_t, struct sched_param*);
+extern int sched_rr_get_interval(pid_t, struct timespec*);
-/* Support for cpu thread affinity */
#ifdef _GNU_SOURCE
+extern int clone(int (*)(void*), void*, int, void*, ...);
+extern int unshare(int);
extern int sched_getcpu(void);
-
+extern int setns(int, int);
/* Our implementation supports up to 32 independent CPUs, which is also
* the maximum supported by the kernel at the moment. GLibc uses 1024 by
#define SYS_fcntl64 __NR_fcntl64
#define SYS_fdatasync __NR_fdatasync
#define SYS_fgetxattr __NR_fgetxattr
+#define SYS_finit_module __NR_finit_module
#define SYS_flistxattr __NR_flistxattr
#define SYS_flock __NR_flock
#define SYS_fork __NR_fork
#define SYS_ioprio_get __NR_ioprio_get
#define SYS_ioprio_set __NR_ioprio_set
#define SYS_ipc __NR_ipc
+#define SYS_kcmp __NR_kcmp
#define SYS_kexec_load __NR_kexec_load
#define SYS_keyctl __NR_keyctl
#define SYS_kill __NR_kill
glibc_fp.write("#if defined(__aarch64__)\n")
self.scan_linux_unistd_h(glibc_fp, bionic_libc_root + "/kernel/uapi/asm-generic/unistd.h")
glibc_fp.write("#elif defined(__arm__)\n")
- self.scan_linux_unistd_h(glibc_fp, bionic_libc_root + "/kernel/arch-arm/asm/unistd.h")
+ self.scan_linux_unistd_h(glibc_fp, bionic_libc_root + "/kernel/uapi/asm-arm/asm/unistd.h")
glibc_fp.write("#elif defined(__mips__)\n")
self.scan_linux_unistd_h(glibc_fp, bionic_libc_root + "/kernel/uapi/asm-mips/asm/unistd.h")
glibc_fp.write("#elif defined(__i386__)\n")