mount(2)
NAME
mount − mount a file system
SYNOPSIS
#include <sys/mount.h>
int mount(const char *spec, const char *dir, int rwflag);
DESCRIPTION
mount() requests that a removable file system contained on the block special device file identified by spec be mounted on the directory identified by dir. spec and dir are pointers to path names.
Upon successful completion, references to the file dir refer to the root directory on the mounted file system.
The low-order bit of rwflag is used to control write permission on the mounted file system. If it is 1, writing is forbidden; otherwise, writing is permitted according to individual file accessibility.
mount() can be invoked only by a user who has appropriate privileges.
RETURN VALUE
Upon successful completion a value of 0 is returned. Otherwise, a value of −1 is returned and errno is set to indicate the error.
ERRORS
mount() fails if one or more of the following is true:
[EPERM] The effective user ID is not a user who has appropriate privileges.
[ENOENT] The named file does not exist (for example, path is null or a component of path does not exist).
[ENOTDIR] A component of a path prefix is not a directory.
[ENOTBLK] spec is not a block special device.
[ENXIO] The device associated with spec does not exist.
[ENOTDIR] dir is not a directory.
[EFAULT] spec or dir points outside the allocated address space of the process. The reliable detection of this error is implementation dependent.
[EBUSY] dir is currently mounted on, is someone’s current working directory, or is otherwise busy.
[EBUSY] The device associated with spec is currently mounted.
[EBUSY] There are no more mount table entries.
[ENOENT] spec or dir is null.
[EACCES] A component of the path prefix denies search permission.
[ENAMETOOLONG]
The length of a specified path name exceeds PATH_MAX bytes, or the length of a component of the path name exceeds NAME_MAX bytes while _POSIX_NO_TRUNC is in effect.
[ELOOP] Too many symbolic links were encountered in translating either path name.
WARNINGS
If mount() is called from the program level (i.e. not called from mount(1M)), the table of mounted devices contained in /etc/mnttab is not updated. Updating of /etc/mnttab is performed by mount(1M) and syncer(1M). See corresponding manual entries for more information.
In the HP Clustered environment, the spec and dir arguments should always be fully expanded pathnames.
SEE ALSO
mount(1M), syncer(1M), umount(2).
STANDARDS CONFORMANCE
mount(): SVID2, XPG2
Hewlett-Packard Company — HP-UX Release 9.0: August 1992