mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-07 15:01:44 +00:00
preparation for generic kernel_thread()
Let architectures select GENERIC_KERNEL_THREAD and have their copy_thread() treat NULL regs as "it came from kernel_thread(), sp argument contains the function new thread will be calling and stack_size - the argument for that function". Switching the architectures begins shortly... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
a4d94ff8aa
commit
2aa3a7f866
3 changed files with 18 additions and 1 deletions
|
@ -258,6 +258,9 @@ config ARCH_WANT_OLD_COMPAT_IPC
|
||||||
select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
|
select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
|
||||||
bool
|
bool
|
||||||
|
|
||||||
|
config GENERIC_KERNEL_THREAD
|
||||||
|
bool
|
||||||
|
|
||||||
config HAVE_ARCH_SECCOMP_FILTER
|
config HAVE_ARCH_SECCOMP_FILTER
|
||||||
bool
|
bool
|
||||||
help
|
help
|
||||||
|
|
|
@ -2325,6 +2325,9 @@ extern int do_execve(const char *,
|
||||||
const char __user * const __user *, struct pt_regs *);
|
const char __user * const __user *, struct pt_regs *);
|
||||||
extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *);
|
extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *);
|
||||||
struct task_struct *fork_idle(int);
|
struct task_struct *fork_idle(int);
|
||||||
|
#ifdef CONFIG_GENERIC_KERNEL_THREAD
|
||||||
|
extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
|
||||||
|
#endif
|
||||||
|
|
||||||
extern void set_task_comm(struct task_struct *tsk, char *from);
|
extern void set_task_comm(struct task_struct *tsk, char *from);
|
||||||
extern char *get_task_comm(char *to, struct task_struct *tsk);
|
extern char *get_task_comm(char *to, struct task_struct *tsk);
|
||||||
|
|
|
@ -1609,7 +1609,7 @@ long do_fork(unsigned long clone_flags,
|
||||||
* requested, no event is reported; otherwise, report if the event
|
* requested, no event is reported; otherwise, report if the event
|
||||||
* for the type of forking is enabled.
|
* for the type of forking is enabled.
|
||||||
*/
|
*/
|
||||||
if (likely(user_mode(regs)) && !(clone_flags & CLONE_UNTRACED)) {
|
if (!(clone_flags & CLONE_UNTRACED) && likely(user_mode(regs))) {
|
||||||
if (clone_flags & CLONE_VFORK)
|
if (clone_flags & CLONE_VFORK)
|
||||||
trace = PTRACE_EVENT_VFORK;
|
trace = PTRACE_EVENT_VFORK;
|
||||||
else if ((clone_flags & CSIGNAL) != SIGCHLD)
|
else if ((clone_flags & CSIGNAL) != SIGCHLD)
|
||||||
|
@ -1659,6 +1659,17 @@ long do_fork(unsigned long clone_flags,
|
||||||
return nr;
|
return nr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_GENERIC_KERNEL_THREAD
|
||||||
|
/*
|
||||||
|
* Create a kernel thread.
|
||||||
|
*/
|
||||||
|
pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
|
||||||
|
{
|
||||||
|
return do_fork(flags|CLONE_VM|CLONE_UNTRACED, (unsigned long)fn, NULL,
|
||||||
|
(unsigned long)arg, NULL, NULL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef ARCH_MIN_MMSTRUCT_ALIGN
|
#ifndef ARCH_MIN_MMSTRUCT_ALIGN
|
||||||
#define ARCH_MIN_MMSTRUCT_ALIGN 0
|
#define ARCH_MIN_MMSTRUCT_ALIGN 0
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue