Bug 44841

Summary: New function: apr_file_link()
Product: APR Reporter: Mark Heily <mark>
Component: APRAssignee: Apache Portable Runtime bugs mailinglist <bugs>
Status: RESOLVED FIXED    
Severity: enhancement CC: bojan
Priority: P2 Keywords: PatchAvailable
Version: HEAD   
Target Milestone: ---   
Hardware: Other   
OS: All   
Attachments: new function: apr_file_link()
new function: apr_file_link()

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!