umount2(2)
NAME
umount, umount2 - unmount a file system
SYNOPSIS
#include <sys/mount.h>
int umount(const char *file);
int umount2(const char *file, int mflag);
DESCRIPTION
The umount() function requests that a previously mounted
file system contained on a block special device or directory
be unmounted. The file argument is a pointer to the abso-
lute pathname of the file system to be unmounted. After
unmounting the file system, the directory upon which the
file system was mounted reverts to its ordinary interpreta-
tion.
The umount2() function is identical to umount(), with the
additional capability of unmounting file systems even if
there are open files active. The mflag argument must contain
one of the following values:
0 Perform a normal unmount that is equivalent to
umount(). The umount2() function returns EBUSY if
there are open files active within the file system to
be unmounted.
MS_FORCE
Unmount the file system, even if there are open files
active. A forced unmount may resort in loss of data,
so it should be used only when a regular unmount is
unsuccessful. The umount2() function returns ENOTSUP
if the specified file systems does not support
MS_FORCE. Currently only nfs- and ufs-type file sys-
tems support MS_FORCE.
RETURN VALUES
Upon successful completion, 0 is returned. Otherwise, -1 is
returned and errno is set to indicate the error.
ERRORS
The umount() and umount2() functions will fail if:
EBUSY A file on file is busy.
EFAULT
The file pointed to by file points to an illegal
address.
EINVAL
The file pointed to by file is not mounted.
ENOENT
The file pointed to by file does not exist.
ELOOP Too many symbolic links were encountered in translat-
ing the path pointed to by file.
ENAMETOOLONG
The length of the file argument exceeds PATH_MAX, or
the length of a file component exceeds NAME_MAX while
_POSIX_NO_TRUNC is in effect.
ENOLINK
The file pointed to by file is on a remote machine and
the link to that machine is no longer active.
ENOTBLK
The file pointed to by file is not a block special
device.
EPERM The process's effective user ID is not superuser.
EREMOTE
The file pointed to by file is remote.
The umount2() function will fail if:
ENOTSUP
The file pointed to by file does not support this
operation.
USAGE
The umount() and umount2() functions may be invoked only by
the superuser. Because it provides greater functionality,
the umount2() function is preferred.
SEE ALSO
mount(2)
Man(1) output converted with
man2html