***/
#include <sys/types.h>
-#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <pwd.h>
-#include <unistd.h>
#include <linux/vt.h>
#include "strv.h"
#include "cgroup-util.h"
-#include "audit.h"
#include "bus-util.h"
#include "bus-error.h"
#include "udev-util.h"
#include "logind.h"
+#include "terminal-util.h"
int manager_add_device(Manager *m, const char *sysfs, bool master, Device **_device) {
Device *d;
assert(m);
assert(name);
- u = hashmap_get(m->users, ULONG_TO_PTR((unsigned long) uid));
+ u = hashmap_get(m->users, UID_TO_PTR(uid));
if (!u) {
u = user_new(m, uid, gid, name);
if (!u)
return 0;
}
-int manager_watch_busname(Manager *m, const char *name) {
- char *n;
- int r;
-
- assert(m);
- assert(name);
-
- if (set_get(m->busnames, (char*) name))
- return 0;
-
- n = strdup(name);
- if (!n)
- return -ENOMEM;
-
- r = set_put(m->busnames, n);
- if (r < 0) {
- free(n);
- return r;
- }
-
- return 0;
-}
-
-void manager_drop_busname(Manager *m, const char *name) {
- Session *session;
- Iterator i;
-
- assert(m);
- assert(name);
-
- /* keep it if the name still owns a controller */
- HASHMAP_FOREACH(session, m->sessions, i)
- if (session_is_controller(session, name))
- return;
-
- free(set_remove(m->busnames, (char*) name));
-}
-
int manager_process_seat_device(Manager *m, struct udev_device *d) {
Device *device;
int r;
}
int manager_get_session_by_pid(Manager *m, pid_t pid, Session **session) {
+/// elogind does not support systemd units, but its own session system
+#if 0
_cleanup_free_ char *unit = NULL;
+#else
+ _cleanup_free_ char *session_name = NULL;
+#endif
Session *s;
int r;
if (pid < 1)
return -EINVAL;
+/// elogind does not support systemd units, but its own session system
+#if 0
r = cg_pid_get_unit(pid, &unit);
if (r < 0)
return 0;
s = hashmap_get(m->session_units, unit);
+#else
+ r = cg_pid_get_session(pid, &session_name);
+ if (r < 0)
+ return 0;
+
+ s = hashmap_get(m->sessions, session_name);
+#endif
if (!s)
return 0;
}
int manager_get_user_by_pid(Manager *m, pid_t pid, User **user) {
+/// elogind does not support systemd units, but its own session system
+#if 0
_cleanup_free_ char *unit = NULL;
User *u;
+#else
+ Session *s;
+#endif
int r;
assert(m);
if (pid < 1)
return -EINVAL;
+/// elogind does not support systemd units, but its own session system
+#if 0
r = cg_pid_get_slice(pid, &unit);
if (r < 0)
return 0;
return 0;
*user = u;
+#else
+ r = manager_get_session_by_pid (m, pid, &s);
+ if (r <= 0)
+ return r;
+
+ *user = s->user;
+#endif // 0
+
return 1;
}
return strv_contains(m->kill_only_users, user);
}
+/// UNNEEDED by elogind
+#if 0
static int vt_is_busy(unsigned int vtnr) {
struct vt_stat vt_stat;
int r = 0;
return r;
}
+#endif // 0
bool manager_is_docked(Manager *m) {
Iterator i;
* assume that we are docked. */
n = manager_count_displays(m);
if (n < 0)
- log_warning_errno(-n, "Display counting failed: %m");
+ log_warning_errno(n, "Display counting failed: %m");
else if (n > 1) {
log_debug("Multiple (%i) displays connected.", n);
return true;