umount -- Unmounts a File System

SYNOPSIS

 #include <sys/types.h>
 #include <sys/stat.h>

 int umount(const char *fileSystem, mtm_t mountMode);
 

DESCRIPTION

umount unmounts a file system from the hierarchical file system. The fileSystem argument is a pointer to a null-terminated string containing the name of the file system to be removed.

The name specified by fileSystem must match the name specified as an argument to the mount function when the file system was mounted. Like the mount function, umount can be issued only by a superuser.

mountMode can be any one of the following symbolic names:

MTM_UMOUNT
is a normal unmount request. The unmount is performed if the specified file system is not in use, and the request is rejected if it is in use.
MTM_DRAIN
is an unmount drain request. MTM_DRAIN waits until all use of the specified file system is terminated and then unmounts the file system.
MTM_IMMED
is an immediate unmount request. The specified file system is unmounted immediately. Any users of files in the specified file system undergo a forced failure. All data changes that were made prior to the immediate unmount request are saved. If the data cannot be saved, the immediate unmount request fails.
MTM_FORCE
is a forced unmount request. The specified file system is unmounted immediately. Any users of files in the specified file system undergo a forced failure. All data changes that were made prior to the immediate unmount request are saved. However, unlike the immediate unmount request, a forced unmount will continue even if the data cannot be saved. As a result, data may be lost with a forced unmount request.
MTM_RESET
is a reset unmount request. The reset request is used to stop an unmount drain request that is waiting for the file system to become available before performing the unmount operation.

PORTABILITY

The umount function is useful in OpenEdition applications; however, it is not defined by the POSIX.1 standard and should not be used in portable applications.

RETURN VALUE

umount returns a 0 if successful and a -1 if unsuccessful.

EXAMPLE

The following code fragment illustrates the use of umount to unmount a file system:
 #include <sys/types.h>
 #include <sys/stat.h>

 main()
 {
 char *HFS = "POSIX.FILE.SYSTEM";
 .
 .
 .
 umount(HFS, MTM_DRAIN);
 .
 .
 .
 }
 

RELATED FUNCTIONS

mount, w_getmntent


Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.