Struct ashpd::desktop::game_mode::GameModeProxy[][src]

pub struct GameModeProxy<'a>(_);
Expand description

The interface lets sandboxed applications access GameMode from within the sandbox.

It is analogous to the com.feralinteractive.GameMode interface and will proxy request there, but with additional permission checking and pid mapping. The latter is necessary in the case that sandbox has pid namespace isolation enabled. See the man page for pid_namespaces(7) for more details, but briefly, it means that the sandbox has its own process id namespace which is separated from the one on the host. Thus there will be two separate process ids (pids) within two different namespaces that both identify same process. One id from the pid namespace inside the sandbox and one id from the host pid namespace. Since GameMode expects pids from the host pid namespace but programs inside the sandbox can only know pids from the sandbox namespace, process ids need to be translated from the portal to the host namespace. The portal will do that transparently for all calls where this is necessary.

Note: GameMode will monitor active clients, i.e. games and other programs that have successfully called GameModeProxy::register_game. In the event that a client terminates without a call to the GameModeProxy::unregister_game method, GameMode will automatically un-register the client. This might happen with a (small) delay.

Implementations

Create a new instance of GameModeProxy.

Get a reference to the underlying Proxy.

Query the GameMode status for a process. If the caller is running inside a sandbox with pid namespace isolation, the pid will be translated to the respective host pid.

Arguments

  • pid - Process id to query the GameMode status of.

Query the GameMode status for a process.

Arguments

  • target - Pid file descriptor to query the GameMode status of.
  • requester - Pid file descriptor of the process requesting the information.

Query the GameMode status for a process.

Arguments

  • target - Process id to query the GameMode status of.
  • requester - Process id of the process requesting the information.

Register a game with GameMode and thus request GameMode to be activated. If the caller is running inside a sandbox with pid namespace isolation, the pid will be translated to the respective host pid. See the general introduction for details. If the GameMode has already been requested for pid before, this call will fail, i.e. result will be Error::RegisterGameRejected

Arguments

  • pid - Process id of the game to register.

Register a game with GameMode.

Arguments

  • target - Process file descriptor of the game to register.
  • requester - Process file descriptor of the process requesting the registration.

Register a game with GameMode.

Arguments

  • target - Process id of the game to register.
  • requester - Process id of the process requesting the registration.

Un-register a game from GameMode. if the call is successful and there are no other games or clients registered, GameMode will be deactivated. If the caller is running inside a sandbox with pid namespace isolation, the pid will be translated to the respective host pid.

Arguments

pid - Process id of the game to un-register.

Un-register a game from GameMode.

Arguments

  • target - Pid file descriptor of the game to un-register.
  • requester - Pid file descriptor of the process requesting the un-registration.

Un-register a game from GameMode.

Arguments

  • target - Process id of the game to un-register.
  • requester - Process id of the process requesting the un-registration.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.