Bug 44841 - New function: apr_file_link()
Summary: New function: apr_file_link()
Status: RESOLVED FIXED
Alias: None
Product: APR
Classification: Unclassified
Component: APR (show other bugs)
Version: HEAD
Hardware: Other All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Apache Portable Runtime bugs mailinglist
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2008-04-18 16:05 UTC by Mark Heily
Modified: 2008-07-24 20:42 UTC (History)
1 user (show)



Attachments
new function: apr_file_link() (5.75 KB, patch)
2008-04-18 16:05 UTC, Mark Heily
Details | Diff
new function: apr_file_link() (4.00 KB, patch)
2008-04-18 16:56 UTC, Mark Heily
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Heily 2008-04-18 16:05:55 UTC
Created attachment 21829 [details]
new function: apr_file_link() 

I propose adding a new function to APR file_io module: apr_file_link(). 

This function creates a hard link from one file to another file and is a core POSIX system call. The attached patch includes a Unix and Win32 implementation, along with a unit test named 'testfilelink'.

See the POSIX documentation for link(2) for more information about the system call. Windows implements this for NTFS filesystems using the CreateHardLink() function.

Thank you, and my ASF contributor agreement was sent to the Foundation via US Postal service yesterday.

Regards,

  - Mark Heily
Comment 1 Mark Heily 2008-04-18 16:56:23 UTC
Created attachment 21830 [details]
new function: apr_file_link() 

The previous patch was missing a change to Makefile.in, so I simplified it and merged the unit test into the 'testfilecopy' test. Now there are no changes to the build system :)
Comment 2 Bojan Smojver 2008-07-24 17:18:20 UTC
Committed to the trunk. Thanks for the patch!

We have a commit then review policy, so people on the list may have comments. Stay tuned.
Comment 3 Tom Donovan 2008-07-24 20:42:46 UTC
Windows CreateHardLink() takes 3 args, 
 per: http://msdn.microsoft.com/en-us/library/aa363860(VS.85).aspx

Since all platforms use unix/copy.c - moved apr_file_link to open.c for unix to keep it in the same place on all platforms.

Work fine on Windows now.  Nice addition to apr Mark!