run.c revision 7040b626e82d65dc48a4e464965e15ec7f529aec
e29e7a7e7e824df5cde83993d64c901926e5b0e9William King/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
e29e7a7e7e824df5cde83993d64c901926e5b0e9William King This file is part of systemd.
e29e7a7e7e824df5cde83993d64c901926e5b0e9William King Copyright 2013 Lennart Poettering
e29e7a7e7e824df5cde83993d64c901926e5b0e9William King systemd is free software; you can redistribute it and/or modify it
e29e7a7e7e824df5cde83993d64c901926e5b0e9William King under the terms of the GNU Lesser General Public License as published by
e29e7a7e7e824df5cde83993d64c901926e5b0e9William King the Free Software Foundation; either version 2.1 of the License, or
e29e7a7e7e824df5cde83993d64c901926e5b0e9William King (at your option) any later version.
e29e7a7e7e824df5cde83993d64c901926e5b0e9William King systemd is distributed in the hope that it will be useful, but
along with systemd; If not, see <http://www.gnu.org/licenses/>.
#include <stdio.h>
#include <getopt.h>
#include "sd-bus.h"
#include "bus-util.h"
#include "strv.h"
#include "build.h"
#include "unit-name.h"
#include "env-util.h"
#include "path-util.h"
#include "bus-error.h"
static bool arg_scope = false;
static bool arg_remain_after_exit = false;
static bool arg_send_sighup = false;
static bool arg_user = false;
static int arg_nice = 0;
static bool arg_nice_set = false;
static int help(void) {
return help();
case ARG_VERSION:
case ARG_USER:
arg_user = true;
case ARG_SYSTEM:
arg_user = false;
case ARG_SCOPE:
arg_scope = true;
case ARG_UNIT:
case ARG_DESCRIPTION:
case ARG_SLICE:
case ARG_SEND_SIGHUP:
arg_send_sighup = true;
arg_remain_after_exit = true;
case ARG_SERVICE_TYPE:
case ARG_EXEC_USER:
case ARG_EXEC_GROUP:
case ARG_NICE:
return -EINVAL;
arg_nice_set = true;
case ARG_SETENV:
return log_oom();
return log_oom();
return -EINVAL;
return -EINVAL;
return -EINVAL;
return -EINVAL;
return -EINVAL;
bus,
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
r = bus_append_unit_property_assignment(m, *i);
r = sd_bus_message_close_container(m);
if (!slice)
return -ENOMEM;
if (arg_send_sighup) {
*ret = m;
m = NULL;
static int message_start_transient_unit_send(sd_bus *bus, sd_bus_message *m, sd_bus_error *error, sd_bus_message **reply) {
assert(m);
r = sd_bus_message_close_container(m);
static int start_transient_service(
char **argv,
if (arg_unit)
if (!name)
return log_oom();
return bus_log_create_error(r);
if (arg_remain_after_exit) {
return bus_log_create_error(r);
if (arg_service_type) {
return bus_log_create_error(r);
if (arg_exec_user) {
return bus_log_create_error(r);
if (arg_exec_group) {
return bus_log_create_error(r);
if (arg_nice_set) {
return bus_log_create_error(r);
return bus_log_create_error(r);
return bus_log_create_error(r);
return bus_log_create_error(r);
return bus_log_create_error(r);
r = sd_bus_message_close_container(m);
return bus_log_create_error(r);
r = sd_bus_message_close_container(m);
return bus_log_create_error(r);
return bus_log_create_error(r);
return bus_log_create_error(r);
return bus_log_create_error(r);
return bus_log_create_error(r);
return bus_log_create_error(r);
return bus_log_create_error(r);
return bus_log_create_error(r);
return bus_log_create_error(r);
r = sd_bus_message_close_container(m);
return bus_log_create_error(r);
r = sd_bus_message_close_container(m);
return bus_log_create_error(r);
r = sd_bus_message_close_container(m);
return bus_log_create_error(r);
r = sd_bus_message_close_container(m);
return bus_log_create_error(r);
return bus_log_create_error(r);
static int start_transient_scope(
char **argv,
if (arg_unit)
if (!name)
return log_oom();
return bus_log_create_error(r);
return bus_log_create_error(r);
return bus_log_create_error(r);
if (arg_nice_set) {
return -errno;
if (arg_exec_group) {
return -errno;
if (arg_exec_user) {
return log_oom();
return log_oom();
return log_oom();
return log_oom();
if (!arg_exec_group) {
return -errno;
return -errno;
if (!env)
return log_oom();
return -errno;
log_open();
goto finish;
goto finish;
if (!arg_description) {
if (!description) {
r = log_oom();
goto finish;
goto finish;
if (arg_scope)