Could someone give me ideas to implement a mailbox library, having mail_send() and mail_recv() using copy-on-write operations.

There is just one mailbox.

int mail_send( void *data, int size)
data[in]

int mail_recv(void *data, int *size)
data[in][out]

Just tell me what kind of data structures I may need and also what if I have a buffer that is 2.5 pages. How do I align the buffer? Thanks for any kind of help.