MOUNT(2) UNIX Programmer's Manual MOUNT(2) NAME mount, umount - mount or remove file system SYNOPSIS mount(special, name, flags) char *special, *name; int flags; umount(special) char *special; DESCRIPTION _M_o_u_n_t announces to the system that a removable file system has been mounted on the block-structured special file _s_p_e_- _c_i_a_l; from now on, references to file _n_a_m_e will refer to the root file on the newly mounted file system. _S_p_e_c_i_a_l and _n_a_m_e are pointers to null-terminated strings containing the appropriate path names. _N_a_m_e must exist already. _N_a_m_e must be a directory. Its old contents are inaccessible while the file system is mounted. The following _f_l_a_g_s may be specified to suppress default semantics which affect filesystem access. MNT_RDONLY The filesystem should be treated as read-only; Even the super-user may not write on it. MNT_NOEXEC Do not allow files to be executed from the filesystem. MNT_NOSUID Do not honor setuid or setgid bits on files when executing them. MNT_NODEV Do not interpret special files on the filesystem. MNT_SYNCHRONOUS All I/O to the filesystem should be done synchronously. _U_m_o_u_n_t announces to the system that the _s_p_e_c_i_a_l file is no longer to contain a removable file system. The associated file reverts to its ordinary interpretation. RETURN VALUE _M_o_u_n_t returns 0 if the action occurred, -1 if _s_p_e_c_i_a_l is inaccessible or not an appropriate file, if _n_a_m_e does not exist, if _s_p_e_c_i_a_l is already mounted, if _n_a_m_e is in use, or if there are already too many file systems mounted. Printed 11/26/99 January 25, 1996 1 MOUNT(2) UNIX Programmer's Manual MOUNT(2) _U_m_o_u_n_t returns 0 if the action occurred; -1 if if the spe- cial file is inaccessible or does not have a mounted file system, or if there are active files in the mounted file system. ERRORS _M_o_u_n_t will fail when one of the following occurs: [ENAMETOOLONG] A component of either pathname exceeded 255 characters, or the entire length of either path name exceeded 1023 characters. [ELOOP] Too many symbolic links were encountered in translating either pathname. [EPERM] The caller is not the super-user. [ENOENT] A component of _n_a_m_e does not exist. [ENODEV] A component of _s_p_e_c_i_a_l does not exist. [ENOTBLK] _S_p_e_c_i_a_l is not a block device. [ENXIO] The major device number of _s_p_e_c_i_a_l is out of range (this indicates no device driver exists for the associated hardware). [ENOTDIR] A component of _n_a_m_e is not a directory, or a path prefix of _s_p_e_c_i_a_l is not a directory. [EINVAL] Either pathname contains a character with the high-order bit set. [EINVAL] The super block for the file system had a bad magic number or an out of range block size. [EBUSY] Another process currently holds a reference to _n_a_m_e, or _s_p_e_c_i_a_l is already mounted. [EMFILE] No space remains in the mount table. [ENOMEM] Not enough memory was available to read the cylinder group information for the file sys- tem. [EIO] An I/O error occurred while reading the super block or cylinder group information. [EFAULT] _S_p_e_c_i_a_l or _n_a_m_e points outside the process's allocated address space. Printed 11/26/99 January 25, 1996 2 MOUNT(2) UNIX Programmer's Manual MOUNT(2) _U_m_o_u_n_t may fail with one of the following errors: [ENOTDIR] A component of the path prefix is not a directory. [EINVAL] The pathname contains a character with the high-order bit set. [ENAMETOOLONG] A component of a pathname exceeded 255 char- acters, or an entire path name exceeded 1023 characters. [ELOOP] Too many symbolic links were encountered in translating the pathname. [EPERM] The caller is not the super-user. [ENODEV] _S_p_e_c_i_a_l does not exist. [ENOTBLK] _S_p_e_c_i_a_l is not a block device. [ENXIO] The major device number of _s_p_e_c_i_a_l is out of range (this indicates no device driver exists for the associated hardware). [EINVAL] The requested device is not in the mount table. [EBUSY] A process is holding a reference to a file located on the file system. [EIO] An I/O error occurred while writing the super block or other cached file system informa- tion. [EFAULT] _S_p_e_c_i_a_l points outside the process's allo- cated address space. SEE ALSO mount(8), umount(8) BUGS Some of the error codes need translation to more obvious messages. Physically write-protected and magnetic tape file systems must be mounted read-only or errors will occur when access times are updated, whether or not any explicit write is attempted. MNT_SYNCHRONOUS is not currently implemented in the kernel but may be specified because the kernel ignores it. Printed 11/26/99 January 25, 1996 3