NAME | SYNOPSIS | DESCRIPTION | RETURN VALUES | ERRORS | SUMMARY OF TRUSTED SOLARIS CHANGES | SEE ALSO
#include <sys/types.h> #include <sys/mount.h> #include <sys/mntent.h>int mount(const char *spec, const char *dir, int mflag, char *fstype, char *dataptr, int datalen);
The mount() function requests that a removable file system contained on the block special file identified by spec be mounted on the directory identified by dir. The spec and dir arguments are pointers to path names. After a successful call to mount(), all references to the file dir refer to the root directory on the mounted file system. The fstype argument is the file system type name. Standard file system names are defined with the prefix MNTTYPE_ in <sys/mntent.h>. The mflag argument is constructed by a bitwise-inclusive-OR of flags from the following list, defined in <sys/mount.h>.
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. fstype is the file system type, which can be determined by the sysfs(2) function. 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 fstype used to indicate the file system type.
This option is mutually exclusive with the MS_DATA option. One of the options MS_DATA or MS_OPTIONSTR must be defined. The dataptr and datalen arguments describe a character buffer at address dataptr of size datalen. When calling mount(), the character buffer should contain a null-terminated string of options to be passed to the file system-specific code within the operating system. On a successful return, the file system-specific code will return the list of options recognized. Unrecognized options are ignored. The string returned can be used to update /etc/mnttab (see getmntent(3C)and mnttab(4)). The format of the string is a list of option names separated by commas. Options that have values (rather than binary options such as suid or nosuid), are separated by "=" such as dev=2c4046c. Standard option names are defined in <sys/mntent.h>. Only strings defined in the "C" locale are supported.
The file system should be mounted for reading only. This flag should also be specified for file systems that are incapable of writing (for example, CDROM). Without this flag, writing is permitted according to individual file accessibility.
This option prevents programs that are marked set-user-ID or set-group-ID from executing (see chmod(1)). It also causes open(2) to return ENXIO when attempting to open block or character special files.
Remounts a read-only file system as read-write.
Allow the file system to be mounted over an existing file system mounted on dir, making the underlying file system inaccessible. If a mount is attempted on a pre-existing mount point without setting this flag, the mount will fail.
Mount a file system globally if the system is configured and booted as part of a cluster (see clinfo(1M) in the SunOS 5.7 Reference Manual).
The mount() system call may be invoked for all file system types except namefs by a calling process with the PRIV_SYS_MOUNT
privilege. For the namefs file
system, the calling process must either be the owner of dir or assert the PRIV_FILE_OWNER
privilege.
The mount() function will fail if:
Search permission is denied on a component of spec or dir. To override this restriction, the calling process may assert one or
both of these privileges: PRIV_FILE_DAC_SEARCH
and PRIV_FILE_MAC_SEARCH
.
Write permission is denied to the namefs file system specified in dir. To override this restriction, the calling process may assert one or both of these privileges: PRIV_FILE_DAC_WRITE
and PRIV_FILE_MAC_WRITE
.
The dir argument is currently mounted on, is someone's current working directory, or is otherwise busy; the device associated with spec is currently mounted; or there are no more mount table entries.
The spec, dir, fstype, or dataptr argument points outside the allocated address space of the process.
The super block has an invalid magic number or the fstype is invalid.
Too many symbolic links were encountered in translating spec or dir.
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.
None of the named files exists or is a null pathname.
The path argument points to a remote machine and the link to that machine is no longer active.
The file system state in the super-block is not FsOKAY and mflag requests write permission.
The spec argument is not a block special device.
The dir argument is not a directory, or a component of a path prefix is not a directory.
A global mount is attempted (the MS_GLOBAL flag is set in mflag) on a machine which is not booted as a cluster or a local mount is attempted and dir is within a globally mounted file system.
The device associated with spec does not exist.
The length of the option string to be returned in the dataptr argument exceeds the size of the buffer specified by datalen.
The calling process does not own dir and dir is type namefs. To override this restriction, the calling process may assert the PRIV_FILE_OWNER
privilege.
dir is not a file system of type namefs and the calling process has not asserted the PRIV_SYS_MOUNT
privilege.
The spec argument is remote and cannot be mounted.
The spec argument is write protected and mflag requests write permission.
Appropriate privilege is required to override access or ownership checks.
The mount() system call may be invoked for all file system types except namefs by a calling process with the PRIV_SYS_MOUNT
privilege. For the namefs file system, the calling process
must either be the owner of dir or assert the PRIV_FILE_OWNER
privilege.
NAME | SYNOPSIS | DESCRIPTION | RETURN VALUES | ERRORS | SUMMARY OF TRUSTED SOLARIS CHANGES | SEE ALSO