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

Function ng_package_msg

lib/ff_ng_base.c:3564–3585  ·  view source on GitHub ↗

* Allocate a queue item and put items into it.. * Evaluate the address as this will be needed to queue it and * to work out what some of the fields should be. * Hook and node references will be removed when the item is dequeued. * (or equivalent) */

Source from the content-addressed store, hash-verified

3562 * (or equivalent)
3563 */
3564item_p
3565ng_package_msg(struct ng_mesg *msg, int flags)
3566{
3567 item_p item;
3568
3569 if ((item = ng_alloc_item(NGQF_MESG, flags)) == NULL) {
3570 NG_FREE_MSG(msg);
3571 return (NULL);
3572 }
3573 ITEM_DEBUG_CHECKS;
3574 /* Messages items count as writers unless explicitly exempted. */
3575 if (msg->header.cmd & NGM_READONLY)
3576 item->el_flags |= NGQF_READER;
3577 else
3578 item->el_flags |= NGQF_WRITER;
3579 /*
3580 * Set the current lasthook into the queue item
3581 */
3582 NGI_MSG(item) = msg;
3583 NGI_RETADDR(item) = 0;
3584 return (item);
3585}
3586
3587#define SET_RETADDR(item, here, retaddr) \
3588 do { /* Data or fn items don't have retaddrs */ \

Callers

nothing calls this directly

Calls 1

ng_alloc_itemFunction · 0.70

Tested by

no test coverage detected