Cap-resource request on Pd_session::transfer_quota

This patch handles the case where a PD's cap quota becomes exhausted
on the attempt to transfer caps via 'Env::pd().transfer_quota'. The
solution mirrors the existing code for RAM quota.

Prior this patch, the 'transfer_quota' operation would trigger an
'Out_of_caps' exception.
This commit is contained in:
Norman Feske 2019-08-17 00:17:23 +02:00 committed by Christian Helmuth
parent cc437a5eca
commit 6fb7022508
1 changed files with 9 additions and 0 deletions

View File

@ -85,6 +85,15 @@ struct Genode::Expanding_pd_session_client : Pd_session_client
[&] () { _request_ram_from_parent(amount.value); },
NUM_ATTEMPTS);
}
void transfer_quota(Pd_session_capability pd_session, Cap_quota amount) override
{
enum { NUM_ATTEMPTS = 2 };
retry<Out_of_caps>(
[&] () { Pd_session_client::transfer_quota(pd_session, amount); },
[&] () { _request_caps_from_parent(amount.value); },
NUM_ATTEMPTS);
}
};
#endif /* _INCLUDE__BASE__INTERNAL__EXPANDING_PD_SESSION_CLIENT_H_ */