mount(S) 6 January 1993 mount(S) Name mount - mount a filesystem Syntax cc ... -lc #include <sys/types.h> #include <sys/mount.h> int mount (spec, dir, mflag, fstyp, dataptr, datalen) char *spec, *dir; int mflag, fstyp; char *dataptr; int datalen; Description mount requests that a removable filesystem contained on the block special file identified by spec be mounted on the directory identified by dir. spec and dir are pointers to path names. fstyp is the filesystem type number. The sysfs(S) system call can be used to determine the filesystem type number. Note that if both the MSDATA and MSFSS flag bits of mflag are off, the filesystem type defaults to the root filesystem type. Only if either flag is on is fstyp used to indicate the filesystem type. If the MSDATA flag is set in mflag, the system expects the dataptr and datalen arguments to be present. Together they 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 filesystem type. A particular filesystem type may not require this data, in which case dataptr and datalen should both be zero. Note that MSFSS is obsolete and is ignored if MSDATA is also set, but if MSFSS is set and MSDATA is not, dataptr and datalen are both assumed to be zero. Upon successful completion, references to the file dir refer to the root directory on the mounted filesystem. The low-order bit of mflag is used to control write permission on the mounted filesystem; if 1, writing is forbidden, otherwise writing is per- mitted according to individual file accessibility. mount may be invoked only by the super user. It is intended for use only by the mount(ADM) utility. mount fails if one or more of the following is true: [EBUSY] 1. dir is currently mounted on, is someone's current work- ing directory, or is otherwise busy. 2. The device associated with spec is currently mounted. 3. There are no more mount table entries. [EFAULT] spec or dir points outside the allocated address space of the process. [EINVAL] The super block has an invalid magic number or the fstyp is invalid or mflag is not valid. [EMULTIHOP] Components of path require hopping to multiple remote ma- chines. [ENOENT] Any of the named files does not exist. [ENOLINK] path points to a remote machine and the link to that ma- chine is no longer active. [ENOSPC] The filesystem state in the super block is not FsOKAY and mflag requests write permission. [ENOTBLK] spec is not a block special device. [ENOTDIR] 1. A component of a path prefix is not a directory. 2. dir is not a directory. [ENXIO] The device associated with spec does not exist. [EPERM] The effective user ID is not super user. [EREMOTE] spec is remote and cannot be mounted. [EROFS] spec is write-protected and mflag requests write permis- sion. Diagnostics Upon successful completion a value of 0 is returned. Otherwise, a value of -1 is returned, and errno is set to indicate the error. See also filesystem(FP), fsname(ADM), labelit(ADM), mount(ADM), sysfs(S), umount(S) Standards conformance mount is conformant with: AT&T SVID Issue 2, but has been withdrawn from XPG3.