'\" te .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved. .\" Copyright 1989 AT&T. .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] .TH UMOUNT 2 "Aug 4, 2008" .SH NAME umount, umount2 \- unmount a file system .SH SYNOPSIS .LP .nf #include \fBint\fR \fBumount\fR(\fBconst char *\fR\fIfile\fR); .fi .LP .nf \fBint\fR \fBumount2\fR(\fBconst char *\fR\fIfile\fR, \fBint\fR \fImflag\fR); .fi .SH DESCRIPTION .sp .LP The \fBumount()\fR function requests that a previously mounted file system contained on a block special device or directory be unmounted. The \fIfile\fR 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. .sp .LP The \fBumount2()\fR function is identical to \fBumount()\fR, with the additional capability of unmounting file systems even if there are open files active. The \fImflag\fR argument must contain one of the following values: .sp .ne 2 .na \fB0\fR .ad .RS 12n Perform a normal unmount that is equivalent to \fBumount()\fR. The \fBumount2()\fR function returns \fBEBUSY\fR if there are open files active within the file system to be unmounted. .RE .sp .ne 2 .na \fB\fBMS_FORCE\fR\fR .ad .RS 12n Unmount the file system, even if there are open files active. A forced unmount can result in loss of data, so it should be used only when a regular unmount is unsuccessful. The \fBumount2()\fR function returns \fBENOTSUP\fR if the specified file systems does not support \fBMS_FORCE\fR. Only file systems of type \fBnfs\fR, \fBufs\fR, \fBpcfs\fR, and \fBzfs\fR support \fBMS_FORCE\fR. .RE .SH RETURN VALUES .sp .LP Upon successful completion, \fB0\fR is returned. Otherwise, \fB\(mi1\fR is returned and \fBerrno\fR is set to indicate the error. .SH ERRORS .sp .LP The \fBumount()\fR and \fBumount2()\fR functions will fail if: .sp .ne 2 .na \fB\fBEACCES\fR\fR .ad .RS 16n The permission bits of the mount point do not permit read/write access or search permission is denied on a component of the path prefix. .sp The calling process is not the owner of the mountpoint. .sp The mountpoint is not a regular file or a directory and the caller does not have all privileges available in a its zone. .sp 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. .RE .sp .ne 2 .na \fB\fBEBUSY\fR\fR .ad .RS 16n A file on \fIfile\fR is busy. .RE .sp .ne 2 .na \fB\fBEFAULT\fR\fR .ad .RS 16n The file pointed to by \fIfile\fR points to an illegal address. .RE .sp .ne 2 .na \fB\fBEINVAL\fR\fR .ad .RS 16n The file pointed to by \fIfile\fR is not mounted. .RE .sp .ne 2 .na \fB\fBELOOP\fR\fR .ad .RS 16n Too many symbolic links were encountered in translating the path pointed to by \fIfile\fR. .RE .sp .ne 2 .na \fB\fBENAMETOOLONG\fR\fR .ad .RS 16n The length of the \fIfile\fR argument exceeds \fIPATH_MAX\fR, or the length of a \fIfile\fR component exceeds \fINAME_MAX\fR while \fB_POSIX_NO_TRUNC\fR is in effect. .RE .sp .ne 2 .na \fB\fBENOENT\fR\fR .ad .RS 16n The file pointed to by \fIfile\fR does not exist or is not an absolute path. .RE .sp .ne 2 .na \fB\fBENOLINK\fR\fR .ad .RS 16n The file pointed to by \fIfile\fR is on a remote machine and the link to that machine is no longer active. .RE .sp .ne 2 .na \fB\fBENOTBLK\fR\fR .ad .RS 16n The file pointed to by \fIfile\fR is not a block special device. .RE .sp .ne 2 .na \fB\fBEPERM\fR\fR .ad .RS 16n The {\fBPRIV_SYS_MOUNT\fR} privilege is not asserted in the effective set of the calling process. .RE .sp .ne 2 .na \fB\fBEREMOTE\fR\fR .ad .RS 16n The file pointed to by \fIfile\fR is remote. .RE .sp .LP The \fBumount2()\fR function will fail if: .sp .ne 2 .na \fB\fBENOTSUP\fR\fR .ad .RS 11n The file pointed to by \fIfile\fR does not support this operation. .RE .SH USAGE .sp .LP The \fBumount()\fR and \fBumount2()\fR functions can be invoked only by a process that has the {\fBPRIV_SYS_MOUNT\fR} privilege asserted in its effective set. .sp .LP Because it provides greater functionality, the \fBumount2()\fR function is preferred. .SH SEE ALSO .sp .LP .BR mount (2), .BR privileges (7)