*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> standard/mount (2)              


mount(2)							      mount(2)

NAME    [Toc]    [Back]

     mount - mount a file system

C SYNOPSIS    [Toc]    [Back]

     #include <sys/types.h>
     #include <sys/mount.h>

     int mount (const char *spec, const	char *dir, int mflag,
	  .../*	char *fstyp, const char	*dataptr, int datalen*/);

DESCRIPTION    [Toc]    [Back]

     mount requests that a removable file system 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 file system
     type number.  The sysfs(2)	system call can	be used	to determine the file
     system type number.  If both the MS_DATA and MS_FSS flag bits of mflag
     are off, the file system type defaults to the root	file system type.
     Only if either flag is on is fstyp	used to	indicate the file system 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	on the file system type.  If a particular file system
     type does not require this	data, 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.

     After a successful	call to	mount, all references to the file dir refer to
     the root directory	on the mounted file system.

     The low-order bit of mflag	is used	to control write permission on the
     mounted file system:  if 1, writing is forbidden; otherwise writing is
     permitted according to individual file accessibility.

     mount may be invoked only by a process with the super-user	privilege.  It
     is	intended for use only by the mount utility.

     mount fails if one	or more	of the following are true:

     EACCES		 Search	permission is denied on	a component of dir or

     EPERM		 The calling process does not have the super-user

     EBUSY		 dir is	currently mounted on, is someone's current
			 working directory, or is otherwise busy.

									Page 1

mount(2)							      mount(2)

     EBUSY		 The device associated with spec is currently mounted.

     EBUSY		 There are no more mount table entries.

     EFAULT		 spec, dir, or datalen points outside the allocated
			 address space of the process.

     EINVAL		 The super block has an	invalid	magic number or	the
			 fstyp is invalid.

     ELOOP		 Too many symbolic links were encountered in
			 translating spec or dir.

     ENAMETOOLONG	 The length of the path	argument exceeds {PATH_MAX},
			 or the	length of a path component exceeds {NAME_MAX}
			 while _POSIX_NO_TRUNC is in effect.

     ENOENT		 None of the named files exists	or is a	null pathname.

     ENOTDIR		 A component of	a path prefix is not a directory.

     EREMOTE		 spec is remote	and cannot be mounted.

     ENOLINK		 path points to	a remote machine and the link to that
			 machine is no longer active.

     EMULTIHOP		 Components of path require hopping to multiple	remote
			 machines and the file system type does	not allow it.

     ETIMEDOUT		 A component of	path is	located	on a remote file
			 system	which is not available [see intro(2)].

     ENOTBLK		 spec is not a block special device.

     ENXIO		 The device associated with spec does not exist.

     ENOTDIR		 dir is	not a directory.

     EROFS		 spec is write protected and mflag requests write

     ENOSPC		 The file system state in the super-block is not
			 FsOKAY	and mflag requests write permission.

     E2BIG		 The file system's size	parameters are larger than the
			 size of special device	spec. Either mkfs(1M) was run
			 on a different	overlapping device or the device has
			 been changed with fx(1M) since	mkfs was run.

     EFSCORRUPTED	 The filesystem	has a corruption forcing failure of
			 the mount.

									Page 2

mount(2)							      mount(2)

     EWRONGFS		 The wrong filesystem type was supplied	in fstyp, or
			 there is no filesystem	on spec.

NOTES    [Toc]    [Back]

     It	is the responsibility of the caller to assure that the block size of
     the device	corresponds to the blocksize of	the filesystem being mounted.
     This is particularly important with CDROM devices,	as the default block
     size of the device	can vary between 512 bytes and 2048 bytes.  The
     mount(1M) command manages this for	filesystems via	dks(7M)	DIOCSELFLAGS
     and DIOCSELECT ioctls.

SEE ALSO    [Toc]    [Back]

     fx(1M), mkfs(1M), mount(1M), sysfs(2), umount(2), dks(7M),fs(4), xfs(4)

DIAGNOSTICS    [Toc]    [Back]

     Upon successful completion	a value	of 0 is	returned.  Otherwise, a	value
     of	-1 is returned and errno is set	to indicate the	error.

									PPPPaaaaggggeeee 3333
[ Back ]
 Similar pages
Name OS Title
mount_nullfs FreeBSD mount a loopback file system sub-tree; demonstrate the use of a null file system layer
setup Linux setup devices and file systems, mount root file system
mount_msdosfs FreeBSD mount an MS-DOS file system
mount_udf FreeBSD mount a UDF file system
mount_msdos OpenBSD mount an MS-DOS file system
mount_ntfs OpenBSD mount an NTFS file system
unmount NetBSD mount or dismount a file system
mount NetBSD mount or dismount a file system
mount FreeBSD mount or dismount a file system
unmount FreeBSD mount or dismount a file system
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service