From mboxrd@z Thu Jan 1 00:00:00 1970 From: "H. Peter Anvin" Subject: O_CAREFUL flag to disable open() side effects Date: Thu, 27 Jul 2006 10:33:23 -0700 Message-ID: <44C8F8E3.1070306@zytor.com> References: <1154021616.13509.68.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Pekka J Enberg , Ulrich Drepper , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, akpm@osdl.org, viro@zeniv.linux.org.uk, tytso@mit.edu, tigran@veritas.com Return-path: Received: from terminus.zytor.com ([192.83.249.54]:49316 "EHLO terminus.zytor.com") by vger.kernel.org with ESMTP id S1751899AbWG0ReD (ORCPT ); Thu, 27 Jul 2006 13:34:03 -0400 To: Alan Cox In-Reply-To: <1154021616.13509.68.camel@localhost.localdomain> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Alan Cox wrote: > Ar Iau, 2006-07-27 am 20:05 +0300, ysgrifennodd Pekka J Enberg: >> Sure. Though I wonder if sys_frevoke is enough for us and we can drop >> sys_revoke completely. > > Alas not. Some Unix devices have side effects when you open() them. > Dumb thought: would it make sense to add an O_CAREFUL flag to open(), to disable side effects? It seems that a number of devices have this issue and one have to jump through weird hoops to configure them. Obviously, a file descriptor obtained with O_CAREFUL may not be fully functional, at the device driver's option. For a conventional file, directory, or block device O_CAREFUL is a no-op. For ttys it would typically behave similar to O_NONBLOCK followed immediately by a fcntl to clear the nonblock flag. -hpa