UMOUNT(2) | System Calls | UMOUNT(2) |
umount, umount2 - unmount a file system
#include <sys/mount.h> int umount(const char *file);
int umount2(const char *file, int mflag);
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 absolute 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 interpretation.
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
MS_FORCE
Upon successful completion, 0 is returned. Otherwise, −1 is returned and errno is set to indicate the error.
The umount() and umount2() functions will fail if:
EACCES
The calling process is not the owner of the mountpoint.
The mountpoint is not a regular file or a directory and the caller does not have all privileges available in a its zone.
The special device device does not permit read access in the case of read-only mounts or read-write access in the case of read/write mounts.
EBUSY
EFAULT
EINVAL
ELOOP
ENAMETOOLONG
ENOENT
ENOLINK
ENOTBLK
EPERM
EREMOTE
The umount2() function will fail if:
ENOTSUP
The umount() and umount2() functions can be invoked only by a process that has the {PRIV_SYS_MOUNT} privilege asserted in its effective set.
Because it provides greater functionality, the umount2() function is preferred.
August 4, 2008 | OmniOS |