Date: Fri, 18 Aug 2000 01:21:23 +0100 From: Brian Somers <brian@Awfulhak.org> To: Warner Losh <imp@village.org> Cc: Karl Pielorz <kpielorz@tdx.co.uk>, hackers@FreeBSD.ORG, brian@Awfulhak.org Subject: Re: Critical (or equivalent) section in Userland? Message-ID: <200008180021.e7I0LOF43257@hak.lan.Awfulhak.org> In-Reply-To: Message from Warner Losh <imp@village.org> of "Thu, 17 Aug 2000 11:23:37 MDT." <200008171723.LAA12924@harmony.village.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> In message <399BA212.A84240AE@tdx.co.uk> Karl Pielorz writes: > : I'm writing a program under FreeBSD 3.X that has been forced into having to > : make a number of rename() calls that must be completed atomically (i.e. all > : together) without the process being interrupted, or any other process being > : allowed to run... > > If advisory locks won't work (and they almost always will for things > like this), then you could walk the process tree. For all processes > that aren't suspended or yourself, send a SIGSTOP, keep a list. Keep > going through the tree while you keep finding processes. SIGSTOP > can't be caught or blocked, so you know you've stopped them). Do your > operation, then send SIGCONT to all the processes that you sent a > SIGSTOP to. Of course, this will likely be much harder than doing > advisory locking, but might be a way that you might be able to exactly > what you want. Wow, forgive me for saying this, but it must take a warped mind to think of that !!! :-) Now if the original poster could arrange that all the files are either in the same directory or symlinked to the same directory, a quick directory rename (or symlink move) may do the job. If that's not atomic enough, you could always replace that chunk of filesystem with a mount(). > Warner > > P.S. Can you tell I'm partial to advisory locks? -- Brian <brian@Awfulhak.org> <brian@[uk.]FreeBSD.org> <http://www.Awfulhak.org> <brian@[uk.]OpenBSD.org> Don't _EVER_ lose your sense of humour ! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200008180021.e7I0LOF43257>