umount or uvmount Subroutine

Purpose

Removes a virtual file system from the file tree.

Library

Standard C Library (libc.a)

Syntax

int umount ( Device)
char *Device;

#include <sys/vmount.h>

int uvmount ( VirtualFileSystemID,  Flag)
int VirtualFileSystemID;
int Flag;

Description

The umount and uvmount subroutines remove a virtual file system (VFS) from the file tree.

The umount subroutine unmounts only file systems mounted from a block device (a special file identified by its path to the block device).

In addition to local devices, the uvmount subroutine unmounts local or remote directories, identified by the VirtualFileSystemID parameter.

Only a calling process with root user authority or in the system group and having write access to the mount point can unmount a device, file and directory mount.

Parameters

Item Description
Device The path name of the block device to be unmounted for the umount subroutine.
VirtualFileSystemID The unique identifier of the VFS to be unmounted for the uvmount subroutine. This value is returned when a VFS is created by the vmount subroutine and may subsequently be obtained by the mntctl subroutine. The VirtualFileSystemID is also reported in the stat subroutine st_vfs field.
Flag Specifies special action for the uvmount subroutine. Currently only one value is defined:
UVMNT_FORCE
Force the unmount. This flag is ignored for device mounts.

Return Values

Upon successful completion a value of 0 is returned. Otherwise, a value of -1 is returned, and the errno global variable is set to indicate the error.

Error Codes

The uvmount subroutine fails if one of the following is true:

Item Description
EPERM The calling process does not have write permission to the root of the VFS, the mounted object is a device or remote, and the calling process does not have root user authority.
EINVAL No VFS with the specified VirtualFileSystemID parameter exists.
EBUSY A device that is still in use is being unmounted.

The umount subroutine fails if one of the following is true:

Item Description
EPERM The calling process does not have root user authority.
ENOENT The Device parameter does not exist.
ENOBLK The Device parameter is not a block device.
EINVAL The Device parameter is not mounted.
EINVAL The Device parameter is not local.
EBUSY A process is holding a reference to a file located on the file system.

The umount subroutine can be unsuccessful for other reasons. For a list of additional errors, see Base Operating System error codes for services that require path-name resolution.