summaryrefslogtreecommitdiff
path: root/src/basic/missing_syscall.h
diff options
context:
space:
mode:
authorMichael Karcher <github@mkarcher.dialup.fu-berlin.de>2016-05-30 02:03:51 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-05-29 20:03:51 -0400
commit8869a0b40b1cf82d264cabc2ff8052e8e35145a2 (patch)
tree44af1a533fd30d0792b91ca52f386ab5d776e7a9 /src/basic/missing_syscall.h
parent8d76eea87b29369c2ca70a95f0dc5c63b879a44f (diff)
util-lib: Add sparc64 support for process creation (#3348)
The current raw_clone function takes two arguments, the cloning flags and a pointer to the stack for the cloned child. The raw cloning without passing a "thread main" function does not make sense if a new stack is specified, as it returns in both the parent and the child, which will fail in the child as the stack is virgin. All uses of raw_clone indeed pass NULL for the stack pointer which indicates that both processes should share the stack address (so you better don't pass CLONE_VM). This commit refactors the code to not require the caller to pass the stack address, as NULL is the only sensible option. It also adds the magic code needed to make raw_clone work on sparc64, which does not return 0 in %o0 for the child, but indicates the child process by setting %o1 to non-zero. This refactoring is not plain aesthetic, because non-NULL stack addresses need to get mangled before being passed to the clone syscall (you have to apply STACK_BIAS), whereas NULL must not be mangled. Implementing the conditional mangling of the stack address would needlessly complicate the code. raw_clone is moved to a separete header, because the burden of including the assert machinery and sched.h shouldn't be applied to every user of missing_syscalls.h
Diffstat (limited to 'src/basic/missing_syscall.h')
-rw-r--r--src/basic/missing_syscall.h12
1 files changed, 0 insertions, 12 deletions
diff --git a/src/basic/missing_syscall.h b/src/basic/missing_syscall.h
index d502d3b9ca..e102083684 100644
--- a/src/basic/missing_syscall.h
+++ b/src/basic/missing_syscall.h
@@ -178,18 +178,6 @@ static inline int setns(int fd, int nstype) {
/* ======================================================================= */
-static inline int raw_clone(unsigned long flags, void *child_stack) {
-#if defined(__s390__) || defined(__CRIS__)
- /* On s390 and cris the order of the first and second arguments
- * of the raw clone() system call is reversed. */
- return (int) syscall(__NR_clone, child_stack, flags);
-#else
- return (int) syscall(__NR_clone, flags, child_stack);
-#endif
-}
-
-/* ======================================================================= */
-
static inline pid_t raw_getpid(void) {
#if defined(__alpha__)
return (pid_t) syscall(__NR_getxpid);