2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
11 #include <sys/ptrace.h>
13 #include "kern_util.h"
14 #include "user_util.h"
16 #include "time_user.h"
18 static int user_thread_tramp(void *arg)
20 if(ptrace(PTRACE_TRACEME, 0, 0, 0) < 0)
21 panic("user_thread_tramp - PTRACE_TRACEME failed, "
22 "errno = %d\n", errno);
24 os_stop_process(os_getpid());
28 int user_thread(unsigned long stack, int flags)
32 pid = clone(user_thread_tramp, (void *) stack_sp(stack),
33 flags | CLONE_FILES | SIGCHLD, NULL);
35 printk("user_thread - clone failed, errno = %d\n", errno);
39 CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED));
41 printk("user_thread - waitpid failed, errno = %d\n", errno);
45 if(!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGSTOP)){
46 printk("user_thread - trampoline didn't stop, status = %d\n",
55 * Overrides for Emacs so that we follow Linus's tabbing style.
56 * Emacs will notice this stuff at the end of the file and automatically
57 * adjust the settings for this buffer only. This must remain at the end
59 * ---------------------------------------------------------------------------
61 * c-file-style: "linux"