From owner-freebsd-standards@FreeBSD.ORG Wed Feb 6 21:38:37 2013 Return-Path: Delivered-To: standards@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 5BE04815 for ; Wed, 6 Feb 2013 21:38:37 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (unknown [IPv6:2001:610:1108:5012::107]) by mx1.freebsd.org (Postfix) with ESMTP id 26E8FBF1 for ; Wed, 6 Feb 2013 21:38:37 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 729991200BA; Wed, 6 Feb 2013 22:38:20 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id 373972848C; Wed, 6 Feb 2013 22:38:20 +0100 (CET) Date: Wed, 6 Feb 2013 22:38:20 +0100 From: Jilles Tjoelker To: Konstantin Belousov Subject: Re: ERESTART translation in kern_openat() Message-ID: <20130206213819.GA82715@stack.nl> References: <20130204183117.GD2522@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130204183117.GD2522@kib.kiev.ua> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: standards@freebsd.org X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Feb 2013 21:38:37 -0000 On Mon, Feb 04, 2013 at 08:31:17PM +0200, Konstantin Belousov wrote: > you noted somewhere that the unconditional translation of the ERESTART > to EINTR, performed by kern_openat(), is wrong. I mostly agree with > your statement, e.g. it is definitely wrong for fifos, but translation > itself is useful for devfs, in my opinion. E.g., you do not want > the tape unwind to be restarted this way. > I propose not to remove the translation, but limit it to devfs only. > See the patch below. > Any comments ? Please commit. A note in the man page may be useful, like: If a blocking open of a device is interrupted by a signal, the call always fails with [EINTR] even if SA_RESTART is set for the signal. A blocking open of a fifo is restarted as normal. > diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c > index 9851229..7da9b11 100644 > --- a/sys/fs/devfs/devfs_vnops.c > +++ b/sys/fs/devfs/devfs_vnops.c > @@ -1089,8 +1089,11 @@ devfs_open(struct vop_open_args *ap) > > vn_lock(vp, vlocked | LK_RETRY); > dev_relthread(dev, ref); > - if (error) > + if (error != 0) { > + if (error == ERESTART) > + error = EINTR; > return (error); > + } > > #if 0 /* /dev/console */ > KASSERT(fp != NULL, ("Could not vnode bypass device on NULL fp")); > diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c > index 1a5f2ae..dd1232c 100644 > --- a/sys/kern/vfs_syscalls.c > +++ b/sys/kern/vfs_syscalls.c > @@ -1106,8 +1106,6 @@ kern_openat(struct thread *td, int fd, char *path, enum uio_seg pathseg, > goto success; > } > > - if (error == ERESTART) > - error = EINTR; > goto bad; > } > td->td_dupfd = 0; -- Jilles Tjoelker