MOUNT(2)

NAME
mount, umount - mount and unmount filesystems.

SYNOPSIS
#incldue <unistd.h>
int mount (const char *devname, const char *dirname, int rw_flag);
int umount (const char *devname);

DESCRIPTION
mount() mounts the filesystem on the block device named *devname onto the directory dirname

umount() unmounts the specified block device.

0 is returned on success, a negative value on error.

ERRORS
-EBUSY is returned under the following conditions:

1.  There is activity in the directory you are trying to mount on

2.  You are attempting to mount on /.

3.  There is file system activity during umount, which could be as simple as a process having a directory under the mount point as wd.

-ENOENT is returned if the block device or directory does not exist.

-ENOTBLK is returned if you attempt to unmount a non-block device.

-EPERM is returned under the following conditions:

1.  You attempt to mount a non-block device.

2.  You attempt to mount on a non-directory.

3.  The filesystem is already mounted.

FILES
linux/fs/super.c
/usr/include/linux/sys.h
/usr/include/unistd.h

BUGS
rw_flag is ignored.

non-super users may make mount() and umount() calls.

It is impossible to mount over root, as with BSD. This can be considered a feature or misfeature depending on you you look at it - as root will always be busy and probably shouldn't be mounted over.

EBUSY, ENOTBLK, and EPERM may be confused in some places.