From: Charles S. <bas...@ch...> - 2012-06-25 16:42:42
|
On Jun 25, 2012, at 11:29 AM, Alexei Svitkine wrote: > On Sun, Jun 24, 2012 at 3:46 PM, Charles Srstka <bas...@ch...>wrote: > I just tested this on Snow Leopard and Lion, and it works. When you’ve got a disk image mounted, open(path, O_RDWR | O_EXLOCK | O_NONBLOCK) fails with EAGAIN. If I’ve got a disk image open with O_EXLOCK and then I try to mount it in the Finder, DiskImageMounter fails with “Resource temporarily unavailable”. So this should do what you want without having to monkey with permanent metadata bits on the file. > > Cool! Does this work well if SheepShaver crashes? (e.g. does the lock get removed in that case?) When I kill -9 the test app I made, subsequent attempts to mount the dmg seem to work. Charles |