BSD 3 development
[unix-history] / usr / man / man2 / unlink.2
CommitLineData
e6817382
BJ
1.TH UNLINK 2
2.SH NAME
3unlink \- remove directory entry
4.SH SYNOPSIS
5.B unlink(name)
6.br
7.B char *name;
8.SH DESCRIPTION
9.I Name
10points to a null-terminated string.
11.I Unlink
12removes the entry for the file pointed to by
13.I name
14from its directory.
15If this entry was the last link to the file,
16the contents of the file are freed and the file is destroyed.
17If, however, the file was open in any process, the actual
18destruction is delayed until it is closed, even though
19the directory entry has disappeared.
20.SH "SEE ALSO"
21rm(1), link(2)
22.SH DIAGNOSTICS
23Zero is normally returned;
24\-1 indicates that the file does not
25exist, that its directory cannot be written,
26or that the file contains pure procedure text
27that is currently in use.
28Write permission is not required on the file itself.
29It is also illegal to unlink a directory
30(except for the super-user).
31.SH "ASSEMBLER (PDP-11)"
32(unlink = 10.)
33.br
34.B sys unlink; name