MOUNT(2) UNIX Programmer's Manual MOUNT(2) NAME mount - mount file system SYNOPSIS #include <sys/mount.h> mount(type, dir, flags, data) int type; char *dir; int flags; caddr_t data; DESCRIPTION _m_o_u_n_t attaches a file system to a directory. After a suc- cessful return, references to directory _d_i_r will refer to the root directory on the newly mounted file system. _D_i_r is a pointer to a null-terminated string containing a path name. _D_i_r must exist already, and must be a directory. Its old contents are inaccessible while the file system is mounted. The _f_l_a_g_s argument determines whether the file system can be written on, and if set-uid execution is allowed. 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. _T_y_p_e indicates the type of the filesystem. It must be one of the types defined in _m_o_u_n_t._h. _D_a_t_a is a pointer to a structure which contains the type specific arguments to mount. Below is a list of the filesystem types supported and the type specific arguments to each: MOUNT_UFS struct ufs_args { char *fspec; /* Block special file to mount */ }; MOUNT_NFS #include <nfs/nfs.h> #include <netinet/in.h> struct nfs_args { struct sockaddr_in *addr; /* file server address */ fhandle_t *fh; /* File handle to be mounted */ int flags; /* flags */ int wsize; /* write size in bytes */ int rsize; /* read size in bytes */ int timeo; /* initial timeout in .1 secs */ int retrans; /* times to retry send */ }; RETURN VALUE _M_o_u_n_t returns 0 if the action occurred, and -1 if _s_p_e_c_i_a_l is Printed 12/27/86 19 August 1985 1 MOUNT(2) UNIX Programmer's Manual MOUNT(2) 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. ERRORS _M_o_u_n_t will fail when one of the following occurs: [EPERM] The caller is not the super-user. [ENOENT] _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). [EPERM] The pathname contains a character with the high-order bit set. [ENOTDIR] A component of the path prefix in _n_a_m_e is not a directory. [EBUSY] _D_i_r is not a directory, or another process currently holds a reference to it. [EBUSY] No space remains in the mount table. [EBUSY] The super block for the file system had a bad magic number or an out of range block size. [EBUSY] 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. [ENOTDIR] A component of the path prefix in _s_p_e_c_i_a_l or _n_a_m_e is not a directory. [EPERM] The pathname of _s_p_e_c_i_a_l or _n_a_m_e contains a character with the high-order bit set. [ENAMETOOLONG] The pathname of _s_p_e_c_i_a_l or _n_a_m_e was too long. [ENOENT] _S_p_e_c_i_a_l or _n_a_m_e does not exist. [EACCES] Search permission is denied for a component of the path prefix of _s_p_e_c_i_a_l or _n_a_m_e. [EFAULT] _S_p_e_c_i_a_l or _n_a_m_e points outside the process's Printed 12/27/86 19 August 1985 2 MOUNT(2) UNIX Programmer's Manual MOUNT(2) allocated address space. [ELOOP] Too many symbolic links were encountered in translating the pathname of _s_p_e_c_i_a_l or _n_a_m_e. [EIO] An I/O error occurred while reading from or writing to the file system. SEE ALSO unmount(2), mount(8) BUGS The error codes are in a state of disarray; too many errors appear to the caller as one value. Printed 12/27/86 19 August 1985 3