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