unlink(2) DG/UX 5.4.2 unlink(2)
NAME
unlink - remove a directory entry
SYNOPSIS
#include <unistd.h>
int unlink (path)
char * path;
where:
path Address of a pathname
DESCRIPTION
Unlink removes the directory entry named by the pathname pointed to
by path from the filename store. A symbolic link occurring at the
end of path will not be followed. The named file must reside on a
file system device mounted read-write.
The subject file must be of type `ordinary-disk-file', `block-
special-file', `character-special-file', `fifo-special-file',
`socket', or `symbolic-link'.
It is an error to attempt an unlink call on a directory or control
point directory type file.
Removing a reference to a file in the filename store has the
following consequences:
⊕ The subject file's link count attribute is decremented.
⊕ The subject file's `time-last-attribute-changed' attribute is
set to the current time.
⊕ If the subject file has no more links in the filename store,
then on the release of the last reference, the file will
removed from the flat file store. Thus, unlink deletes
inactive files.
⊕ If the subject file has no more links in the filename store
but is still open, then the file is removed from the
filesystem when it is closed for the last time.
If unlink fails, no changes are made to the named file.
ACCESS CONTROL
The calling process must have permission to resolve path.
The calling process must have write permission to the directory
containing the entry to be removed.
RETURN VALUE
0 The filename was successfully removed.
-1 An error occurred. errno is set to indicate the error.
Licensed material--property of copyright holder(s) 1
unlink(2) DG/UX 5.4.2 unlink(2)
DIAGNOSTICS
Errno may be set to one of the following error codes:
EACCES Permission to modify the directory containing the
entry to be removed is denied to the calling process.
EBUSY The named file is the mount point of a file system
device.
EPERM The named file is a directory.
EROFS The named file is contained on a read-only file system
device.
ENOENT The file the pathname resolved to does not exist.
ENOENT A non-terminal component of the pathname does not
exist.
ENOTDIR A non-terminal component of the pathname was not a
directory or symbolic link.
ENAMETOOLONG The pathname exceeds the length limit for pathnames.
ENAMETOOLONG A component of the pathname exceeds the length limit
for filenames.
ENOMEM There are not enough system resources to resolve the
pathname or to expand a symbolic link.
ELOOP The number of symbolic links encountered during
pathname resolution exceeded MAXSYMLINKS. A symbolic
link cycle is suspected.
EPERM The pathname contains a character not in the allowed
character set.
EFAULT The pathname does not completely reside in the
process's address space or the pathname does not
terminate in the process's address space.
SEE ALSO
rm(1), close(2), link(2), open(2).
Licensed material--property of copyright holder(s) 2