1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
|
'\" 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 <sys/mount.h>
\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
\fBmount\fR(2), \fBprivileges\fR(5)
|