Chapter 5. Protocols and interfaces

Table of Contents

Protocol for messages with file descriptors
Object-capability protocol
Closing the connection
Conventions
Future extensions
PLASH_COMM_FD and PLASH_CAPS
fs_op object
Filesystem objects: files, directories and symlinks
Executable objects
conn_maker object
fs_op_maker object

Protocol for messages with file descriptors

Implemented by comms.c.

The first protocol is used to send messages over a socket. It simply divides the stream into messages. Each message may contain data and file descriptors.

Each message comprises:

  • int32: "MSG!"

  • int32: size of data payload in bytes (not necessarily word-aligned)

  • int32: number of file descriptors

  • data payload, padded to word (4 byte) boundary

See the man pages sendmsg(2), recvmsg(2) and cmsg(3) for details about how file descriptors are sent across sockets.