Copyright (C) 2000-2012 |
Manpages LINKSection: Linux Programmer's Manual (2)Updated: 1997-12-10 Index Return to Main Contents NAMElink - make a new name for a fileSYNOPSIS#include <unistd.h>int link(const char *oldpath, const char *newpath); DESCRIPTIONlink creates a new link (also known as a hard link) to an existing file.If newpath exists it will not be overwritten. This new name may be used exactly as the old one for any operation; both names refer to the same file (and so have the same permissions and ownership) and it is impossible to tell which name was the `original'. RETURN VALUEOn success, zero is returned. On error, -1 is returned, and errno is set appropriately.ERRORS
NOTESHard links, as created by link, cannot span filesystems. Use symlink if this is required.CONFORMING TOSVr4, SVID, POSIX, BSD 4.3, X/OPEN. SVr4 documents additional ENOLINK and EMULTIHOP error conditions; POSIX.1 does not document ELOOP. X/OPEN does not document EFAULT, ENOMEM or EIO.BUGSOn NFS file systems, the return code may be wrong in case the NFS server performs the link creation and dies before it can say so. Use stat(2) to find out if the link got created.SEE ALSOsymlink(2), unlink(2), rename(2), open(2), stat(2), ln(1)
IndexThis document was created by man2html, using the manual pages. Time: 15:43:00 GMT, January 15, 2025 |