Date: Sun, 15 Feb 2004 10:19:00 -0700 (MST) From: "M. Warner Losh" <imp@bsdimp.com> To: drosih@rpi.edu Cc: hackers@freebsd.org Subject: Re: Adding 'realclean' target to /usr/src/Makefile Message-ID: <20040215.101900.20429400.imp@bsdimp.com> In-Reply-To: <p0602040fbc54cd0d3342@[128.113.24.47]> References: <p0602040fbc54cd0d3342@[128.113.24.47]>
next in thread | previous in thread | raw e-mail | index | archive | help
In message: <p0602040fbc54cd0d3342@[128.113.24.47]>
Garance A Drosihn <drosih@rpi.edu> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040215.101900.20429400.imp>
