L4Re - L4 Runtime Environment
L4Re::Inhibitor Class Reference

Set of inhibitor locks, which inhibit specific actions when held. More...

+ Inheritance diagram for L4Re::Inhibitor:
+ Collaboration diagram for L4Re::Inhibitor:

Public Types

enum  { Name_max = 20 }
 

Public Member Functions

long acquire (l4_umword_t id, L4::Ipc::String<> reason)
 Acquire a specific inhibitor lock. More...
 
long release (l4_umword_t id)
 Release a specific inhibitor lock. More...
 
long next_lock_info (char *name, unsigned len, l4_mword_t current_id=-1, l4_utcb_t *utcb=l4_utcb())
 Get information for the next available inhibitor lock. More...
 
- Public Member Functions inherited from L4::Kobject
l4_msgtag_t dec_refcnt (l4_mword_t diff, l4_utcb_t *utcb=l4_utcb())
 Decrement the in kernel reference counter for the object. More...
 

Additional Inherited Members

- Protected Types inherited from L4::Kobject_t< Inhibitor, L4::Kobject, L4RE_PROTO_INHIBITOR >
typedef Inhibitor Class
 The target interface type (inheriting from Kobject_t)
 
typedef Typeid::Iface< PROTO, Inhibitor > __Iface
 The interface description for the derived class.
 
typedef Typeid::Merge_list< Typeid::Iface_list< __Iface >, typename L4::Kobject ::__Iface_list > __Iface_list
 The list of all RPC interfaces provided directly or through inheritance.
 
- Protected Member Functions inherited from L4::Kobject_t< Inhibitor, L4::Kobject, L4RE_PROTO_INHIBITOR >
L4::Cap< Classc () const
 Get the capability to ourselves.
 
- Protected Member Functions inherited from L4::Kobject
l4_cap_idx_t cap () const throw ()
 Return capability selector. More...
 
- Static Protected Member Functions inherited from L4::Kobject_t< Inhibitor, L4::Kobject, L4RE_PROTO_INHIBITOR >
static void __check_protocols__ ()
 Helper to check for protocol conflicts.
 

Detailed Description

Set of inhibitor locks, which inhibit specific actions when held.

This interface provides access to a set of inhibitor locks, each determined by an ID that is specific to the Inhibitor object. Each individual lock shall prevent, a specific (implementation defined) action to be executed, as long as the lock is held.

For example there can be an inhibitor lock to prevent a transition to suspend-to-RAM state and a different one to prevent shutdown.

A client shall take an inhibitor lock if it needs to execute code before the action is taken. For example a lock-screen application shall grab an inhibitor lock for the suspend action to be able to lock the screen before the system goes to sleep.

Inhibitor locks are usually closely related to specific events. Usually a server automatically subscribes a client holding a lock to the corresponding event. The server shall send the event to inform the client that an action is pending. Upon reception of the event, the client is supposed to release the corresponding inhibitor lock.

Definition at line 40 of file inhibitor.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Name_max 

The maximum length of a lock's name.

Definition at line 44 of file inhibitor.

Member Function Documentation

◆ acquire()

long L4Re::Inhibitor::acquire ( l4_umword_t  id,
L4::Ipc::String<>  reason 
)

Acquire a specific inhibitor lock.

Parameters
idID of the inhibitor lock that the client intends to acquire
reasonThe reason why you need the lock. Used for informing the user or debugging.
Return values
0Success
-L4_ENODEVThe specified id does not exist.

◆ next_lock_info()

long L4Re::Inhibitor::next_lock_info ( char *  name,
unsigned  len,
l4_mword_t  current_id = -1,
l4_utcb_t utcb = l4_utcb() 
)
inline

Get information for the next available inhibitor lock.

Parameters
nameA pointer to a buffer for the name of the lock.
lenThe length of the available buffer (usually Name_max is used)
current_idThe ID of the last available lock, use -1 to get the first lock.
utcbThe UTCB to use for the message.
Return values
>0The ID of the next available lock if there is one (in this case name shall contain the name of the inhibitor lock).
-L4_ENODEVThere are no more locks.

Definition at line 86 of file inhibitor.

◆ release()

long L4Re::Inhibitor::release ( l4_umword_t  id)

Release a specific inhibitor lock.

Parameters
idThe ID of the inhibitor lock to release.
Return values
0Success
-L4_ENODEVLock with the given id does not exist.

The documentation for this class was generated from the following file: