Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Aug 2000 11:23:37 -0600
From:      Warner Losh <imp@village.org>
To:        Karl Pielorz <kpielorz@tdx.co.uk>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: Critical (or equivalent) section in Userland? 
Message-ID:  <200008171723.LAA12924@harmony.village.org>
In-Reply-To: Your message of "Thu, 17 Aug 2000 09:28:02 BST." <399BA212.A84240AE@tdx.co.uk> 
References:  <399BA212.A84240AE@tdx.co.uk>  

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.

Well, you may need an exception list of processes if your files aren't
on a local disk, but if they aren't on a local disk, this whole
excersize is pointless, right?

Warner

P.S.  Can you tell I'm partial to advisory locks?


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?200008171723.LAA12924>