utmp-wtmp.c revision 169c1bda807d183a362b47efe0b5b56e9320e430
770b5ce4fc31a336a41e81381c229da725ef0cfaLennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
770b5ce4fc31a336a41e81381c229da725ef0cfaLennart Poettering This file is part of systemd.
770b5ce4fc31a336a41e81381c229da725ef0cfaLennart Poettering Copyright 2010 Lennart Poettering
770b5ce4fc31a336a41e81381c229da725ef0cfaLennart Poettering systemd is free software; you can redistribute it and/or modify it
770b5ce4fc31a336a41e81381c229da725ef0cfaLennart Poettering under the terms of the GNU General Public License as published by
822cd601357f6f45d0176ae38fe9f86077462f06Lennart Poettering the Free Software Foundation; either version 2 of the License, or
770b5ce4fc31a336a41e81381c229da725ef0cfaLennart Poettering (at your option) any later version.
770b5ce4fc31a336a41e81381c229da725ef0cfaLennart Poettering systemd is distributed in the hope that it will be useful, but
770b5ce4fc31a336a41e81381c229da725ef0cfaLennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
770b5ce4fc31a336a41e81381c229da725ef0cfaLennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
770b5ce4fc31a336a41e81381c229da725ef0cfaLennart Poettering General Public License for more details.
770b5ce4fc31a336a41e81381c229da725ef0cfaLennart Poettering You should have received a copy of the GNU General Public License
770b5ce4fc31a336a41e81381c229da725ef0cfaLennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
#include <assert.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include "macro.h"
#include "utmp-wtmp.h"
*runlevel = e[0];
if (previous) {
*previous = e[0];
*previous = 0;
return -errno;
setutxent();
r = -errno;
r = -EIO;
*runlevel = a;
if (previous)
*previous = b;
endutxent();
return -errno;
setutxent();
r = -errno;
endutxent();
errno = 0;
return -errno;
if (r == -ENOENT)
size_t l;
return id;
if (line)
setutxent();
if (previous <= 0) {
if (r != -ESRCH)
previous = 0;
int fd, r;
return -errno;
r = -errno;
goto finish;
p = message;
while (left > 0) {
ssize_t n;
usec_t t;
if (t >= end) {
r = -ETIME;
goto finish;
return -errno;
r = -ETIME;
goto finish;
r = -errno;
goto finish;
left -= n;
struct utmpx *u;
r = -ENOMEM;
goto finish;
message) < 0) {
r = -ENOMEM;
goto finish;
setutxent();
while ((u = getutxent())) {
const char *path;
r = -ENOMEM;
goto finish;