From mboxrd@z Thu Jan 1 00:00:00 1970 From: "H. Peter Anvin" Subject: Re: [RFC][v5][PATCH 8/8]: Define clone_with_pids() syscall Date: Wed, 09 Sep 2009 08:51:59 -0700 Message-ID: <4AA7CF1F.3020408@zytor.com> References: <20090907211302.GA5892@us.ibm.com> <20090907211700.GH6685@us.ibm.com> <200909091419.50496.arnd@arndb.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <200909091419.50496.arnd-r2nGTMty4D4@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Arnd Bergmann Cc: Containers , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Nathan Lynch , "Eric W. Biederman" , mingo-X9Un+BFzKDI@public.gmane.org, Sukadev Bhattiprolu , torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org, Alexey Dobriyan , Pavel Emelyanov List-Id: containers.vger.kernel.org On 09/09/2009 05:19 AM, Arnd Bergmann wrote: > > This is a complex problem. The structure above would need a conversion > for the pointer size that you can avoid by using a u64, but that introduces > another problem: > > 2. use a single pointer, with variable length data structures: > > struct pid_set { > int num_pids; > pid_t pids[0]; > }; > > Since pid_t is always an int, you have no problem with padding or > incompatible types, but rely on a data structure definition that > is not in C89 (not sure about C99). > C90 has these data structures, but you have to give the array a nonzero length: struct pid_set { int num_pids; pid_t pids[1]; }; In C99, this is spelt: struct pid_set { int num_pids; pid_t pids[]; }; -hpa -- H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.