Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752487AbcDMPls (ORCPT ); Wed, 13 Apr 2016 11:41:48 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:58907 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752435AbcDMPlq (ORCPT ); Wed, 13 Apr 2016 11:41:46 -0400 Message-Id: <1460562105.353100.577697153.013DF466@webmail.messagingengine.com> X-Sasl-Enc: yrmePryjqrI8KPSkcFSSF14rspUH/6gnaVLw935saR4M 1460562105 From: Colin Walters To: "Richard W.M. Jones" , linux-kernel@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, akpm@linux-foundation.org, luto@kernel.org, viro@zeniv.linux.org.uk, mathieu.desnoyers@efficios.com, zab@redhat.com, emunson@akamai.com, paulmck@linux.vnet.ibm.com, aarcange@redhat.com, josh@joshtriplett.org, xemul@parallels.com, sfr@canb.auug.org.au, milosz@adfin.com, rostedt@goodmis.org, arnd@arndb.de, ebiederm@xmission.com, gorcunov@openvz.org, iulia.manda21@gmail.com, dave.hansen@linux.intel.com, mguzik@redhat.com, adobriyan@gmail.com, dave@stgolabs.net, linux-api@vger.kernel.org, gorcunov@gmail.com, fw@deneb.enyo.de MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-7bc02efc Subject: Re: [PATCH v2 0/2] vfs: Define new syscall getumask. Date: Wed, 13 Apr 2016 11:41:45 -0400 In-Reply-To: <1460552272-15985-1-git-send-email-rjones@redhat.com> References: <1460552272-15985-1-git-send-email-rjones@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 776 Lines: 17 On Wed, Apr 13, 2016, at 08:57 AM, Richard W.M. Jones wrote: > It's not possible to read the process umask without also modifying it, > which is what umask(2) does. A library cannot read umask safely, > especially if the main program might be multithreaded. I assume you just want to do this from a shared library so you can determine whether or not you need to call fchown() after making files and the like? If that's the case it'd be good to note it in the commit message. BTW...it might be a good idea to add a flags argument: https://lwn.net/Articles/585415/ Did you consider calling this `umask2`, having the initial version only support retrieving it via a UMASK_GET flag, and lay the groundwork to support setting a threadsafe umask with a UMASK_SET_THREAD flag?