mount(2) CLIX mount(2)
NAME
mount - Mounts a file system
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
#include <sys/types.h>
#include <sys/mount.h>
int mount(
char *spec ,
char *dir ,
int mflag ,
int fstyp ,
caddr_t dataptr ,
int datalen );
PARAMETERS
spec Points to the pathname of the block special file that holds the
removable file system to be mounted.
dir Points to the pathname of the directory on which the file system
specified by spec is to be mounted.
mflag Flag bits. If set, the following rules apply:
MS_RDONLY The file system is mounted read only.
MS_FSS The file system type will default to the root file
system type, and the fstyp, dataptr and datalen
parameters are ignored.
MS_DATA The mount() function looks for datalen bytes of
mount option data at the address to which dataptr
points.
MS_CACHE Controls remote file server client caching.
fstyp Specifies the file system type number.
dataptr Points to data describing the mount options.
datalen Specifies the length of the mount option data.
DESCRIPTION
2/94 - Intergraph Corporation 1
mount(2) CLIX mount(2)
The mount() function requests that a removable file system contained on
the block special file spec be mounted on the directory dir. The fstyp
parameter is the type number of the file system being mounted. The
sysfs() function can be used to determine the file system type number. If
the MS_FSS flag bit of mflag is off, the file system type will default to
root file system type. If the bit is on, fstyp is used to indicate the
file system type. Additionally, if the MS_DATA flag is on in mflag,
dataptr and datalen are used to pass mount parameters to the system. If
MS_DATA is off or if dataptr is null or datalen is 0, no additional data
exists. In the normal case of a local mount, dataptr should be null.
When mounting a Network File SystemTM (NFS), dataptr should point to a
structure that describes the NFS mount options. (See the mount command.)
Upon successful completion, references to the file dir will refer to the
root directory on the mounted file system.
The MS_RDONLY bit of mflag controls write permission on the mounted file
system; if 1, writing is forbidden. Otherwise, writing is permitted
according to individual file accessibility.
EXAMPLES
To mount a read-only file system containing documentation:
if (mount("/dev/dsk/s0u0p7.4", "/doc", MS_RDONLY, 0, 0, 0) != 0)
perror("mount failed");
CAUTIONS
Only a superuser may invoke the mount() function. It is primarily
intended for the coding of the mount command.
RETURN VALUES
The mount() function returns 0 on success. The mount() function returns
-1 on failure, and sets errno to indicate the error.
ERRORS
The mount() function fails if one or more of the following is true:
[EPERM]
The effective user ID is not superuser.
[ENOENT]
None of the named files exist.
[ENOTDIR]
A component of a path prefix is not a directory.
2 Intergraph Corporation - 2/94
mount(2) CLIX mount(2)
[EREMOTE]
The spec parameter is remote and cannot be mounted.
[ENOLINK]
The path parameter points to a remote machine and the link to that
machine is no longer active.
[EMULTIHOP]
Components of path require hopping to multiple remote machines.
[ENOTBLK]
The spec parameter is not a block special device.
[ENXIO]
The device associated with spec does not exist.
[ENOTDIR]
The dir parameter is not a directory.
[EFAULT]
The spec or dir parameter points outside the allocated address
space of the process.
[EBUSY]
The dir parameter already contains a mounted file system, is
someone's current working directory, or is otherwise busy.
[EBUSY]
The device associated with spec is a currently mounted file system.
[EBUSY]
No more mount table entries exist.
[EROFS]
The spec parameter is write protected and mflag requests write
permission.
[ENOSPC]
The file system state in the superblock is not FsOKAY and mflag
requests write permission.
[EINVAL]
The superblock has a bad magic number, fstyp is not valid, or mflag
is not valid.
RELATED INFORMATION
Functions: sysfs(2), umount(2)
Files: fs(4)
2/94 - Intergraph Corporation 3