From owner-freebsd-current@freebsd.org Fri Aug 14 14:46:27 2015 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73EB39B934B; Fri, 14 Aug 2015 14:46:27 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FD1319F5; Fri, 14 Aug 2015 14:46:26 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from Julian-MBP3.local (ppp121-45-227-250.lns20.per1.internode.on.net [121.45.227.250]) (authenticated bits=0) by vps1.elischer.org (8.15.2/8.15.2) with ESMTPSA id t7EEkGBM008245 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 14 Aug 2015 07:46:19 -0700 (PDT) (envelope-from julian@freebsd.org) To: freebsd-current , "freebsd-fs@freebsd.org" From: Julian Elischer Subject: futimens and utimensat vs birthtime Message-ID: <55CDFF32.7050601@freebsd.org> Date: Fri, 14 Aug 2015 22:46:10 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Aug 2015 14:46:27 -0000 So, currently the method of setting birthtime on a file is an awkward combination of tricks. These break down in a number of situations, but the one I'm specifically interested in is as follows: windows robocopy running through samba, onto a ZFS filesystem. (may happen for UFS2 as well.) In order to mark a file as 'incomplete' during transfer, windows sets the modification time to Jan 1, 1980. This triggers code in our system to set the birthtime to Jan 1 1980. it then, on completion of the file sets the modification and birth times to the correct values. This fails becasue you can not make a birthtime later than what it is already set to. As the Man page for utimensat() says: "Ideally a new system call will be added that allows the setting of all three times at once." I would like to implement this call. but would like input as to it's nature. The code inside the system would already appear to support handling three elements, though it needs some scrutiny, so all that is needed is a system call with the ability to set the birthtime directly. Whether it should take the form of the existing calls but expecting three items is up for discussion. Maybe teh addition of a flags argument to specify which items are present and which to set. ideas? Julian