Re: [RFC][v8][PATCH 0/10] Implement clone3() system call

From: Albert Cahalan
Date: Mon Oct 26 2009 - 05:39:03 EST


Sukadev Bhattiprolu writes:

> struct clone_struct {
> u64 flags;
> u64 child_stack;
> u32 nr_pids;
> u32 reserved1;
> u64 parent_tid;
> u64 child_tid;
> u64 reserved2;
> };
>
> sys_clone3(struct clone_struct __user *cs, pid_t __user *pids)

We'll be needing a clone4() for ia64 if you don't include the
stack_size parameter.

You have a prime opportunity to fix a portability problem that
has been quite a pain for some time. There are currently 3 cases
that userspace has to suffer with:

1. specify one end of the stack with clone
2. specify the other end of the stack with clone (HP PA-RISC)
3. specify the base and size with clone2 (IA-64)

Portable code ends up with an icky #ifdef mess.

BTW, the extra stack info is also useful for other purposes.
It's information that could appear in /proc/*/maps data.
With an extra flag, thread stacks could be freed on thread exit
so that other threads don't have to babysit an exiting thread.
--
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/