From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932950AbXC3XYf (ORCPT ); Fri, 30 Mar 2007 19:24:35 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S933099AbXC3XYf (ORCPT ); Fri, 30 Mar 2007 19:24:35 -0400 Received: from ug-out-1314.google.com ([66.249.92.173]:6090 "EHLO ug-out-1314.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932950AbXC3XYe (ORCPT ); Fri, 30 Mar 2007 19:24:34 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=beta; h=received:from:to:subject:date:user-agent:cc:references:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=jEV1Nv+9xjjxzCQ3huYlM/Wi7XyGSNRxo1WPmuIocSxLZjC+rztJAilfeioNL5kjtmZNMZnfpJvPtbXErN90x/BlzfYguUYbuvvMdNB2sGP72b30dzj9oJO7AsMN02PXlvek6Yr7hwi8SIWSZNpqGFLkuXULdXYe6BayzOsUxko= From: Denis Vlasenko To: Linus Torvalds Subject: Re: [patch 2/5] signalfd v2 - signalfd core ... Date: Sat, 31 Mar 2007 01:24:22 +0200 User-Agent: KMail/1.8.2 Cc: "Michael K. Edwards" , Davide Libenzi , "David M. Lloyd" , Linux Kernel Mailing List , Andrew Morton References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200703310124.22082.vda.linux@googlemail.com> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Thursday 08 March 2007 18:28, Linus Torvalds wrote: > The sad part is that there really is no reason why the BSD crowd couldn't > have done recvmsg() as an "extended read with per-system call flags", > which would have made things like O_NONBLOCK etc unnecessary, because you > could do it just with MSG_DONTWAIT.. Wait a second here... O_NONBLOCK is not just unnecessary - it's buggy! Try to do nonblocking read from stdin (fd #0) - * setting O_NONBLOCK with fcntl will set it for all other processes which has the same stdin! * trying to reset O_NONBLOCK after the read doesn't help (think kill -9) * duping fd #0 doesn't help because O_NONBLOCK is not per-fd, it's shared just like filepos. I really like that trick with recvmsg + MSG_DONTWAIT instead. -- vda