unlink(2) DG/UX 4.30 unlink(2)
NAME
unlink - Remove a directory entry.
SYNOPSIS
int unlink (path)
char * path;
PARAMETERS
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
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 and no entries in the channel store, the file is
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.
Licensed material--property of copyright holder(s) Page 1
unlink(2) DG/UX 4.30 unlink(2)
-1 An error occurred. Errno is set to indicate
the error.
EXCEPTIONS
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.
ETXTBSY The last link of a pure procedure may not be
removed while a file is executing.
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.
Licensed material--property of copyright holder(s) Page 2
unlink(2) DG/UX 4.30 unlink(2)
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
The related manual sections: rm(1),
close(2), link(2), open(2).
Licensed material--property of copyright holder(s) Page 3