[RFC][v4][PATCH 7/7]: Define clone_extended() syscall

Serge E. Hallyn serue at us.ibm.com
Thu Aug 6 11:35:15 PDT 2009


Quoting Sukadev Bhattiprolu (sukadev at linux.vnet.ibm.com):
> | I think Suka's suggestion is again inherently limited (in # of
> | clone flags) and will force even uglier syscalls for each arch than the
> | previous one already does.
> | 
> 
> Yes other architectures are forced to ignore the flags_high and copy-in the
> tid pointers.
> 
> But if we want more than 64 bit flags, we may need follow the sigset_t 
> model ?
> 
> Also, I am listing three approaches below. Do you prefer #2 below ?

I prefer #2 with 'struct pid_set' renamed to clone_ext_data or something,
and either a version # or int num_clone_words so we can add clone flags
later.  I know, adding more then 32 more clone flags seems unlikely, but...

> 1. =====
> 
>         struct clone_tid_info {
>                 void *parent_tid;       /* parent_tid_ptr parameter */
>                 void *child_tid;        /* child_tid_ptr parameter */
>         };
> 
>         struct pid_set {
>                 int num_pids;
>                 pid_t *pids;
>         };
> 
>         int clone_extended(int flags_low, int flags_high, void *child_stack,
>                         void *unused, struct clone_tid_info *tid_ptrs,
>                         struct pid_set *pid_setp);
> 
> 2. ======
> 
> 	struct clone_info {
> 		int flags_high;
> 		struct pid_set pid_set;
> 	}
> 
>         int clone_extended(int flags_low, void *child_stack, void *unused,
> 		int *parent_tid, int *child_tid, struct clone_info *clone_info);
> 
> 
> 	Pros:
> 		- copy_from_user() needed only for new flags and pid_set
> 
> 	Cons:
> 		- splitting the high and low clone-flags is awkward ?
> 
> 3. =====
> 
> 	typedef struct {
> 		unsigned long flags[N_CLONE_FLAGS];
> 	} clone_flags_t;
> 
> 	int clone_extended(clone_flags_t *flags, void *child_stack, int *unused,
> 		int *parent_tid, int *child_tid, struct pid_set *pid_set);
> 
> 
> 	Pros:
> 		- extendible clone_flags (like sigset_t)
> 		- no copy_from_user() when we have 32 clone-flags
> 		- no copy_from_user for tids
> 
> 	Cons:
> 		- copy_from_user() needed on 32-bit architectures for all flags
> 		  when they exceed 32.
> 
> 
> Sukadev


More information about the Containers mailing list