From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 15 09:20:01 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C4B0116A4D0; Sun, 15 Feb 2004 09:20:01 -0800 (PST) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6C4BD43D1F; Sun, 15 Feb 2004 09:20:01 -0800 (PST) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.10/8.12.9) with ESMTP id i1FHJvnJ084564; Sun, 15 Feb 2004 10:19:57 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Sun, 15 Feb 2004 10:19:00 -0700 (MST) Message-Id: <20040215.101900.20429400.imp@bsdimp.com> To: drosih@rpi.edu From: "M. Warner Losh" In-Reply-To: References: X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: hackers@freebsd.org Subject: Re: Adding 'realclean' target to /usr/src/Makefile X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Feb 2004 17:20:01 -0000 In message: Garance A Drosihn writes: : realclean : : rm -Rf ${.OBJDIR}/* I'd make that be more like: realclean : @chflags -R 0 ${.OBJDIR}/* @rm -Rf ${.OBJDIR}/* since sometimes you wind up files that have flags set on them. I once looked into hacking rm to do that in one step, but couldn't figure out a way to do it race free and punted. There was no notion of a funlink. this is conceptually as close as I got: fd = open(path, O_RDRW); /*1*/ fchflags(fd, 0); unlink(path); /*2*/ which races between /*1*/ and /*2*/. If you can tolerate errors in the output, the following is faster because the chflags has lots less work to do: realclean : @rm -Rf ${.OBJDIR}/* @chflags -R 0 ${.OBJDIR}/* @rm -Rf ${.OBJDIR}/* Warner