date and time created 91/03/06 18:09:53 by bostic
[unix-history] / usr / src / lib / libc / sys / unlink.2
... / ...
CommitLineData
1.\" Copyright (c) 1980 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
5.\" @(#)unlink.2 6.2 (Berkeley) %G%
6.\"
7.TH UNLINK 2 ""
8.UC 4
9.SH NAME
10unlink \- remove directory entry
11.SH SYNOPSIS
12.nf
13.ft B
14unlink(path)
15char *path;
16.fi
17.ft R
18.SH DESCRIPTION
19.I Unlink
20removes the entry for the file
21.I path
22from its directory.
23If this entry was the last link to the file,
24and no process has the file open, then
25all resources associated with the file are reclaimed.
26If, however, the file was open in any process, the actual
27resource reclamation is delayed until it is closed,
28even though the directory entry has disappeared.
29.SH "RETURN VALUE
30Upon successful completion, a value of 0 is returned.
31Otherwise, a value of \-1 is returned and
32.I errno
33is set to indicate the error.
34.SH "ERRORS
35The \fIunlink\fP succeeds unless:
36.TP 15
37[ENOTDIR]
38A component of the path prefix is not a directory.
39.TP 15
40[EINVAL]
41The pathname contains a character with the high-order bit set.
42.TP 15
43[ENAMETOOLONG]
44A component of a pathname exceeded 255 characters,
45or an entire path name exceeded 1023 characters.
46.TP 15
47[ENOENT]
48The named file does not exist.
49.TP 15
50[EACCES]
51Search permission is denied for a component of the path prefix.
52.TP 15
53[EACCES]
54Write permission is denied on the directory containing the link
55to be removed.
56.TP 15
57[ELOOP]
58Too many symbolic links were encountered in translating the pathname.
59.TP 15
60[EPERM]
61The named file is a directory and the effective user ID
62of the process is not the super-user.
63.TP 15
64[EPERM]
65The directory containing the file is marked sticky,
66and neither the containing directory nor the file to be removed
67are owned by the effective user ID.
68.TP 15
69[EBUSY]
70The entry to be unlinked is the mount point for a
71mounted file system.
72.TP 15
73[EIO]
74An I/O error occurred while deleting the directory entry
75or deallocating the inode.
76.TP 15
77[EROFS]
78The named file resides on a read-only file system.
79.TP 15
80[EFAULT]
81.I Path
82points outside the process's allocated address space.
83.SH "SEE ALSO"
84close(2), link(2), rmdir(2)