MOUNT(2) COMMAND REFERENCE MOUNT(2) NAME mount - mount file system SYNOPSIS #include <sys/mount.h> mount(type, dir, flags, data) int type; char *dir; int flags; caddrt data; DESCRIPTION The program mount attaches a file system to a directory. After a successful return, references to directory dir refer to the root directory on the newly-mounted file system. The dir directory is a pointer to a null-terminated string containing a path name; dir must already exist, and must be a directory; its old contents are inaccessible while the file system is mounted. The flags 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 occur when access times are updated, even if an explicit write is attempted. The type argument indicates the type of file system; it must be one of the types defined in mount.h. The argument data is a pointer to a structure which contains the type-specific arguments to mount. Here is a list of the file system types supported and the type-specific arguments to each: MOUNT_UFS struct ufs_args { char *fspec; /* Block special file to mount */ }; MOUNT_NFS #include <sys/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 seconds */ int retrans; /* times to retry send */ }; RETURN VALUE The mount program returns 0 if the action occurred and returns -1 if special is inaccessible or not an appropriate Printed 4/6/89 1
MOUNT(2) COMMAND REFERENCE MOUNT(2) file, if name does not exist, if special is already mounted, if name is in use, or if there are already too many file systems mounted. DIAGNOSTICS The mount program fails when one of the following errors occur: [EPERM] The caller is not the superuser. [ENOENT] The file special does not exist. [ENOTBLK] The file special is not a block device. [ENXIO] The major device number of special is out of range (this indicates no device driver exists for the associated hardware). [EPERM] The path name contains a character with the high-order bit set. [ENOTDIR] A component of the path prefix in name is not a directory. [EBUSY] Dir 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 system. [EIO] An I/O error occurred while reading the super block or cylinder group information. [ENOTDIR] A component of the path prefix in special or name is not a directory. [EPERM] The path name of special or name contains a character with the high-order bit set. [ENAMETOOLONG] The path name of special or name is too long. [ENOENT] The file special or name does not exist. [EACCES] Search permission is denied for a component of the path prefix of special or name. Printed 4/6/89 2
MOUNT(2) COMMAND REFERENCE MOUNT(2) [EFAULT] The file special or name points outside the process's allocated address space. [ELOOP] Too many symbolic links were encountered in translating a path name of special or name. [EIO] An I/O error occurred while reading from or writing to the file system. CAVEATS The error codes are in a state of disarray; too many errors appear to the caller as one value. SEE ALSO umount(2), unmount(2) umount(8), and mount(8). Printed 4/6/89 3
%%index%% na:264,77; sy:341,1069; de:1410,2075; di:4314,2042;6692,406; rv:3485,312;4133,181; ca:7098,184; se:7282,224; %%index%%000000000142