DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

mount(S)


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 MS_DATA and MS_FSS 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 MS_DATA 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 MS_FSS is obsolete and is ignored if MS_DATA is also set, but if MS_FSS is set and MS_DATA 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 MS_RDONLY bit of mflag is used to control write permission on the mounted filesystem; if it is set, writing is forbidden, otherwise writing is permitted 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 working 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 machines.

[ENOENT]
Any of the named files does not exist.

[ENOLINK]
path points to a remote machine and the link to that machine 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 permission.

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 not part of any currently supported standard; it was developed by UNIX System Laboratories, Inc. and is maintained by The SCO Group.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003