You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Karl Fogel <kf...@galois.collab.net> on 2000/09/08 20:39:35 UTC

APR question

How does one use APR to copy a file?  I was looking for something like:

   apr_status_t apr_copy_file (const char *src, const char *dst);

but it doesn't appear to exist.  The analogous remove and rename
functions do exist, though.

Should I not be using APR for that?

-Karl

Re: APR question

Posted by Karl Fogel <kf...@galois.collab.net>.
Manoj Kasichainula <ma...@collab.net> writes:
> Someone on the linux-kernel list reimplemented cp using sendfile() and
> got a 40% performance boost when everything was cached.

That was the sort of thing I had in mind.  But if APR doesn't do it,
Subversion certainly isn't, given that APR is our portability
layer. :-)  So I'm writing copy_file() now...

-K

Re: APR question

Posted by Manoj Kasichainula <ma...@collab.net>.
On Fri, Sep 08, 2000 at 03:59:15PM -0500, Karl Fogel wrote:
> The latter.  Sure I can write a read/write loop, but I would think
> that some systems might provide faster ways to do it (i.e., using
> fancy block sizes during the copy that make everything happen
> lightning quick... or is that just wishful thinking, and most Unix
> cp's are just a standard read/write loop anyway?)

Someone on the linux-kernel list reimplemented cp using sendfile() and
got a 40% performance boost when everything was cached.

Re: APR question

Posted by Karl Fogel <kf...@galois.collab.net>.
Greg Stein <gs...@lyra.org> writes:
> Why don't you write a function and I'll check it into APR? The other OS's
> could then optimize at will. If you want to write the function somewhere in
> SVN, then I'll just copy/port it over to the right place (with the
> appropriate APR framework's magic pixie dust).

Okay, I'll let you know when & where it's done (please review & change
as necessary of course).

-K

Re: APR question

Posted by Greg Stein <gs...@lyra.org>.
On Fri, Sep 08, 2000 at 03:59:15PM -0500, Karl Fogel wrote:
> Greg Stein <gs...@lyra.org> writes:
> > Not sure I understand. You would write a function which used APR to do the
> > read/write. Or are you asking whether APR "should" have a copy function?
> 
> The latter.  Sure I can write a read/write loop, but I would think
> that some systems might provide faster ways to do it (i.e., using
> fancy block sizes during the copy that make everything happen
> lightning quick... or is that just wishful thinking, and most Unix
> cp's are just a standard read/write loop anyway?)

Why don't you write a function and I'll check it into APR? The other OS's
could then optimize at will. If you want to write the function somewhere in
SVN, then I'll just copy/port it over to the right place (with the
appropriate APR framework's magic pixie dust).

Good call -- this would be a good addition to APR.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Re: APR question

Posted by Karl Fogel <kf...@galois.collab.net>.
Greg Stein <gs...@lyra.org> writes:
> Not sure I understand. You would write a function which used APR to do the
> read/write. Or are you asking whether APR "should" have a copy function?

The latter.  Sure I can write a read/write loop, but I would think
that some systems might provide faster ways to do it (i.e., using
fancy block sizes during the copy that make everything happen
lightning quick... or is that just wishful thinking, and most Unix
cp's are just a standard read/write loop anyway?)

Re: APR question

Posted by Greg Stein <gs...@lyra.org>.
On Fri, Sep 08, 2000 at 03:39:35PM -0500, Karl Fogel wrote:
> How does one use APR to copy a file?  I was looking for something like:
> 
>    apr_status_t apr_copy_file (const char *src, const char *dst);
> 
> but it doesn't appear to exist.  The analogous remove and rename
> functions do exist, though.

Correct. There is no function for copying a file -- you would need to write
one which used a read/write loop to copy the file.

> Should I not be using APR for that?

Not sure I understand. You would write a function which used APR to do the
read/write. Or are you asking whether APR "should" have a copy function?

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/