MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mqueue_loadmsg

Function mqueue_loadmsg

freebsd/kern/uipc_mqueue.c:1644–1663  ·  view source on GitHub ↗

* Load a message from user space */

Source from the content-addressed store, hash-verified

1642 * Load a message from user space
1643 */
1644static struct mqueue_msg *
1645mqueue_loadmsg(const char *msg_ptr, size_t msg_size, int msg_prio)
1646{
1647 struct mqueue_msg *msg;
1648 size_t len;
1649 int error;
1650
1651 len = sizeof(struct mqueue_msg) + msg_size;
1652 msg = malloc(len, M_MQUEUEDATA, M_WAITOK);
1653 error = copyin(msg_ptr, ((char *)msg) + sizeof(struct mqueue_msg),
1654 msg_size);
1655 if (error) {
1656 free(msg, M_MQUEUEDATA);
1657 msg = NULL;
1658 } else {
1659 msg->msg_size = msg_size;
1660 msg->msg_prio = msg_prio;
1661 }
1662 return (msg);
1663}
1664
1665/*
1666 * Save a message to user space

Callers 1

mqueue_sendFunction · 0.85

Calls 3

mallocFunction · 0.85
freeFunction · 0.70
copyinFunction · 0.50

Tested by

no test coverage detected