mount, umount - Mounts or unmounts a file system
#include <sys/types.h> #include <sys/mount.h>
int datalen ); int umount (const
SVR4 Library (libsvr4)
Points to a path name that is a removable file system contained on the
block special file. Points to a path name that is the directory on
which spec is mounted. Specifies whether additional file system data
is included. The valid flag is MS_DATA. Specifies the file system type
number. Points to the address of a block of file system specific data.
Specifies the length of the file system specific data. Points to a
null-terminated string containing the appropriate pathname.
The mount() function mounts a removable file system contained on the
block special file identified by spec. The dir argument identifies the
When the MS_DATA flag bit of mflag is off, the file system type
defaults to the root file system type. Only when the MS_DATA flag bit
is on, should you use the fstyp argument to indicate the file system
type. Also, the dataptr and datalen arguments, which describe a block
of file system specific data, must be present when the MS_DATA flag is
set. The file system specific code within the operating system inter‐
prets the data. The data's format depends on the file system type. If a
file system type does not require this data, dataptr and datalen should
both be zero.
Use the low-order bit of mflag to control write permission on the
mounted file system. If the low-order bit is 1, writing is forbidden;
otherwise, writing is permitted according to individual file accessi‐
After a successful mount(), references to the dir file refer to the
mounted file system's root directory.
The umount() function unmounts a file system mounted at the directory
pointed to the mnt-path parameter. The associated directory reverts to
its ordinary interpretation.
Except for file-on-file mounting, to call either the mount() and
umount() function, the calling process must have superuser privilege.
The mount command supports mount point argument pathnames of up to
MNAMELEN, which includes the null terminating character. MNAMELEN can
be up to 90 characters long, including the null terminating character.
The mount() function returns 0 when the file system is successfully
mounted. Otherwise, -1 is returned and errno is set to indicate the
If the mount() function fails, errno may be set to one of the following
values: The effective user ID is not super-user. Any of the named
files does not exist. A component of a path prefix is not a directory.
The file system identified by spec is remote and cannot be mounted.
The path argument points to a remote machine and the link to that
machine is no longer active. Components of path require hopping to
multiple remote machines. The spec argument is not a block special
device. The device associated with spec does not exist. The dir argu‐
ment is not a directory. The spec or dir argument points outside the
allocated address space of the process. The dir argument is a user's
current working directory, is mounted on a user's current working
directory, or is otherwise busy. The device associated with spec is
currently mounted. There are no more mount table entries. The spec is
write protected and mflag requests write permission. The file system
state in the super-block is not FsOKAY and mflag requests write permis‐
sion. The super block has an invalid magic number or the fstyp is
invalid or mflag is not valid.
If the umount() function fails, errno may be set to one of the follow‐
ing values: The caller does not have appropriate privilege. A compo‐
nent of the path is not a directory. The pathname contains a character
with the high-order bit set. A component of a pathname exceeded
NAME_MAX characters, or an entire pathname exceeded PATH_MAX charac‐
ters. Too many symbolic links were encountered in translating the
pathname. The requested directory is not in the mount table. A
process is holding a reference to a file located on the file system.
An I/O error occurred while writing cached file system information.
The mnt-path parameter points outside the process' allocated address
space. The device identified by the mnt-path does not exist. The
named file does not exist.