![]() |
![]() |
![]() |
PolicyKit Library Reference Manual | ![]() |
---|---|---|---|---|
Caller DeterminationCaller Determination — Obtaining seat, session and caller information via D-Bus and ConsoleKit. |
PolKitSession* polkit_session_new_from_objpath (DBusConnection *con, const char *objpath, uid_t uid, DBusError *error); PolKitSession* polkit_session_new_from_cookie (DBusConnection *con, const char *cookie, DBusError *error); PolKitCaller* polkit_caller_new_from_dbus_name (DBusConnection *con, const char *dbus_name, DBusError *error); PolKitCaller* polkit_caller_new_from_pid (DBusConnection *con, pid_t pid, DBusError *error);
Helper library for obtaining seat, session and caller information via D-Bus and ConsoleKit. This library is only useful when writing a mechanism. If the mechanism itself is a daemon exposing a remote services (via e.g. D-Bus) it's often a better idea, to reduce roundtrips, to track and cache caller information and construct PolKitCaller objects yourself based on this information (for an example of this, see the hald sources on how this can be done).
PolKitSession* polkit_session_new_from_objpath (DBusConnection *con, const char *objpath, uid_t uid, DBusError *error);
This function will construct a PolKitSession object by querying
the ConsoleKit daemon for information. Note that this will do a lot
of blocking IO so it is best avoided if your process already
tracks/caches all the information. If you pass in uid
as a
non-negative number, a round trip can be saved.
|
D-Bus system bus connection |
|
object path of ConsoleKit session object |
|
the user owning the session or -1 if unknown |
|
D-Bus error |
Returns : |
the new object or NULL if an error occured (in which case
error will be set)
|
PolKitSession* polkit_session_new_from_cookie (DBusConnection *con, const char *cookie, DBusError *error);
This function will construct a PolKitSession object by querying the ConsoleKit daemon for information. Note that this will do a lot of blocking IO so it is best avoided if your process already tracks/caches all the information.
|
D-Bus system bus connection |
|
a ConsoleKit XDG_SESSION_COOKIE |
|
D-Bus error |
Returns : |
the new object or NULL if an error occured (in which case
error will be set)
|
PolKitCaller* polkit_caller_new_from_dbus_name (DBusConnection *con, const char *dbus_name, DBusError *error);
This function will construct a PolKitCaller object by querying both the system bus daemon and the ConsoleKit daemon for information. Note that this will do a lot of blocking IO so it is best avoided if your process already tracks/caches all the information.
|
D-Bus system bus connection |
|
unique system bus connection name |
|
D-Bus error |
Returns : |
the new object or NULL if an error occured (in which case
error will be set)
|
PolKitCaller* polkit_caller_new_from_pid (DBusConnection *con, pid_t pid, DBusError *error);
This function will construct a PolKitCaller object by querying both information in /proc (on Linux) and the ConsoleKit daemon for information about a given process. Note that this will do a lot of blocking IO so it is best avoided if your process already tracks/caches all the information.
|
D-Bus system bus connection |
|
process id |
|
D-Bus error |
Returns : |
the new object or NULL if an error occured (in which case
error will be set)
|