'\"macro stdmacro
.if n .pH g2.mount @(#)mount	40.19 of 12/5/89
.\" Copyright 1989 AT&T
.nr X
.if \nX=0 .ds x} mount 2 "" "\&"
.if \nX=1 .ds x} mount 2 ""
.if \nX=2 .ds x} mount 2 "" "\&"
.if \nX=3 .ds x} mount "" "" "\&"
.TH \*(x}
.SH NAME
\f4mount\f1 \- mount a file system
.SH SYNOPSIS
\f4#include <sys/types.h>\f1
.br
\f4#include <sys/mount.h>\f1
.br
.PP
.nf
\f4int mount (const char \(**spec, const char \(**dir, int mflag,
	.../\(** int fstyp, const char \(**dataptr, size_t datalen\(**/);\f1
.fi
.SH DESCRIPTION
\f4mount\fP
requests that a removable file system contained on the
block special file identified by
.I spec\^
be mounted on the directory identified by
.IR dir .
.I spec\^
and
.I dir\^
are pointers to
path names.
\f2fstyp\fP
is the file system type number.
The 
\f4sysfs\fP(2)
system call can be used
to determine the file system type number.
If both the \f4MS_DATA\fP and \f4MS_FSS\fP flag bits of \f2mflag\f1
are off, the file system type defaults to the
root file system type.  Only if either flag is on
is \f2fstyp\fP used to indicate the file system type.
.PP
If the \f4MS_DATA\fP flag is set in \f2mflag\f1
the system expects the \f2dataptr\f1 and \f2datalen\f1 arguments
to be present.
Together they describe a block of file-system specific data
at address \f2dataptr\f1 of length \f2datalen\f1.
This is interpreted by file-system specific code within the
operating system and its format depends on the file system type.
If a particular file system type does not require this data,
\f2dataptr\f1 and \f2datalen\f1 should both be zero.
Note that \f4MS_FSS\fP is obsolete and is ignored if \f4MS_DATA\fP is
also set, but if \f4MS_FSS\fP is set and \f4MS_DATA\fP is not, \f2dataptr\f1
and \f2datalen\f1 are both assumed to be zero.
.PP
After a successful call to \f4mount\fP, all references to the file
.I dir\^
refer to the root directory on the mounted file system.
.PP
The low-order bit of
.I mflag\^
is used to control write permission on the mounted file system:
if
\f4\&1\f1,
writing is forbidden;
otherwise writing is permitted according to individual file accessibility.
.PP
\f4mount\fP
may be invoked only by the super-user.
It is intended for use only by the \f4mount\fP utility.
.PP
\f4mount\fP
fails if one or more of the following are true:
.TP 20
\f4EBUSY\fP
.I dir\^
is currently mounted on, is someone's current working directory,
or is otherwise busy.
.TP
\f4EBUSY\fP
The device associated with
.I spec\^
is currently mounted.
.TP
\f4EBUSY\fP
There are no more
mount table entries.
.TP
\f4EFAULT\fP
.I spec\^,
.I dir\^,
or
.I datalen
points outside the allocated address space of the process.
.TP
\f4EINVAL\fP
The super block has an invalid magic number
or the \f2fstyp\fP is invalid.
.\" or \f2mflag\f1 is not valid.
.TP
\f4ELOOP\fP
Too many symbolic links were encountered in translating \f2spec\f1
or \f2dir\f1.
.TP
\f4ENAMETOOLONG\fP
The length of the \f2path\f1 argument exceeds {\f4PATH_MAX\f1}, or the
length of a \f2path\f1 component exceeds {\f4NAME_MAX\f1} while
\f4_POSIX_NO_TRUNC\f1 is in effect.
.TP
\f4ENOENT\fP
None of the named files exists or is a null pathname.
.TP
\f4ENOTDIR\fP
A component of a
path prefix
is not a directory.
.TP 20
\f4EPERM\fP
The effective user
.SM ID
is not super-user.
.TP
\f4EREMOTE\fP
\f2spec\f1 is remote and cannot be mounted.
.TP
\f4ENOLINK\fP
\f2path\f1 points to a remote machine and
the link to that machine is no longer active.
.TP
\f4EMULTIHOP\fP
Components of \f2path\f1 require hopping to
multiple remote machines
and the file system type does not allow it.
.TP
\f4ENOTBLK\fP
.I spec\^
is not a block special device.
.TP
\f4ENXIO\fP
The device associated with
.I spec\^
does not exist.
.TP
\f4ENOTDIR\fP
.I dir\^
is not a directory.
.TP
\f4EROFS\fP
.I spec\^
is write protected and
.I mflag\^
requests write permission.
.TP
\f4ENOSPC\fP
The file system state in the super-block
is not \f4FsOKAY\fP and
.I mflag\^
requests write permission.
.SH "SEE ALSO"
\f4sysfs\fP(2), \f4umount\fP(2).
.sp .2
\f4mount\fP(1M),
\f4fs\fP(4)
in the \f2System Administrator's Reference Manual\f1.
.SH "DIAGNOSTICS"
Upon successful completion a value of 0 is returned.
Otherwise, a value of \-1 is returned and
\f4errno\fP
is set to indicate the error.
.\"	@(#)mount.2	2.0 of 8/15/84
.Ee
