Link Search Menu Expand Document

mbox_write_421

long mbox_write_421(mailbox_id_t __user *id, uint8_t __user *data, uint64_t size, uint64_t offset);

Description

Copies size bytes from data to offset bytes into mailbox. You must validate here correct access to both user-space memory and kernel space memory. You must also verify that all the boundaries make sense. If the length and/or offset would result in a write outside the bounds of the memory available on a mailbox, you should return an error. There is no partial write.

A write of 0 bytes is also considered invalid.

The mailbox must be identified by the id. The application should have gotten a valid id through an open call

Parameters

  • id: A user-space pointer to the id of the mailbox. Must refer to an existing mailbox.
  • data: A user-space pointer to data to write to the mailbox
  • size: The length of data
  • offset: How many bytes into the mailbox’s memory the data will be written

Return

Returns the number of bytes written (which should be equal to the data length size) on success, and an appropriate error code on failure. If an error occurred the mailbox MUST NOT be modified in any way.

In case of an error the function must return an appropriate error code as discussed in the system description.