|
|||||||
|
|
MOUNTSection: Linux Programmer's Manual (2)Updated: 2002-06-11 Index Return to Main Contents NAMEmount, umount - mount and unmount filesystems.SYNOPSIS#include <sys/mount.h>int mount(const char *source, const char *target, const char *filesystemtype, unsigned long mountflags, const void *data); int umount(const char *target); int umount2(const char *target, int flags); DESCRIPTIONmount attaches the filesystem specified by source (which is often a device name, but can also be a directory name or a dummy) to the directory specified by target.umount and umount2 remove the attachment of the (topmost) filesystem mounted on target. Only the super-user may mount and unmount filesystems. Since Linux 2.4 a single filesystem can be visible at multiple mount points, and multiple mounts can be stacked on the same mount point. Values for the filesystemtype argument supported by the kernel are listed in /proc/filesystems (like "minix", "ext2", "msdos", "proc", "nfs", "iso9660" etc.). Further types may become available when the appropriate modules are loaded. The mountflags argument may have the magic number 0xC0ED (MS_MGC_VAL) in the top 16 bits (this was required in kernel versions prior to 2.4, but is no longer required and ignored if specified), and various mount flags (as defined in <linux/fs.h> for libc4 and libc5 and in <sys/mount.h> for glibc2) in the low order 16 bits:
From Linux 2.4 onwards, the MS_NODEV, MS_NOEXEC, and MS_NOSUID flags are settable on a per-mount point basis. The data argument is interpreted by the different file systems. Typically it is a string of comma-separated options understood by this file system. See mount(8) for details of the options available for each filesystem type. Linux 2.1.116 added the umount2() system call, which, like umount(), unmounts a target, but allows additional flags controlling the behaviour of the operation:
RETURN VALUEOn success, zero is returned. On error, -1 is returned, and errno is set appropriately.ERRORSThe error values given below result from filesystem type independent errors. Each filesystem type may have its own special errors and its own special behavior. See the kernel source code for details.
CONFORMING TOThese functions are Linux-specific and should not be used in programs intended to be portable.HISTORYThe original umount function was called as umount(device) and would return ENOTBLK when called with something other than a block device. In Linux 0.98p4 a call umount(dir) was added, in order to support anonymous devices. In Linux 2.3.99-pre7 the call umount(device) was removed, leaving only umount(dir) (since now devices can be mounted in more than one place, so specifying the device does not suffice).The original MS_SYNC flag was renamed MS_SYNCHRONOUS in 1.1.69 when a different MS_SYNC was added to <mman.h>. Before Linux 2.4 an attempt to execute a set-UID or set-GID program on a filesystem mounted with MS_NOSUID would fail with EPERM. Since Linux 2.4 the set-UID and set-GID bits are just silently ignored in this case. SEE ALSOmount(8), umount(8)
Index | ||||||
|
|
|
Home :: Copyright :: Privacy :: Credits :: Get a free Linuxinfor Email Account Document on this page is part of "Linuxinfor Man Pages in HTML Format: man2". See Index Page for more info about Authorship and Copyright. 1999-2008 Linuxinfor.com. No rights reserved. |