]>
Commit | Line | Data |
---|---|---|
03467c88 | 1 | /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ |
4139c1b2 LP |
2 | |
3 | #ifndef foodbusexecutehfoo | |
4 | #define foodbusexecutehfoo | |
5 | ||
6 | /*** | |
7 | This file is part of systemd. | |
8 | ||
9 | Copyright 2010 Lennart Poettering | |
10 | ||
11 | systemd is free software; you can redistribute it and/or modify it | |
12 | under the terms of the GNU General Public License as published by | |
13 | the Free Software Foundation; either version 2 of the License, or | |
14 | (at your option) any later version. | |
15 | ||
16 | systemd is distributed in the hope that it will be useful, but | |
17 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
19 | General Public License for more details. | |
20 | ||
21 | You should have received a copy of the GNU General Public License | |
22 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
23 | ***/ | |
24 | ||
25 | #include <dbus/dbus.h> | |
26 | ||
27 | #include "manager.h" | |
28 | ||
b58b4116 LP |
29 | #define BUS_EXEC_STATUS_INTERFACE(prefix) \ |
30 | " <property name=\"" prefix "StartTimestamp\" type=\"t\" access=\"read\"/>\n" \ | |
b21a0ef8 | 31 | " <property name=\"" prefix "StartTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \ |
b58b4116 | 32 | " <property name=\"" prefix "ExitTimestamp\" type=\"t\" access=\"read\"/>\n" \ |
b21a0ef8 | 33 | " <property name=\"" prefix "ExitTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \ |
b58b4116 LP |
34 | " <property name=\"" prefix "PID\" type=\"u\" access=\"read\"/>\n" \ |
35 | " <property name=\"" prefix "Code\" type=\"i\" access=\"read\"/>\n" \ | |
36 | " <property name=\"" prefix "Status\" type=\"i\" access=\"read\"/>\n" | |
37 | ||
4139c1b2 | 38 | #define BUS_EXEC_CONTEXT_INTERFACE \ |
4288f619 LP |
39 | " <property name=\"Environment\" type=\"as\" access=\"read\"/>\n" \ |
40 | " <property name=\"UMask\" type=\"u\" access=\"read\"/>\n" \ | |
82c121a4 LP |
41 | " <property name=\"LimitCPU\" type=\"t\" access=\"read\"/>\n" \ |
42 | " <property name=\"LimitFSIZE\" type=\"t\" access=\"read\"/>\n" \ | |
43 | " <property name=\"LimitDATA\" type=\"t\" access=\"read\"/>\n" \ | |
44 | " <property name=\"LimitSTACK\" type=\"t\" access=\"read\"/>\n" \ | |
45 | " <property name=\"LimitCORE\" type=\"t\" access=\"read\"/>\n" \ | |
46 | " <property name=\"LimitRSS\" type=\"t\" access=\"read\"/>\n" \ | |
47 | " <property name=\"LimitNOFILE\" type=\"t\" access=\"read\"/>\n" \ | |
48 | " <property name=\"LimitAS\" type=\"t\" access=\"read\"/>\n" \ | |
49 | " <property name=\"LimitNPROC\" type=\"t\" access=\"read\"/>\n" \ | |
50 | " <property name=\"LimitMEMLOCK\" type=\"t\" access=\"read\"/>\n" \ | |
51 | " <property name=\"LimitLOCKS\" type=\"t\" access=\"read\"/>\n" \ | |
52 | " <property name=\"LimitSIGPENDING\" type=\"t\" access=\"read\"/>\n" \ | |
53 | " <property name=\"LimitMSGQUEUE\" type=\"t\" access=\"read\"/>\n" \ | |
54 | " <property name=\"LimitNICE\" type=\"t\" access=\"read\"/>\n" \ | |
55 | " <property name=\"LimitRTPRIO\" type=\"t\" access=\"read\"/>\n" \ | |
56 | " <property name=\"LimitRTTIME\" type=\"t\" access=\"read\"/>\n" \ | |
4288f619 LP |
57 | " <property name=\"WorkingDirectory\" type=\"s\" access=\"read\"/>\n" \ |
58 | " <property name=\"RootDirectory\" type=\"s\" access=\"read\"/>\n" \ | |
dd6c17b1 | 59 | " <property name=\"OOMScoreAdjust\" type=\"i\" access=\"read\"/>\n" \ |
82c121a4 LP |
60 | " <property name=\"Nice\" type=\"i\" access=\"read\"/>\n" \ |
61 | " <property name=\"IOScheduling\" type=\"i\" access=\"read\"/>\n" \ | |
62 | " <property name=\"CPUSchedulingPolicy\" type=\"i\" access=\"read\"/>\n" \ | |
63 | " <property name=\"CPUSchedulingPriority\" type=\"i\" access=\"read\"/>\n" \ | |
64 | " <property name=\"CPUAffinity\" type=\"ay\" access=\"read\"/>\n" \ | |
65 | " <property name=\"TimerSlackNS\" type=\"t\" access=\"read\"/>\n" \ | |
4288f619 LP |
66 | " <property name=\"CPUSchedulingResetOnFork\" type=\"b\" access=\"read\"/>\n" \ |
67 | " <property name=\"NonBlocking\" type=\"b\" access=\"read\"/>\n" \ | |
68 | " <property name=\"StandardInput\" type=\"s\" access=\"read\"/>\n" \ | |
69 | " <property name=\"StandardOutput\" type=\"s\" access=\"read\"/>\n" \ | |
70 | " <property name=\"StandardError\" type=\"s\" access=\"read\"/>\n" \ | |
71 | " <property name=\"TTYPath\" type=\"s\" access=\"read\"/>\n" \ | |
72 | " <property name=\"SyslogPriority\" type=\"i\" access=\"read\"/>\n" \ | |
73 | " <property name=\"SyslogIdentifier\" type=\"s\" access=\"read\"/>\n" \ | |
74922904 | 74 | " <property name=\"SyslogLevelPrefix\" type=\"b\" access=\"read\"/>\n" \ |
82c121a4 | 75 | " <property name=\"Capabilities\" type=\"s\" access=\"read\"/>\n" \ |
4288f619 LP |
76 | " <property name=\"SecureBits\" type=\"i\" access=\"read\"/>\n" \ |
77 | " <property name=\"CapabilityBoundingSetDrop\" type=\"t\" access=\"read\"/>\n" \ | |
78 | " <property name=\"User\" type=\"s\" access=\"read\"/>\n" \ | |
79 | " <property name=\"Group\" type=\"s\" access=\"read\"/>\n" \ | |
df1f0afe | 80 | " <property name=\"SupplementaryGroups\" type=\"as\" access=\"read\"/>\n" \ |
5b6319dc | 81 | " <property name=\"TCPWrapName\" type=\"s\" access=\"read\"/>\n" \ |
82c121a4 LP |
82 | " <property name=\"PAMName\" type=\"s\" access=\"read\"/>\n" \ |
83 | " <property name=\"ReadWriteDirectories\" type=\"as\" access=\"read\"/>\n" \ | |
84 | " <property name=\"ReadOnlyDirectories\" type=\"as\" access=\"read\"/>\n" \ | |
85 | " <property name=\"InaccessibleDirectories\" type=\"as\" access=\"read\"/>\n" \ | |
86 | " <property name=\"MountFlags\" type=\"t\" access=\"read\"/>\n" \ | |
87 | " <property name=\"PrivateTmp\" type=\"b\" access=\"read\"/>\n" \ | |
2e22afe9 | 88 | " <property name=\"SameProcessGroup\" type=\"b\" access=\"read\"/>\n" \ |
169c1bda LP |
89 | " <property name=\"KillMode\" type=\"s\" access=\"read\"/>\n" \ |
90 | " <property name=\"KillSignal\" type=\"i\" access=\"read\"/>\n" \ | |
91 | " <property name=\"UtmpIdentifier\" type=\"s\" access=\"read\"/>\n" | |
fe68089d LP |
92 | |
93 | #define BUS_EXEC_COMMAND_INTERFACE(name) \ | |
b708e7ce | 94 | " <property name=\"" name "\" type=\"a(sasbttuii)\" access=\"read\"/>\n" |
4139c1b2 LP |
95 | |
96 | #define BUS_EXEC_CONTEXT_PROPERTIES(interface, context) \ | |
97 | { interface, "Environment", bus_property_append_strv, "as", (context).environment }, \ | |
8c7be95e | 98 | { interface, "EnvironmentFiles", bus_execute_append_env_files, "a(sb)", (context).environment_files }, \ |
4139c1b2 | 99 | { interface, "UMask", bus_property_append_mode, "u", &(context).umask }, \ |
82c121a4 LP |
100 | { interface, "LimitCPU", bus_execute_append_rlimits, "t", &(context) }, \ |
101 | { interface, "LimitFSIZE", bus_execute_append_rlimits, "t", &(context) }, \ | |
102 | { interface, "LimitDATA", bus_execute_append_rlimits, "t", &(context) }, \ | |
103 | { interface, "LimitSTACK", bus_execute_append_rlimits, "t", &(context) }, \ | |
104 | { interface, "LimitCORE", bus_execute_append_rlimits, "t", &(context) }, \ | |
105 | { interface, "LimitRSS", bus_execute_append_rlimits, "t", &(context) }, \ | |
106 | { interface, "LimitNOFILE", bus_execute_append_rlimits, "t", &(context) }, \ | |
107 | { interface, "LimitAS", bus_execute_append_rlimits, "t", &(context) }, \ | |
108 | { interface, "LimitNPROC", bus_execute_append_rlimits, "t", &(context) }, \ | |
109 | { interface, "LimitMEMLOCK", bus_execute_append_rlimits, "t", &(context) }, \ | |
110 | { interface, "LimitLOCKS", bus_execute_append_rlimits, "t", &(context) }, \ | |
111 | { interface, "LimitSIGPENDING", bus_execute_append_rlimits, "t", &(context) }, \ | |
112 | { interface, "LimitMSGQUEUE", bus_execute_append_rlimits, "t", &(context) }, \ | |
113 | { interface, "LimitNICE", bus_execute_append_rlimits, "t", &(context) }, \ | |
114 | { interface, "LimitRTPRIO", bus_execute_append_rlimits, "t", &(context) }, \ | |
115 | { interface, "LimitRTTIME", bus_execute_append_rlimits, "t", &(context) }, \ | |
4139c1b2 LP |
116 | { interface, "WorkingDirectory", bus_property_append_string, "s", (context).working_directory }, \ |
117 | { interface, "RootDirectory", bus_property_append_string, "s", (context).root_directory }, \ | |
dd6c17b1 | 118 | { interface, "OOMScoreAdjust", bus_execute_append_oom_score_adjust, "i", &(context) }, \ |
82c121a4 LP |
119 | { interface, "Nice", bus_execute_append_nice, "i", &(context) }, \ |
120 | { interface, "IOScheduling", bus_execute_append_ioprio, "i", &(context) }, \ | |
121 | { interface, "CPUSchedulingPolicy", bus_execute_append_cpu_sched_policy, "i", &(context) }, \ | |
122 | { interface, "CPUSchedulingPriority", bus_execute_append_cpu_sched_priority, "i", &(context) }, \ | |
123 | { interface, "CPUAffinity", bus_execute_append_affinity,"ay", &(context) }, \ | |
74922904 | 124 | { interface, "TimerSlackNSec", bus_execute_append_timer_slack_nsec, "t", &(context) }, \ |
4139c1b2 LP |
125 | { interface, "CPUSchedulingResetOnFork", bus_property_append_bool, "b", &(context).cpu_sched_reset_on_fork }, \ |
126 | { interface, "NonBlocking", bus_property_append_bool, "b", &(context).non_blocking }, \ | |
127 | { interface, "StandardInput", bus_execute_append_input, "s", &(context).std_input }, \ | |
128 | { interface, "StandardOutput", bus_execute_append_output, "s", &(context).std_output }, \ | |
129 | { interface, "StandardError", bus_execute_append_output, "s", &(context).std_error }, \ | |
130 | { interface, "TTYPath", bus_property_append_string, "s", (context).tty_path }, \ | |
131 | { interface, "SyslogPriority", bus_property_append_int, "i", &(context).syslog_priority }, \ | |
132 | { interface, "SyslogIdentifier", bus_property_append_string, "s", (context).syslog_identifier }, \ | |
74922904 | 133 | { interface, "SyslogLevelPrefix", bus_property_append_bool, "b", &(context).syslog_level_prefix }, \ |
674cdd19 | 134 | { interface, "Capabilities", bus_execute_append_capabilities, "s",&(context) }, \ |
4139c1b2 | 135 | { interface, "SecureBits", bus_property_append_int, "i", &(context).secure_bits }, \ |
260abb78 | 136 | { interface, "CapabilityBoundingSet", bus_execute_append_capability_bs, "t", &(context).capability_bounding_set_drop }, \ |
4139c1b2 LP |
137 | { interface, "User", bus_property_append_string, "s", (context).user }, \ |
138 | { interface, "Group", bus_property_append_string, "s", (context).group }, \ | |
df1f0afe | 139 | { interface, "SupplementaryGroups", bus_property_append_strv, "as", (context).supplementary_groups }, \ |
5b6319dc | 140 | { interface, "TCPWrapName", bus_property_append_string, "s", (context).tcpwrap_name }, \ |
82c121a4 LP |
141 | { interface, "PAMName", bus_property_append_string, "s", (context).pam_name }, \ |
142 | { interface, "ReadWriteDirectories", bus_property_append_strv, "as", (context).read_write_dirs }, \ | |
143 | { interface, "ReadOnlyDirectories", bus_property_append_strv, "as", (context).read_only_dirs }, \ | |
144 | { interface, "InaccessibleDirectories", bus_property_append_strv, "as", (context).inaccessible_dirs }, \ | |
145 | { interface, "MountFlags", bus_property_append_ul, "t", &(context).mount_flags }, \ | |
146 | { interface, "PrivateTmp", bus_property_append_bool, "b", &(context).private_tmp }, \ | |
2e22afe9 LP |
147 | { interface, "SameProcessGroup", bus_property_append_bool, "b", &(context).same_pgrp }, \ |
148 | { interface, "KillMode", bus_execute_append_kill_mode, "s", &(context).kill_mode }, \ | |
169c1bda | 149 | { interface, "KillSignal", bus_property_append_int, "i", &(context).kill_signal }, \ |
57b63f36 | 150 | { interface, "UtmpIdentifier", bus_property_append_string, "s", (context).utmp_id } |
4139c1b2 | 151 | |
b58b4116 LP |
152 | #define BUS_EXEC_STATUS_PROPERTIES(interface, estatus, prefix) \ |
153 | { interface, prefix "StartTimestamp", bus_property_append_usec, "t", &(estatus).start_timestamp.realtime }, \ | |
b21a0ef8 | 154 | { interface, prefix "StartTimestampMonotonic",bus_property_append_usec, "t", &(estatus).start_timestamp.monotonic }, \ |
b58b4116 | 155 | { interface, prefix "ExitTimestamp", bus_property_append_usec, "t", &(estatus).start_timestamp.realtime }, \ |
b21a0ef8 | 156 | { interface, prefix "ExitTimestampMonotonic", bus_property_append_usec, "t", &(estatus).start_timestamp.monotonic }, \ |
b58b4116 LP |
157 | { interface, prefix "PID", bus_property_append_pid, "u", &(estatus).pid }, \ |
158 | { interface, prefix "Code", bus_property_append_int, "i", &(estatus).code }, \ | |
159 | { interface, prefix "Status", bus_property_append_int, "i", &(estatus).status } | |
160 | ||
74922904 | 161 | #define BUS_EXEC_COMMAND_PROPERTY(interface, command, name) \ |
b21a0ef8 | 162 | { interface, name, bus_execute_append_command, "a(sasbttttuii)", (command) } |
fe68089d | 163 | |
bfebab7f LP |
164 | int bus_execute_append_output(DBusMessageIter *i, const char *property, void *data); |
165 | int bus_execute_append_input(DBusMessageIter *i, const char *property, void *data); | |
166 | int bus_execute_append_oom_score_adjust(DBusMessageIter *i, const char *property, void *data); | |
167 | int bus_execute_append_nice(DBusMessageIter *i, const char *property, void *data); | |
168 | int bus_execute_append_ioprio(DBusMessageIter *i, const char *property, void *data); | |
169 | int bus_execute_append_cpu_sched_policy(DBusMessageIter *i, const char *property, void *data); | |
170 | int bus_execute_append_cpu_sched_priority(DBusMessageIter *i, const char *property, void *data); | |
171 | int bus_execute_append_affinity(DBusMessageIter *i, const char *property, void *data); | |
172 | int bus_execute_append_timer_slack_nsec(DBusMessageIter *i, const char *property, void *data); | |
173 | int bus_execute_append_capabilities(DBusMessageIter *i, const char *property, void *data); | |
174 | int bus_execute_append_capability_bs(DBusMessageIter *i, const char *property, void *data); | |
175 | int bus_execute_append_rlimits(DBusMessageIter *i, const char *property, void *data); | |
176 | int bus_execute_append_command(DBusMessageIter *u, const char *property, void *data); | |
177 | int bus_execute_append_kill_mode(DBusMessageIter *i, const char *property, void *data); | |
178 | int bus_execute_append_env_files(DBusMessageIter *i, const char *property, void *data); | |
4139c1b2 LP |
179 | |
180 | #endif |