Re: [patch 08/14] syslets: x86, add create_async_thread() method

From: Evgeniy Polyakov
Date: Sat Feb 17 2007 - 06:46:08 EST


On Thu, Feb 15, 2007 at 05:52:39PM +0100, Ingo Molnar (mingo@xxxxxxx) wrote:
> +/*
> + * Create an async thread
> + */
> +int create_async_thread(int (*fn)(void *), void * arg, unsigned long flags)
> +{
> + struct pt_regs regs;
> +
> + memset(&regs, 0, sizeof(regs));
> +
> + regs.ebx = (unsigned long) fn;
> + regs.edx = (unsigned long) arg;
> +
> + regs.xds = __USER_DS;
> + regs.xes = __USER_DS;
> + regs.xgs = __KERNEL_PDA;
> + regs.orig_eax = -1;
> + regs.eip = (unsigned long) async_thread_helper;
> + regs.xcs = __KERNEL_CS | get_kernel_rpl();
> + regs.eflags = X86_EFLAGS_IF | X86_EFLAGS_SF | X86_EFLAGS_PF | 0x2;
> +
> + /* Ok, create the new task.. */
> + return do_fork(flags, 0, &regs, 0, NULL, NULL);
> +}

What about complete disabling of signals and only enabling them in the
thread which returns to userspace?

--
Evgeniy Polyakov
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/