# HG changeset patch # User Paul Boddie # Date 1714951522 -7200 # Node ID ebc8f4e0c4816d982e5ef843410059133af53899 # Parent 550396dab4dae1e31d06401cd4f889c21ed0bd4d# Parent 5b77aef76beac37486d5337021df112dae5dcd6b Merged changes from the default branch. diff -r 550396dab4da -r ebc8f4e0c481 libexec/lib/src/internal_pager.cc --- a/libexec/lib/src/internal_pager.cc Thu Apr 18 17:14:13 2024 +0200 +++ b/libexec/lib/src/internal_pager.cc Mon May 06 01:25:22 2024 +0200 @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -125,6 +126,9 @@ *region = {0, l4_fpage_invalid()}; + if (err) + printf("InternalPager: mapping error: %s\n", l4sys_errtostr(err)); + return err; } diff -r 550396dab4da -r ebc8f4e0c481 libipc/lib/src/message.c --- a/libipc/lib/src/message.c Thu Apr 18 17:14:13 2024 +0200 +++ b/libipc/lib/src/message.c Mon May 06 01:25:22 2024 +0200 @@ -213,7 +213,12 @@ msg->discarded_items = 0; msg->words = 0; msg->items = 0; + + /* Initialise items to be received. + NOTE: This does not support item type mixing. */ + msg->import_item = 0; + msg->bregs.bdr = 0; /* Message label overriding. */ @@ -510,8 +515,16 @@ if (local) return L4_EOK; - err = ipc_message_expect_capability(msg, msg->import_item); - msg->import_item += 1; + /* Only if the specified item yielded a valid capability, will an allocated + have been consumed. Otherwise, the next allocated capability will still be + available. */ + + if (l4_is_valid_cap(*ref)) + { + err = ipc_message_expect_capability(msg, msg->import_item); + msg->import_item += 1; + } + return err; } diff -r 550396dab4da -r ebc8f4e0c481 libipc/lib/src/util_ipc.c --- a/libipc/lib/src/util_ipc.c Thu Apr 18 17:14:13 2024 +0200 +++ b/libipc/lib/src/util_ipc.c Mon May 06 01:25:22 2024 +0200 @@ -60,7 +60,6 @@ /* Indicate the expectation of a capability in return. */ - bregs->bdr = 0; bregs->br[item] = L4_RCV_ITEM_SINGLE_CAP | future | L4_RCV_ITEM_LOCAL_ID; return L4_EOK; @@ -70,7 +69,6 @@ long _expect_fpage(l4_buf_regs_t *bregs, int item, l4_umword_t map_control, l4_fpage_t fpage) { - bregs->bdr = 0; bregs->br[item] = map_control; bregs->br[item + 1] = fpage.raw;