Re: testing for open files or volumes
On Tuesday, December 3, 2002, at 10:55 PM, Umesh Vaishampayan wrote: On Monday, December 2, 2002, at 10:36 PM, Alex Reynolds wrote: I was wondering if there are ways to test whether a file is open by another process under Darwin (and by extension Mac OS X)? Even if these was such an API, wow do you guarantee that the answer isn't stale by the time you get around to act on it? I'm a little confused by the meaning of stale -- if a removable volume can't be ejected when a file is open, wouldn't there have to be some mechanism at the kernel or a higher level that prevents this event? Once the file is closed, the volume must maintain some fresh information about this because the disk can then be unmounted pretty soon thereafter. I guess I'm looking for state information that would tell me whether a volume has an open file, or allow me to try to lock all files one by one (and have a lock attempt rejected if a file is locked elsewhere, indicating a busy volume). To me, the end result would be equivalent. I suppose I'm looking for something similar to how NFS manages to handle this issue, but none of the POSIX locking functions I've tried seem to hand back useful errors under OS X. -Alex _______________________________________________ darwin-kernel mailing list | darwin-kernel@lists.apple.com Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-kernel Do not post admin requests to the list. They will be ignored.
participants (1)
-
Alex Reynolds