mount(2) mount(2)
NAME [Toc] [Back]
mount() - mount a file system
SYNOPSIS [Toc] [Back]
#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 [Toc] [Back]
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(2) uses.
The last two arguments together describe a block of file-systemspecific
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.)
Hewlett-Packard Company - 1 - HP-UX 11i Version 2: August 2003
mount(2) mount(2)
MS_RDONLY This is used to control write permission on the
mounted file system. If not set, writing 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 This causes quotas to be enabled if the file
system supports quotas.
If fstype is specified as:
MNTTYPE_HFS Mount a local HFS file system. dataptr points to
a structure of the following format, 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.
flags points to a bit map that sets options. The
following values of the bits are defined in
<sys/mount.h>:
MS_DELAY Writes to disks are to be
delayed until the buffer needs
to be reused. This is the
default on Series 800 systems,
as it was prior to release
10.0.
MS_BEHIND Writes to disks are to be done
asynchronously, where
possible, without waiting for
completion. This is the
default on Series 700 systems,
as it was prior to release
10.0.
MS_BEHIND and MS_DELAY are
mutually exclusive.
Hewlett-Packard Company - 2 - HP-UX 11i Version 2: August 2003
mount(2) mount(2)
MS_NO_FSASYNC Rigorous posting of file
system metadata is to be used.
This is the default.
MS_FSASYNC Relaxed posting of file system
metadata is to be used. This
may lead to better performance
for certain applications; but
there is increased potential
for data loss in case of a
crash.
MS_FSASYNC and MS_NO_FSASYNC
are mutually exclusive.
RETURN VALUE [Toc] [Back]
mount() returns the following values:
0 Successful completion.
-1 Failure. errno is set to indicate the error.
ERRORS [Toc] [Back]
If mount() fails, errno is set to one of the following values.
[EACCES] A component of the path prefix denies search
permission.
[EBUSY] path is currently mounted on, is someone's current
working directory, or is otherwise busy.
[EBUSY] The file system associated with fs is currently
mounted.
[EBUSY] The system cannot allocate the necessary resources
for this mount.
[EFAULT] fs, path or dataptr points outside the allocated
address space of the process. The reliable
detection of this error is implementation
dependent.
[EINVAL] An argument to the system call is invalid, or a
sanity check failed.
[ELOOP] Too many symbolic links were encountered in
translating a path name argument.
[ENAMETOOLONG] The length of a path name exceeds PATH_MAX, or a
path name component is longer than NAME_MAX while
_POSIX_NO_TRUNC is in effect.
Hewlett-Packard Company - 3 - HP-UX 11i Version 2: August 2003
mount(2) mount(2)
[ENODEV] fstype is a file system that is not been
configured into the kernel.
[ENOENT] A named file does not exist.
[ENOENT] fs or path is null.
[ENOTBLK] fs is not a block special device and the file
system type requires it to be.
[ENOTDIR] A component of a path prefix is not a directory.
[ENOTDIR] path is not a directory.
[ENXIO] The device associated with fs does not exist and
the file system type requires it to be.
[EPERM] The process does not have the appropriate
privilege and the file system type requires it.
[EROFS] The requested file system is write protected and
mflag requests write permission.
WARNINGS [Toc] [Back]
If mount() is called from the program level (i.e., not called with the
mount command (see mount(1M)), the table of mounted devices contained
in /etc/mnttab is not updated. The updating of /etc/mnttab is
performed by the mount and syncer commands (see mount(1M) and
syncer(1M)).
SEE ALSO [Toc] [Back]
mount(1M), syncer(1M), sysfs(2), umount(2).
Hewlett-Packard Company - 4 - HP-UX 11i Version 2: August 2003 [ Back ] |