vnop_map Entry Point

Purpose

Validates file mapping requests.

Syntax

int vnop_map (vp, addr, length, offset, flags, crp)
struct vnode * vp;
caddr_t  addr;
uint  length;
uint  offset;
uint  flags;
struct ucred * crp;

Parameters

Note: The addr, offset, and length parameters are unused in the current implementation. The file system is expected to store the segment ID with the file in the gn_seg field of the g-node for the file.
Item Description
vp Points to the virtual node (v-node) of the file.
addr Identifies the location within the process address space where the mapping is to begin.
length Specifies the maximum size to be mapped.
offset Specifies the location within the file where the mapping is to begin.
flags Identifies what type of mapping to perform. This value is composed of bit values defined in the /usr/include/sys/shm.h file. The following values are of particular interest to file system implementations:
SHM_RDONLY
The virtual memory object is read-only.
SHM_COPY
The virtual memory object is copy-on-write. If this value is set, updates to the segment are deferred until an fsync operation is performed on the file. If the file is closed without an fsync operation, the modifications are discarded. The application that called the vnop_map entry point is also responsible for calling the vnop_fsync entry point.
Note: Mapped segments do not reflect modifications made to a copy-on-write segment.
crp Points to the cred structure. This structure contains data that applications can use to validate access permission.

Description

The vnop_map entry point is called by the logical file system to validate mapping requests resulting from the mmap or shmat subroutines. The logical file system creates the virtual memory object (if it does not already exist) and increments the object's use count.

Execution Environment

The vnop_map entry point can be called from the process environment only.

Return Values

Item Description
0 Indicates success.

Nonzero return values are returned from the /usr/include/sys/errno.h file to indicate failure.