logind-seat.c revision 5eda94dda25bccda928c4b33c790dbe748573a22
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2011 Lennart Poettering
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <assert.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include "logind-seat.h"
#include "logind-acl.h"
#include "util.h"
Seat *s;
assert(m);
if (!s)
return NULL;
if (!s->state_file) {
free(s);
return NULL;
}
free(s);
return NULL;
}
s->manager = m;
return s;
}
assert(s);
while (s->sessions)
session_free(s->sessions);
while (s->devices)
device_free(s->devices);
free(s->state_file);
free(s);
}
FILE *f;
int r;
assert(s);
if (r < 0)
return r;
if (!f)
return -errno;
fprintf(f,
"IS_VTCONSOLE=%i\n",
if (s->active) {
fprintf(f,
"ACTIVE=%s\n"
"ACTIVE_UID=%lu\n",
}
if (s->sessions) {
Session *i;
fputs("OTHER_UIDS=", f);
if (i == s->active)
continue;
fprintf(f,
"%s%lu",
}
}
fflush(f);
if (ferror(f)) {
r = -errno;
unlink(s->state_file);
}
fclose(f);
return r;
}
assert(s);
return 0;
}
static int vt_allocate(int vtnr) {
int fd, r;
char *p;
return -ENOMEM;
free(p);
if (fd >= 0)
return r;
}
int seat_preallocate_vts(Seat *s) {
int i, r = 0;
assert(s);
return 0;
return 0;
int q;
q = vt_allocate(i);
if (r >= 0 && q < 0)
r = q;
}
return r;
}
int r;
assert(s);
s->id,
false,
if (r < 0)
return r;
}
Session *i;
assert(s);
old_active = s->active;
s->active = i;
break;
}
if (old_active == s->active)
return 0;
return 0;
}
int r = 0;
assert(s);
int k;
k = session_stop(session);
if (k < 0)
r = k;
}
return r;
}