You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Tyler MacDonald <ty...@yi.org> on 2006/07/01 05:37:30 UTC

feasability of a portable fuser-type thing in APR?

I really only have experience with Linux and FreeBSD in this area...

How hard is it to portably determine if any other processes have a file
open, and whether they are readers and writers? I know APR has to work in
gads of OS'es including UNIX, Windows, Zeta, OS/2, etc... does anybody know
how easy it is to determine if anybody else is using a file in these
operating systems? If it's actually *possible* in the majority, then I'd
like to start working on a fuser/lsof-type interface for APR.

	Thanks,
		Tyler

Re: feasability of a portable fuser-type thing in APR?

Posted by Tyler MacDonald <ty...@yi.org>.
> Colm MacCarthaigh <co...@stdlib.net> wrote:
> > Each kernel has its own mechanism for this, ranging from trawling kernel
> > memory directly to iterating through /proc/, but I can't off-hand think
> > of an operating system which doesn't provide this functionality. On
> > windows I think you need admin privs even to scan your own processess
> > though.

Colm,
	Something just occured to me. In windows, if you try to move or
delete a file that is in use, it stops you. Is there a completely bonine
action one can do to a file in windows that causes the same error?

	I'm thinking that without admin powers, this code may still be able
to detect if a file is in use at all.

	Thanks,
		Tyler

Re: feasability of a portable fuser-type thing in APR?

Posted by Tyler MacDonald <ty...@yi.org>.
Colm MacCarthaigh <co...@stdlib.net> wrote:
> Each kernel has its own mechanism for this, ranging from trawling kernel
> memory directly to iterating through /proc/, but I can't off-hand think
> of an operating system which doesn't provide this functionality. On
> windows I think you need admin privs even to scan your own processess
> though.

	That's promising... I should start digging in sometime in the next
few weeks, thanks!

	Do you think this should be an operation on a filehandle, or on a
stat, or it's own separate thing? I'm leaning towards stat right now since
that's where link counts go and a filehandle is a "link" of sorts to a
file...

		- Tyler


Re: feasability of a portable fuser-type thing in APR?

Posted by Colm MacCarthaigh <co...@stdlib.net>.
On Fri, Jun 30, 2006 at 08:37:30PM -0700, Tyler MacDonald wrote:
> How hard is it to portably determine if any other processes have a file
> open, and whether they are readers and writers? 

Each kernel has its own mechanism for this, ranging from trawling kernel
memory directly to iterating through /proc/, but I can't off-hand think
of an operating system which doesn't provide this functionality. On
windows I think you need admin privs even to scan your own processess
though.

-- 
Colm MacCárthaigh                        Public Key: colm+pgp@stdlib.net