gn_common_memcntl Subroutine

Purpose

Changes or queries the physical attachment of a file.

Syntax

#include <sys/vnode.h>
#include <sys/fcntl.h>

int gn_common_memcntl (gnode, cmd, arg)
struct gnode * gnode;
int cmd;
void * arg;

Parameters

Item Description
gnode Points to a gnode structure.
cmd Specifies the operation to be performed. The cmd parameter can be one of the following values:
  • F_ATTACH
  • F_DETACH
  • F_ATTINFO
arg Points to a structure containing information for the specified cmd parameter.

F_ATTACH attach_desc_t

F_DETACH detach_desc_t

F_ATTINFO attinfo_desc_t

Description

The gn_common_memcntl subroutine is to be called by file system vnop_memcntl implementations. It performs the normal function of such operations. If the cmd parameter is set to F_ATTACH, the gn_common_memcntl subroutine attaches the segment specified by the gn_seg field in the gnode structure. If the cmd parameter is set to F_DETACH, the gn_common_memcntl subroutine detaches the segment. If the cmd parameter is set to F_ATTINFO, the gn_common_memcntl subroutine returns information about the current state of attachment.

Return Values

Item Description
0 Success.
non-zero Failure.

Error Codes

Item Description
EINVAL The cmd parameter is not valid.
ENOMEM Resources are not available to attach the memory segment.