base/connection.h: allow customized cap-quota arg

By default, a 'Connection' donates an amount of caps as declared in
SESSION_TYPE::CAP_QUOTA to the server at session-creation time.

In some situations, however, a client may deliberately want to donate a
larger amount. For example, when opening a GUI session at the wm, the
total amount of needed caps is the sum of those consumed by the wm plus
those consumed by nitpicker. Using this knowledge, the Gui::Connection
may specify a sufficient amount to avoid iterative session-creation
retries. The new 'Connection' constructor accommodates this use case by
accepting an explicit 'cap_quota' argument.

Issue #5340
This commit is contained in:
Norman Feske 2024-09-04 13:46:52 +02:00
parent 240b631512
commit 034de3b1b1

View File

@ -107,13 +107,14 @@ class Genode::Connection : public Connection_base
Client_id const &id,
Session_label const &label,
Ram_quota const &ram_quota,
Cap_quota const &cap_quota,
Affinity const &affinity,
Args const &args)
{
/* supplement session quotas and label as session arguments */
Args const complete_args("label=\"", label, "\", "
"ram_quota=", ram_quota, ", "
"cap_quota=", unsigned(SESSION_TYPE::CAP_QUOTA), ", ",
"cap_quota=", cap_quota, ", ",
args);
if (complete_args.length() == Args::capacity())
@ -138,12 +139,26 @@ class Genode::Connection : public Connection_base
Connection(Env &env,
Session_label const &label,
Ram_quota const &ram_quota,
Cap_quota const &cap_quota,
Affinity const &affinity,
Args const &args)
:
Connection_base(env),
_cap(_request(env, _id_space_element.id(),
label, ram_quota, affinity, args))
label, ram_quota, cap_quota, affinity, args))
{ }
/**
* Constructor using the cap quota declared in as SESSION_TYPE::CAP_QUOTA
*/
Connection(Env &env,
Session_label const &label,
Ram_quota const &ram_quota,
Affinity const &affinity,
Args const &args)
:
Connection(env, label, ram_quota, Cap_quota { unsigned(SESSION_TYPE::CAP_QUOTA) },
affinity, args)
{ }
/**