1UNLINK(2) 386BSD Programmer's Manual UNLINK(2) 2 3NNAAMMEE 4 uunnlliinnkk - remove directory entry 5 6SSYYNNOOPPSSIISS 7 ##iinncclluuddee <<uunniissttdd..hh>> 8 9 _i_n_t 10 uunnlliinnkk(_c_o_n_s_t _c_h_a_r *_p_a_t_h) 11 12DDEESSCCRRIIPPTTIIOONN 13 The uunnlliinnkk() function removes the link named by _p_a_t_h from its directory 14 and decrements the link count of the file which was referenced by the 15 link. If that decrement reduces the link count of the file to zero, and 16 no process has the file open, then all resources associated with the file 17 are reclaimed. If one or more process have the file open when the last 18 link is removed, the link is removed, but the removal of the file is 19 delayed until all references to it have been closed. 20 21RREETTUURRNN VVAALLUUEESS 22 Upon successful completion, a value of 0 is returned. Otherwise, a value 23 of -1 is returned and _e_r_r_n_o is set to indicate the error. 24 25EERRRROORRSS 26 The uunnlliinnkk() succeeds unless: 27 28 [ENOTDIR] A component of the path prefix is not a directory. 29 30 [EINVAL] The pathname contains a character with the high-order bit 31 set. 32 33 [ENAMETOOLONG] A component of a pathname exceeded 255 characters, or an 34 entire path name exceeded 1023 characters. 35 36 [ENOENT] The named file does not exist. 37 38 [EACCES] Search permission is denied for a component of the path 39 prefix. 40 41 [EACCES] Write permission is denied on the directory containing 42 the link to be removed. 43 44 [ELOOP] Too many symbolic links were encountered in translating 45 the pathname. 46 47 [EPERM] The named file is a directory and the effective user ID 48 of the process is not the super-user. 49 50 [EPERM] The directory containing the file is marked sticky, and 51 neither the containing directory nor the file to be 52 removed are owned by the effective user ID. 53 54 [EBUSY] The entry to be unlinked is the mount point for a mounted 55 file system. 56 57 [EIO] An I/O error occurred while deleting the directory entry 58 or deallocating the inode. 59 60 [EROFS] The named file resides on a read-only file system. 61 62 [EFAULT] _P_a_t_h points outside the process's allocated address 63 space. 64 65SSEEEE AALLSSOO 66 close(2), link(2), rmdir(2) 67 68HHIISSTTOORRYY 69 An uunnlliinnkk function call appeared in Version 6 AT&T UNIX. 70 714th Berkeley Distribution March 10, 1991 2 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133