Commit 514f4ef5 authored by Lennart Poettering's avatar Lennart Poettering
Browse files

systemctl: add verbs for special units

parent ef2f1067
......@@ -19,6 +19,9 @@ systemadm
*~
*.tar.gz
*.o
*.lo
*.a
*.la
.deps/
Makefile.in
aclocal.m4
......@@ -37,3 +40,6 @@ missing
stamp-*
*.stamp
Makefile
ltmain.sh
*.tar.bz2
libtool
......@@ -287,7 +287,8 @@ EXTRA_DIST += \
src/securebits.h \
src/linux/auto_dev-ioctl.h \
src/initreq.h \
src/sd-daemon.h
src/sd-daemon.h \
src/special.h
dist_man_MANS = \
man/systemd.unit.5 \
......
......@@ -69,13 +69,10 @@
<filename>rescue.target</filename>,
<filename>rpcbind.target</filename>,
<filename>rtc-set.target</filename>,
<filename>runlevel0.target</filename>,
<filename>runlevel1.target</filename>,
<filename>runlevel2.target</filename>,
<filename>runlevel3.target</filename>,
<filename>runlevel4.target</filename>,
<filename>runlevel5.target</filename>,
<filename>runlevel6.target</filename>
<filename>shutdown.target</filename>,
<filename>sigpwr.target</filename>,
<filename>sockets.target</filename>,
......@@ -414,32 +411,6 @@
facility.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>runlevel0.target</filename></term>
<listitem>
<para>This is a target that is
called whever the SysV
compatibility code asks for
runlevel 0. This is an alias
for
<filename>poweroff.target</filename>,
for compatibility with
SysV.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>runlevel1.target</filename></term>
<listitem>
<para>This is a target that is
called whever the SysV
compatibility code asks for
runlevel 1. This is an alias
for
<filename>rescue.target</filename>,
for compatibility with
SysV.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>runlevel2.target</filename></term>
<listitem>
......@@ -494,19 +465,6 @@
<filename>graphical.target</filename>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>runlevel6.target</filename></term>
<listitem>
<para>This is a target that is
called whever the SysV
compatibility code asks for
runlevel 6. This is an alias
for
<filename>reboot.target</filename>,
for compatibility with
SysV.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>shutdown.target</filename></term>
<listitem>
......
......@@ -39,7 +39,7 @@
#include "log.h"
#include "list.h"
#include "initreq.h"
#include "manager.h"
#include "special.h"
#include "sd-daemon.h"
#define SERVER_FD_MAX 16
......@@ -72,15 +72,15 @@ static const char *translate_runlevel(int runlevel) {
const int runlevel;
const char *special;
} table[] = {
{ '0', SPECIAL_RUNLEVEL0_TARGET },
{ '1', SPECIAL_RUNLEVEL1_TARGET },
{ 's', SPECIAL_RUNLEVEL1_TARGET },
{ 'S', SPECIAL_RUNLEVEL1_TARGET },
{ '0', SPECIAL_POWEROFF_TARGET },
{ '1', SPECIAL_RESCUE_TARGET },
{ 's', SPECIAL_RESCUE_TARGET },
{ 'S', SPECIAL_RESCUE_TARGET },
{ '2', SPECIAL_RUNLEVEL2_TARGET },
{ '3', SPECIAL_RUNLEVEL3_TARGET },
{ '4', SPECIAL_RUNLEVEL4_TARGET },
{ '5', SPECIAL_RUNLEVEL5_TARGET },
{ '6', SPECIAL_RUNLEVEL6_TARGET },
{ '6', SPECIAL_REBOOT_TARGET },
};
unsigned i;
......
......@@ -40,6 +40,7 @@
#include "kmod-setup.h"
#include "load-fragment.h"
#include "fdset.h"
#include "special.h"
static enum {
ACTION_RUN,
......@@ -222,11 +223,11 @@ static int set_default_unit(const char *u) {
static int parse_proc_cmdline_word(const char *word) {
static const char * const rlmap[] = {
"single", SPECIAL_RUNLEVEL1_TARGET,
"-s", SPECIAL_RUNLEVEL1_TARGET,
"s", SPECIAL_RUNLEVEL1_TARGET,
"S", SPECIAL_RUNLEVEL1_TARGET,
"1", SPECIAL_RUNLEVEL1_TARGET,
"single", SPECIAL_RESCUE_TARGET,
"-s", SPECIAL_RESCUE_TARGET,
"s", SPECIAL_RESCUE_TARGET,
"S", SPECIAL_RESCUE_TARGET,
"1", SPECIAL_RESCUE_TARGET,
"2", SPECIAL_RUNLEVEL2_TARGET,
"3", SPECIAL_RUNLEVEL3_TARGET,
"4", SPECIAL_RUNLEVEL4_TARGET,
......
......@@ -53,6 +53,7 @@
#include "dbus-job.h"
#include "missing.h"
#include "path-lookup.h"
#include "special.h"
/* As soon as 16 units are in our GC queue, make sure to run a gc sweep */
#define GC_QUEUE_ENTRIES_MAX 16
......
......@@ -85,57 +85,6 @@ struct Watch {
#include "dbus.h"
#include "path-lookup.h"
#define SPECIAL_DEFAULT_TARGET "default.target"
/* This is not really intended to be started by directly. This is
* mostly so that other targets (reboot/halt/poweroff) can depend on
* it to bring all services down that want to be brought down on
* system shutdown. */
#define SPECIAL_SHUTDOWN_TARGET "shutdown.target"
#define SPECIAL_LOGGER_SOCKET "systemd-logger.socket"
#define SPECIAL_KBREQUEST_TARGET "kbrequest.target"
#define SPECIAL_SIGPWR_TARGET "sigpwr.target"
#define SPECIAL_CTRL_ALT_DEL_TARGET "ctrl-alt-del.target"
#define SPECIAL_LOCAL_FS_TARGET "local-fs.target" /* LSB's $local_fs */
#define SPECIAL_REMOTE_FS_TARGET "remote-fs.target" /* LSB's $remote_fs */
#define SPECIAL_SWAP_TARGET "swap.target"
#define SPECIAL_NETWORK_TARGET "network.target" /* LSB's $network */
#define SPECIAL_NSS_LOOKUP_TARGET "nss-lookup.target" /* LSB's $named */
#define SPECIAL_RPCBIND_TARGET "rpcbind.target" /* LSB's $portmap */
#define SPECIAL_SYSLOG_TARGET "syslog.target" /* LSB's $syslog; Should pull in syslog.socket or syslog.service */
#define SPECIAL_RTC_SET_TARGET "rtc-set.target" /* LSB's $time */
#define SPECIAL_DISPLAY_MANAGER_SERVICE "display-manager.service" /* Debian's $x-display-manager */
#define SPECIAL_MAIL_TRANSFER_AGENT_TARGET "mail-transfer-agent.target" /* Debian's $mail-{transport|transfer-agent */
#define SPECIAL_BASIC_TARGET "basic.target"
#define SPECIAL_SYSINIT_TARGET "sysinit.target"
#define SPECIAL_RESCUE_TARGET "rescue.target"
#define SPECIAL_EXIT_SERVICE "exit.service"
#define SPECIAL_EMERGENCY_SERVICE "emergency.service"
#define SPECIAL_HALT_TARGET "halt.target"
#define SPECIAL_POWEROFF_TARGET "poweroff.target"
#define SPECIAL_REBOOT_TARGET "reboot.target"
#ifndef SPECIAL_DBUS_SERVICE
#define SPECIAL_DBUS_SERVICE "dbus.service"
#endif
#ifndef SPECIAL_SYSLOG_SERVICE
#define SPECIAL_SYSLOG_SERVICE "syslog.service"
#endif
/* For SysV compatibility. Usually an alias for a saner target. On
* SysV-free systems this doesn't exist. */
#define SPECIAL_RUNLEVEL0_TARGET "runlevel0.target"
#define SPECIAL_RUNLEVEL1_TARGET "runlevel1.target"
#define SPECIAL_RUNLEVEL2_TARGET "runlevel2.target"
#define SPECIAL_RUNLEVEL3_TARGET "runlevel3.target"
#define SPECIAL_RUNLEVEL4_TARGET "runlevel4.target"
#define SPECIAL_RUNLEVEL5_TARGET "runlevel5.target"
#define SPECIAL_RUNLEVEL6_TARGET "runlevel6.target"
struct Manager {
uint32_t current_job_id;
......
......@@ -35,6 +35,7 @@
#include "unit-name.h"
#include "mount.h"
#include "dbus-mount.h"
#include "special.h"
static const UnitActiveState state_translation_table[_MOUNT_STATE_MAX] = {
[MOUNT_DEAD] = UNIT_INACTIVE,
......
......@@ -32,6 +32,7 @@
#include "strv.h"
#include "unit-name.h"
#include "dbus-service.h"
#include "special.h"
#define COMMENTS "#;\n"
#define NEWLINES "\n\r"
......@@ -49,13 +50,13 @@ static const struct {
const RunlevelType type;
} rcnd_table[] = {
/* Standard SysV runlevels */
{ "rc0.d", SPECIAL_RUNLEVEL0_TARGET, RUNLEVEL_DOWN },
{ "rc1.d", SPECIAL_RUNLEVEL1_TARGET, RUNLEVEL_UP },
{ "rc0.d", SPECIAL_POWEROFF_TARGET, RUNLEVEL_DOWN },
{ "rc1.d", SPECIAL_RESCUE_TARGET, RUNLEVEL_UP },
{ "rc2.d", SPECIAL_RUNLEVEL2_TARGET, RUNLEVEL_UP },
{ "rc3.d", SPECIAL_RUNLEVEL3_TARGET, RUNLEVEL_UP },
{ "rc4.d", SPECIAL_RUNLEVEL4_TARGET, RUNLEVEL_UP },
{ "rc5.d", SPECIAL_RUNLEVEL5_TARGET, RUNLEVEL_UP },
{ "rc6.d", SPECIAL_RUNLEVEL6_TARGET, RUNLEVEL_DOWN },
{ "rc6.d", SPECIAL_REBOOT_TARGET, RUNLEVEL_DOWN },
/* SUSE style boot.d */
{ "boot.d", SPECIAL_SYSINIT_TARGET, RUNLEVEL_SYSINIT },
......
/*-*- Mode: C; c-basic-offset: 8 -*-*/
#ifndef foospecialhfoo
#define foospecialhfoo
/***
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 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/>.
***/
#define SPECIAL_DEFAULT_TARGET "default.target"
/* This is not really intended to be started by directly. This is
* mostly so that other targets (reboot/halt/poweroff) can depend on
* it to bring all services down that want to be brought down on
* system shutdown. */
#define SPECIAL_SHUTDOWN_TARGET "shutdown.target"
#define SPECIAL_LOGGER_SOCKET "systemd-logger.socket"
#define SPECIAL_KBREQUEST_TARGET "kbrequest.target"
#define SPECIAL_SIGPWR_TARGET "sigpwr.target"
#define SPECIAL_CTRL_ALT_DEL_TARGET "ctrl-alt-del.target"
#define SPECIAL_LOCAL_FS_TARGET "local-fs.target" /* LSB's $local_fs */
#define SPECIAL_REMOTE_FS_TARGET "remote-fs.target" /* LSB's $remote_fs */
#define SPECIAL_SWAP_TARGET "swap.target"
#define SPECIAL_NETWORK_TARGET "network.target" /* LSB's $network */
#define SPECIAL_NSS_LOOKUP_TARGET "nss-lookup.target" /* LSB's $named */
#define SPECIAL_RPCBIND_TARGET "rpcbind.target" /* LSB's $portmap */
#define SPECIAL_SYSLOG_TARGET "syslog.target" /* LSB's $syslog; Should pull in syslog.socket or syslog.service */
#define SPECIAL_RTC_SET_TARGET "rtc-set.target" /* LSB's $time */
#define SPECIAL_DISPLAY_MANAGER_SERVICE "display-manager.service" /* Debian's $x-display-manager */
#define SPECIAL_MAIL_TRANSFER_AGENT_TARGET "mail-transfer-agent.target" /* Debian's $mail-{transport|transfer-agent */
#define SPECIAL_BASIC_TARGET "basic.target"
#define SPECIAL_SYSINIT_TARGET "sysinit.target"
#define SPECIAL_RESCUE_TARGET "rescue.target"
#define SPECIAL_EXIT_SERVICE "exit.service"
#define SPECIAL_EMERGENCY_SERVICE "emergency.service"
#define SPECIAL_HALT_TARGET "halt.target"
#define SPECIAL_POWEROFF_TARGET "poweroff.target"
#define SPECIAL_REBOOT_TARGET "reboot.target"
#ifndef SPECIAL_DBUS_SERVICE
#define SPECIAL_DBUS_SERVICE "dbus.service"
#endif
#ifndef SPECIAL_SYSLOG_SERVICE
#define SPECIAL_SYSLOG_SERVICE "syslog.service"
#endif
/* For SysV compatibility. Usually an alias for a saner target. On
* SysV-free systems this doesn't exist. */
#define SPECIAL_RUNLEVEL2_TARGET "runlevel2.target"
#define SPECIAL_RUNLEVEL3_TARGET "runlevel3.target"
#define SPECIAL_RUNLEVEL4_TARGET "runlevel4.target"
#define SPECIAL_RUNLEVEL5_TARGET "runlevel5.target"
#endif
......@@ -33,6 +33,7 @@
#include "load-dropin.h"
#include "unit-name.h"
#include "dbus-swap.h"
#include "special.h"
static const UnitActiveState state_translation_table[_SWAP_STATE_MAX] = {
[SWAP_DEAD] = UNIT_INACTIVE,
......
This diff is collapsed.
......@@ -27,6 +27,7 @@
#include "load-fragment.h"
#include "log.h"
#include "dbus-target.h"
#include "special.h"
static const UnitActiveState state_translation_table[_TARGET_STATE_MAX] = {
[TARGET_DEAD] = UNIT_INACTIVE,
......@@ -147,9 +148,9 @@ int target_get_runlevel(Target *t) {
{ SPECIAL_RUNLEVEL4_TARGET, '4' },
{ SPECIAL_RUNLEVEL3_TARGET, '3' },
{ SPECIAL_RUNLEVEL2_TARGET, '2' },
{ SPECIAL_RUNLEVEL1_TARGET, '1' },
{ SPECIAL_RUNLEVEL0_TARGET, '0' },
{ SPECIAL_RUNLEVEL6_TARGET, '6' },
{ SPECIAL_RESCUE_TARGET, '1' },
{ SPECIAL_POWEROFF_TARGET, '0' },
{ SPECIAL_REBOOT_TARGET, '6' },
};
unsigned i;
......
......@@ -38,6 +38,7 @@
#include "unit-name.h"
#include "specifier.h"
#include "dbus-unit.h"
#include "special.h"
const UnitVTable * const unit_vtable[_UNIT_TYPE_MAX] = {
[UNIT_SERVICE] = &service_vtable,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment