mntctl Subroutine

Purpose

Returns the mount status of file systems, or alters the status of mounted file systems.

Library

Standard C Library (libc.a)

Syntax

#include <sys/types.h>
#include <sys/mntctl.h>
#include <sys/vmount.h>

int mntctl ( Command,  Size,  Buffer)
int Command;
int Size;
char *Buffer;

Description

The mntctl subroutine is used to query the status of virtual file systems (also known as mounted file systems). It can also be used to alter the state of mounted file systems.

Each virtual file system (VFS) is described by a vmount structure. This structure is supplied when the VFS is created by the vmount subroutine. The vmount structure is defined in the sys/vmount.h file.

Parameters

Item Description
Command Specifies the operation to be performed. Valid commands are defined in the sys/vmount.h file. At present, the only command is:
MCTL_QUERY
Query mount information.
MCTL_REMNT
Re-mount a mounted file system with the options specified in the vmount structure passed in. The MCTL_REMNT command is only passed to file systems that support the capability to re-mount. For more information, see the gfsadd Kernel Service.
Buffer For the MCTL_QUERY command, the Buffer parameter points to a data area that will contain an array of the vmount structures. Because the vmount structure is variable-length, it is necessary to reference the vmt_length field of each structure to determine where in the Buffer area the next structure begins.

For the MCTL_REMNT command, the Buffer parameter points to a data area that contains the vmount structure that is passed in.

Size Specifies the length, in bytes, of the buffer pointed to by the Buffer parameter.

Return Values

For the MCTL_QUERY command, if the mntctl subroutine is successful, the number of vmount structures that are copied into the Buffer parameter is returned. If the Size parameter indicates that the supplied buffer is too small to hold the vmount structures for all of the current VFSs, the mntctl subroutine sets the first word of the Buffer parameter to the required size (in bytes) and returns the value of 0. If the mntctl subroutine otherwise fails, a value of -1 is returned, and the errno global variable is set to indicate the error.

For the MCTL_REMNT command, if the mntctl subroutine fails, a value of -1 is returned, and the errno global variable is set to indicate the error.

Error Codes

The mntctl subroutine fails and the requested operation is not performed if one or both of the following are true:

Item Description
EINVAL The Command parameter is not recognized, or the Size parameter is not a positive value.
EFAULT The Buffer parameter points to a location outside of the allocated address space of the process.