From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MGkwR-0000Qc-Em for qemu-devel@nongnu.org; Tue, 16 Jun 2009 22:31:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MGkwJ-0000Od-LI for qemu-devel@nongnu.org; Tue, 16 Jun 2009 22:31:56 -0400 Received: from [199.232.76.173] (port=56254 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MGkwJ-0000OT-DL for qemu-devel@nongnu.org; Tue, 16 Jun 2009 22:31:51 -0400 Received: from mail2.shareable.org ([80.68.89.115]:36146) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MGkwJ-0001uy-0B for qemu-devel@nongnu.org; Tue, 16 Jun 2009 22:31:51 -0400 Date: Wed, 17 Jun 2009 03:31:49 +0100 From: Jamie Lokier Subject: Re: [Qemu-devel] [PATCH 16/21] linux-user: implement pipe2 [v3] Message-ID: <20090617023149.GU11893@shareable.org> References: <6ed5b469e54f235bef136cbd65e5769e205a2464.1244813287.git.riku.voipio@iki.fi> <20090616214429.GA17638@miranda.arrow> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090616214429.GA17638@miranda.arrow> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stuart Brady Cc: qemu-devel@nongnu.org Stuart Brady wrote: > On Fri, Jun 12, 2009 at 04:50:26PM +0300, riku.voipio@iki.fi wrote: > > +static abi_long do_pipe2(int host_pipe[], int flags) > > +{ > > +#ifdef CONFIG_PIPE2 > > + return pipe2(host_pipe, flags); > > +#else > > + return -ENOSYS; > > +#endif > > +} > > + > > +static abi_long do_pipe(void *cpu_env, int pipedes, int flags) > > +{ > > + int host_pipe[2]; > > + abi_long ret; > > + ret = flags ? do_pipe2(host_pipe, flags) : pipe(host_pipe); > > This worries me slightly -- surely syscalls should be consistently > supported / not supported (where feasible), regardless of the precise > arguments that are supplied? (Otherwise, any run-time check for pipe2 > would get tricked if that check specifies 0 for flags.) > > OTOH, I'm not sure what behaviour the library would provide for the > pipe2() function, if the pipe2 syscall is not available. One could > that the pipe2() function is another matter entirely, and that QEMU > shouldn't be too concerned with its implementation, though. As I've explained elsewhere, it is possible to emulate pipe2() and all the other tricksy *CLOEXEC syscalls, but it must be done carefully to provide the expected guarantees. -- Jamie