mount.2 (2010 09)
m
mount(2) mount(2)
NAME
mount() - mount a file system
SYNOPSIS
#include <sys/mount.h>
int mount(const char *fs, const char *path, int mflag);
int mount(const char *fs,
const char *path,
int mflag,
const char *fstype,
const char *dataptr,
int datalen);
DESCRIPTION
The mount() system call requests that a file system identified by fs be mounted on the file identified by
path.
mflag contains a bit-mask of flags (described below). Note that the
MS_DATA flag must be set for the six-
argument version of the call.
fstype is the file system type name. It is the same name that
sysfs() uses.
The last two arguments together 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 system and its format
depends upon the file system type. A particular file system type may not require this data, in which case
dataptr and datalen should both be zero. The mounting of some file system types may be restricted to a
user with appropriate privileges.
mount() can be invoked only by a user who has appropriate privileges.
Upon successful completion, references to the file path will refer to the root directory of the mounted file
system.
mflag contains a bit-mask of flag values, which includes the following defined in
<sys/mount.h>:
MS_DATA This is ordinarily required. It indicates the presence of the fstype, dataptr , and
datalen arguments.
(For backward compatibility, if this flag is not set, the fstype is assumed to be that
of the root file system, and dataptr and datalen are assumed to be zero.)
MS_RDONLY This is used to control write permission on the mounted file system. If not set, writ-
ing is permitted according to individual file accessibility.
MS_NOSUID This flag disables set-user-ID and set-group-ID behavior on this file system.
MS_QUOTA
MS_USRQUOTA
This causes user quotas to be enabled if the file system supports user quotas.
MS_GRPQUOTA
This causes group quotas to be enabled if the file system supports group quotas.
If fstype is specified as:
MNTTYPE_HFS
Mount a local HFS file system. dataptr points to a structure of the following for-
mat, if the options described below need to be specified for the mount:
struct ufs_args {
char *fspec;
int flags;
};
fspec points to the name of the block special file that is to be mounted. This is
identical in use and function to the first argument, fs, of the system call.
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1