Penguin
Annotated edit history of unlink(2) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 UNLINK
2 !!!UNLINK
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 RETURN VALUE
7 ERRORS
8 CONFORMING TO
9 BUGS
10 SEE ALSO
11 ----
12 !!NAME
13
14
15 unlink - delete a name and possibly the file it refers to
16 !!SYNOPSIS
17
18
19 __#include __
20
21
22 __int unlink(const char
23 *__''pathname''__);__
24 !!DESCRIPTION
25
26
27 __unlink__ deletes a name from the filesystem. If that
28 name was the last link to a file and no processes have the
29 file open the file is deleted and the space it was using is
30 made available for reuse.
31
32
33 If the name was the last link to a file but any processes
34 still have the file open the file will remain in existence
35 until the last file descriptor referring to it is
36 closed.
37
38
39 If the name referred to a symbolic link the link is
40 removed.
41
42
43 If the name referred to a socket, fifo or device the name
44 for it is removed but processes which have the object open
45 may continue to use it.
46 !!RETURN VALUE
47
48
49 On success, zero is returned. On error, -1 is returned, and
50 ''errno'' is set appropriately.
51 !!ERRORS
52
53
54 __EACCES__
55
56
57 Write access to the directory containing ''pathname'' is
58 not allowed for the process's effective uid, or one of the
59 directories in ''pathname'' did not allow search
60 (execute) permission.
61
62
63 __EPERM__ or __EACCES__
64
65
66 The directory containing ''pathname'' has the sticky-bit
67 (__S_ISVTX__) set and the process's effective uid is
68 neither the uid of the file to be deleted nor that of the
69 directory containing it.
70
71
72 __EPERM__ (Linux only)
73
74
75 The filesystem does not allow unlinking of
76 files.
77
78
79 __EPERM__
80
81
82 The system does not allow unlinking of directories, or
83 unlinking of directories requires privileges that the
84 current process doesn't have. (This is the POSIX prescribed
85 error return.)
86
87
88 __EISDIR__
89
90
91 ''pathname'' refers to a directory. (This is the
92 non-POSIX value returned by Linux since
93 2.1.132.)
94
95
96 __EBUSY__ (not on Linux)
97
98
99 The file ''pathname'' cannot be unlinked because it is
100 being used by the system or another process and the
101 implementation considers this an error.
102
103
104 __EFAULT__
105
106
107 ''pathname'' points outside your accessible address
108 space.
109
110
111 __ENAMETOOLONG__
112
113
114 ''pathname'' was too long.
115
116
117 __ENOENT__
118
119
120 A directory component in ''pathname'' does not exist or
121 is a dangling symbolic link.
122
123
124 __ENOTDIR__
125
126
127 A component used as a directory in ''pathname'' is not,
128 in fact, a directory.
129
130
131 __ENOMEM__
132
133
134 Insufficient kernel memory was available.
135
136
137 __EROFS__
138
139
140 ''pathname'' refers to a file on a read-only
141 filesystem.
142
143
144 __ELOOP__
145
146
147 Too many symbolic links were encountered in translating
148 ''pathname''.
149
150
151 __EIO__
152
153
154 An I/O error occurred.
155 !!CONFORMING TO
156
157
158 SVr4, SVID, POSIX, X/OPEN, 4.3BSD. SVr4 documents additional
159 error conditions EINTR, EMULTIHOP, ETXTBSY,
160 ENOLINK.
161 !!BUGS
162
163
164 Infelicities in the protocol underlying NFS can cause the
165 unexpected disappearance of files which are still being
166 used.
167 !!SEE ALSO
168
169
170 link(2), rename(2), open(2),
171 rmdir(2), mknod(2), mkfifo(3),
172 remove(3), rm(1)
173 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.