mount(2) mount(2)
NAME
mount - mount a file system
SYNOPSIS
#include <sys/types.h>
#include <sys/mount.h>
int mount(const char *spec, const char *dir, int mflag,
.../* int fstyp, const char *dataptr, sizet datalen */);
DESCRIPTION
mount() mounts a removable file system contained in the block special
file identified by spec in the directory identified by dir. spec and
dir are pointers to pathnames. The argument fstyp is interpreted by
mount() when either MSFSS or MSDATA is set in mflag. fstyp is the
file system type number or a pointer to a string containing the file
system type. The sysfs(2) system call can be used to determine the
file system type number. If neither MSDATA or MSFSS is set in mflag,
mount() defaults to the root file system type.
If the MSDATA flag is set in mflag the system expects the dataptr and
datalen arguments to be present. Together they describe a block of
file-system specific data at address dataptr of length datalen. This
is interpreted by file-system specific code within the operating sys-
tem and its format depends on the file system type. If a particular
file system type does not require this data, dataptr and datalen
should both be zero. If the file system is to be mounted as read-only,
MSRDONLY must be set in mflag.
After a successful call to mount(), the name in dir refers to the root
directory on the newly mounted file system.
mount() may be invoked only by the superuser. The interface is
intended for use only by the mount(1M) utility.
mount() fails if one or more of the following apply:
EBUSY dir is currently mounted on, is someone's current work-
ing directory, or is otherwise busy.
EBUSY The special file associated with spec is currently
mounted.
EBUSY There are no more mount table entries.
EFAULT spec, dir, or datalen points outside the allocated
address space of the process.
EINVAL The super block has an invalid magic number or the fstyp
is invalid.
Page 1 Reliant UNIX 5.44 Printed 11/98
mount(2) mount(2)
ELOOP Too many symbolic links were encountered in compiling
dir.
ENAMETOOLONG The length of the dir argument exceeds PATHMAX or
NAMEMAX.
ENOENT One of the named files does not exist.
ENOTDIR A component of a path prefix is not a directory.
EPERM The effective user ID is not superuser.
EREMOTE spec is remote and cannot be mounted.
ENOLINK dir points to a remote machine and the link to that
machine is no longer active.
EMULTIHOP Components of dir require hopping to multiple remote
machines.
ENOTBLK spec is not a block special file.
ENXIO The special file associated with spec does not exist.
ENOTDIR dir is not a directory.
EROFS spec is write protected and mflag requests write permis-
sion.
ENOSPC The file system state in the super-block is not FsOKAY
and mflag requests write permission.
RESULT
Upon successful completion a value of 0 is returned. Otherwise, a
value of -1 is returned and errno is set to indicate the error.
SEE ALSO
mount(1M), sysfs(2), umount(2), fs(4).
Page 2 Reliant UNIX 5.44 Printed 11/98