#include <errno.h>
#include <fcntl.h>
-#include <stdio_ext.h>
#include <string.h>
+#include <sys/stat.h>
#include <unistd.h>
#include "sd-messages.h"
#include "fileio.h"
#include "format-util.h"
#include "logind-acl.h"
+#include "logind-seat-dbus.h"
#include "logind-seat.h"
+#include "logind-session-dbus.h"
#include "mkdir.h"
#include "parse-util.h"
#include "stdio-util.h"
#include "string-util.h"
#include "terminal-util.h"
+#include "tmpfile-util.h"
#include "util.h"
int seat_new(Seat** ret, Manager *m, const char *id) {
if (r < 0)
goto fail;
- (void) __fsetlocking(f, FSETLOCKING_BYCALLER);
(void) fchmod(fileno(f), 0644);
fprintf(f,
return 0;
}
-static int vt_allocate(unsigned int vtnr) {
- char p[sizeof("/dev/tty") + DECIMAL_STR_MAX(unsigned int)];
+static int vt_allocate(unsigned vtnr) {
+ char p[sizeof("/dev/tty") + DECIMAL_STR_MAX(unsigned)];
_cleanup_close_ int fd = -1;
assert(vtnr >= 1);
return 0;
}
-int seat_switch_to(Seat *s, unsigned int num) {
+int seat_switch_to(Seat *s, unsigned num) {
/* Public session positions skip 0 (there is only F1-F12). Maybe it
* will get reassigned in the future, so return error for now. */
if (num == 0)
}
int seat_switch_to_next(Seat *s) {
- unsigned int start, i;
+ unsigned start, i;
if (s->position_count == 0)
return -EINVAL;
}
int seat_switch_to_previous(Seat *s) {
- unsigned int start, i;
+ unsigned start, i;
if (s->position_count == 0)
return -EINVAL;
return -EINVAL;
}
-int seat_active_vt_changed(Seat *s, unsigned int vtnr) {
+int seat_active_vt_changed(Seat *s, unsigned vtnr) {
Session *i, *new_active = NULL;
int r;
k = read(s->manager->console_active_fd, t, sizeof(t)-1);
if (k <= 0) {
- log_error("Failed to read current console: %s", k < 0 ? strerror(-errno) : "EOF");
+ log_error("Failed to read current console: %s", k < 0 ? strerror(errno) : "EOF");
return k < 0 ? -errno : -EIO;
}
}
int seat_stop(Seat *s, bool force) {
- int r = 0;
+ int r;
assert(s);
"SEAT_ID=%s", s->id,
LOG_MESSAGE("Removed seat %s.", s->id));
- seat_stop_sessions(s, force);
+ r = seat_stop_sessions(s, force);
(void) unlink(s->state_file);
seat_add_to_gc_queue(s);
void seat_evict_position(Seat *s, Session *session) {
Session *iter;
- unsigned int pos = session->position;
+ unsigned pos = session->position;
session->position = 0;
}
}
-void seat_claim_position(Seat *s, Session *session, unsigned int pos) {
+void seat_claim_position(Seat *s, Session *session, unsigned pos) {
/* with VTs, the position is always the same as the VTnr */
if (seat_has_vts(s))
pos = session->vtnr;
}
static void seat_assign_position(Seat *s, Session *session) {
- unsigned int pos;
+ unsigned pos;
if (session->position > 0)
return;