# HG changeset patch # User Paul Boddie # Date 1655500718 -7200 # Node ID 1a8e1e5dd8f9926e6d996b79b1178e1ff212fa4d # Parent da7cfb64d1897cf66566e0a2a24fd254fd3766e7 Added some remarks about discarding capabilities when propagating them. diff -r da7cfb64d189 -r 1a8e1e5dd8f9 libipc/lib/src/message.c --- a/libipc/lib/src/message.c Fri Jun 17 21:30:30 2022 +0200 +++ b/libipc/lib/src/message.c Fri Jun 17 23:18:38 2022 +0200 @@ -236,6 +236,9 @@ void ipc_message_add_capability(ipc_message_t *msg, l4_cap_idx_t cap) { ipc_message_export_capability(msg, msg->items++, cap); + + /* NOTE: Might use the "grant" operation instead of explicitly discarding. */ + if (cap & IPC_DISCARD_CAP_FLAG) ipc_message_discard_capability(msg, cap & ~IPC_DISCARD_CAP_FLAG); } @@ -245,6 +248,9 @@ void ipc_message_add_item(ipc_message_t *msg, l4_cap_idx_t cap) { ipc_message_export_capability(msg, msg->items++, cap); + + /* NOTE: Might use the "grant" operation instead of explicitly discarding. */ + if (cap & IPC_DISCARD_CAP_FLAG) ipc_message_discard_capability(msg, cap & ~IPC_DISCARD_CAP_FLAG); }