mirror of
https://github.com/systemd/systemd.git
synced 2024-11-13 23:21:08 +03:00
023a4f6701
When generating utmp/wtmp entries, optionally add both LOGIN_PROCESS and INIT_PROCESS entries or even all three of LOGIN_PROCESS, INIT_PROCESS and USER_PROCESS entries, instead of just a single INIT_PROCESS entry. With this change systemd may be used to not only invoke a getty directly in a SysV-compliant way but alternatively also a login(1) implementation or even forego getty and login entirely, and invoke arbitrary shells in a way that they appear in who(1) or w(1). This is preparation for a later commit that adds a "machinectl shell" operation to invoke a shell in a container, in a way that is compatible with who(1) and w(1).
73 lines
2.2 KiB
C
73 lines
2.2 KiB
C
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
|
|
|
#pragma once
|
|
|
|
/***
|
|
This file is part of systemd.
|
|
|
|
Copyright 2010 Lennart Poettering
|
|
|
|
systemd is free software; you can redistribute it and/or modify it
|
|
under the terms of the GNU Lesser General Public License as published by
|
|
the Free Software Foundation; either version 2.1 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
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
|
***/
|
|
|
|
#include "util.h"
|
|
|
|
#ifdef HAVE_UTMP
|
|
int utmp_get_runlevel(int *runlevel, int *previous);
|
|
|
|
int utmp_put_shutdown(void);
|
|
int utmp_put_reboot(usec_t timestamp);
|
|
int utmp_put_runlevel(int runlevel, int previous);
|
|
|
|
int utmp_put_dead_process(const char *id, pid_t pid, int code, int status);
|
|
int utmp_put_init_process(const char *id, pid_t pid, pid_t sid, const char *line, int ut_type, const char *user);
|
|
|
|
int utmp_wall(
|
|
const char *message,
|
|
const char *username,
|
|
const char *origin_tty,
|
|
bool (*match_tty)(const char *tty, void *userdata),
|
|
void *userdata);
|
|
|
|
#else /* HAVE_UTMP */
|
|
|
|
static inline int utmp_get_runlevel(int *runlevel, int *previous) {
|
|
return -ESRCH;
|
|
}
|
|
static inline int utmp_put_shutdown(void) {
|
|
return 0;
|
|
}
|
|
static inline int utmp_put_reboot(usec_t timestamp) {
|
|
return 0;
|
|
}
|
|
static inline int utmp_put_runlevel(int runlevel, int previous) {
|
|
return 0;
|
|
}
|
|
static inline int utmp_put_dead_process(const char *id, pid_t pid, int code, int status) {
|
|
return 0;
|
|
}
|
|
static inline int utmp_put_init_process(const char *id, pid_t pid, pid_t sid, const char *line, int ut_type, const char *user) {
|
|
return 0;
|
|
}
|
|
static inline int utmp_wall(
|
|
const char *message,
|
|
const char *username,
|
|
const char *origin_tty,
|
|
bool (*match_tty)(const char *tty, void *userdata),
|
|
void *userdata) {
|
|
return 0;
|
|
}
|
|
|
|
#endif /* HAVE_UTMP */
|