User Tools

Site Tools


releases:3.2.0:developersguide:pfsvfsprotocol

The PFS-VFS protocol

This page provides the official documentation of the PFS-VFS protocol of MINIX 3. It describes the protocol used between the PFS server and the VFS server. The current version documents the protocol used in SVN revision 9568. If you update this document because of changes to MINIX 3, please mention the revision number of the change in the wiki comment.

General Overview

In order to implement file descriptor passing and better socket file permission checking, PFS has to make a few nested VFS calls. The requests are outlined below.

Access Control Messages

PFS_REQ_CHECK_PERMS

Check Permissions.

Request fields

<16% >USER_ENDPT m2_i2endpoint_tThe endpoint of the process that wishes to bind()/connect().
IO_GRANT m2_p1cp_grant_id_tPath to the socket file.
COUNT m2_i3intLength of the path.

Reply fields

  • none

Reply codes

<16% >OK Permissions verified to be okay.
EACCES Access Denied.
EINVAL Invalid endpoint or strlen.
EIO Couldn't copy path from grant.
ELOOP More than SYMLOOP_MAX levels of symlinks were encountered when resolving the path.
ENOENT File not found.
ENAMETOOLONG The resolved path is too big to fit into the space provided in the grant.

Description

This request asks the VFS to resolve the given path and determine if the user has permission to access it.

File Descriptor Passing Messages

PFS_REQ_VERIFY_FD

Verify a file descriptor.

Request fields

<16% >USER_ENDPTm2_i2endpoint_tThe endpoint of the process that owns the descriptor to be verified.
COUNTm2_i3intFile descriptor number.

Reply fields

<16% >ADDRESSm2_p1filp_id_tThe filp that corresponds to the file descriptor.

Reply codes

<16% >OK The file descriptor is valid.
EINVAL The file descriptor is not valid.

Description

Verify whether the given file descriptor is valid for the endpoint. When the file descriptor is valid a pointer to that filp is returned.

PFS_REQ_SET_FILP

Mark a filp as in-flight.

Request fields

<16% >ADDRESSm2_p1filp_id_tThe filp that corresponds to the file descriptor.

Reply fields

  • none

Reply codes

<16% >OK The filp was marked as in-flight.
EINVAL The filp is invalid.

Description

This sets a flag on the filp that prevents it from being closed while it is being copied to another process.

PFS_REQ_COPY_FILP

Copy a filp.

Request fields

<16% >USER_ENDPTm2_i2endpoint_tThe destination.
ADDRESSm2_p1filp_id_tThe filp to be copied.

Reply fields

  • none

Reply codes

<16% >int &gt;= 0 The new file descriptor number.
EINVALThe endpoint and/or filp parameters are invalid.
EMFILEThe file descriptor table of the destination endpoint is full.

Description

This copies a filp from one process to another.

PFS_REQ_PUT_FILP

Mark a filp as not in-flight.

Request fields

<16% >ADDRESSm2_p1filp_id_tThe filp that corresponds to the file descriptor.

Reply fields

  • none

Reply codes

<16% >OK The filp was marked as not in-flight.
EINVALThe filp is invalid.

Description

This unsets a flag on the filp that prevents it from being closed while it is being copied to another process.

PFS_REQ_CANCEL_FD

Cancel a file descriptor copy.

Request fields

<16% >USER_ENDPTm2_i2endpoint_tThe endpoint of the process that owns the descriptor to be verified.
COUNTm2_i3intFile descriptor number.

Reply fields

  • none

Reply codes

<16% >OK The copy was cancelled.
EINVALThe file descriptor and/or endpoint parameters are invalid.

Description

This reverses the changes made by PFS_REQ_COPY_FILP.

releases/3.2.0/developersguide/pfsvfsprotocol.txt · Last modified: 2014/11/14 16:16 by lionelsambuc