Link Search Menu Expand Document

mbox_open_421

long mbox_open_421(char __user* name, mailbox_id_t __user *id, uint64_t size);

Description

Will attempt to open the mailbox matching the given name. If the mailbox is found, then the function must populate the id parameter correctly, so the application can use this mailbox.

If the mailbox was not found, it must be created with size bytes of memory allocated, and the id parameter populated with the newly generated id.

You are NOT to resize the mailbox if the size parameter doesn’t match.

If you are wondering about the mailbox_id_t type, you can read more about it in the installation section.

Parameters

  • name: A user-space pointer to an array of char*. Assume each pointer points to a region of memory with 64 bytes
  • id: A pointer to an id. Will be populated by open, with the id of the mailbox
  • size: The size of the memory allocated to the mailbox in bytes.

Notice how name is different from then project 2 implementation

Return

On success the function should return 0, and *id should contain the id of the mailbox. Otherwise the function must return an appropriate error code as discussed in the system description.