1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
3 #ifndef foodbusexecutehfoo
4 #define foodbusexecutehfoo
7 This file is part of systemd.
9 Copyright 2010 Lennart Poettering
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.
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.
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/>.
25 #include <dbus/dbus.h>
29 #define BUS_EXEC_STATUS_INTERFACE(prefix) \
30 " <property name=\"" prefix "StartTimestamp\" type=\"t\" access=\"read\"/>\n" \
31 " <property name=\"" prefix "ExitTimestamp\" type=\"t\" access=\"read\"/>\n" \
32 " <property name=\"" prefix "PID\" type=\"u\" access=\"read\"/>\n" \
33 " <property name=\"" prefix "Code\" type=\"i\" access=\"read\"/>\n" \
34 " <property name=\"" prefix "Status\" type=\"i\" access=\"read\"/>\n"
36 #define BUS_EXEC_CONTEXT_INTERFACE \
37 " <property name=\"Environment\" type=\"as\" access=\"read\"/>\n" \
38 " <property name=\"UMask\" type=\"u\" access=\"read\"/>\n" \
39 " <property name=\"LimitCPU\" type=\"t\" access=\"read\"/>\n" \
40 " <property name=\"LimitFSIZE\" type=\"t\" access=\"read\"/>\n" \
41 " <property name=\"LimitDATA\" type=\"t\" access=\"read\"/>\n" \
42 " <property name=\"LimitSTACK\" type=\"t\" access=\"read\"/>\n" \
43 " <property name=\"LimitCORE\" type=\"t\" access=\"read\"/>\n" \
44 " <property name=\"LimitRSS\" type=\"t\" access=\"read\"/>\n" \
45 " <property name=\"LimitNOFILE\" type=\"t\" access=\"read\"/>\n" \
46 " <property name=\"LimitAS\" type=\"t\" access=\"read\"/>\n" \
47 " <property name=\"LimitNPROC\" type=\"t\" access=\"read\"/>\n" \
48 " <property name=\"LimitMEMLOCK\" type=\"t\" access=\"read\"/>\n" \
49 " <property name=\"LimitLOCKS\" type=\"t\" access=\"read\"/>\n" \
50 " <property name=\"LimitSIGPENDING\" type=\"t\" access=\"read\"/>\n" \
51 " <property name=\"LimitMSGQUEUE\" type=\"t\" access=\"read\"/>\n" \
52 " <property name=\"LimitNICE\" type=\"t\" access=\"read\"/>\n" \
53 " <property name=\"LimitRTPRIO\" type=\"t\" access=\"read\"/>\n" \
54 " <property name=\"LimitRTTIME\" type=\"t\" access=\"read\"/>\n" \
55 " <property name=\"WorkingDirectory\" type=\"s\" access=\"read\"/>\n" \
56 " <property name=\"RootDirectory\" type=\"s\" access=\"read\"/>\n" \
57 " <property name=\"OOMScoreAdjust\" type=\"i\" access=\"read\"/>\n" \
58 " <property name=\"Nice\" type=\"i\" access=\"read\"/>\n" \
59 " <property name=\"IOScheduling\" type=\"i\" access=\"read\"/>\n" \
60 " <property name=\"CPUSchedulingPolicy\" type=\"i\" access=\"read\"/>\n" \
61 " <property name=\"CPUSchedulingPriority\" type=\"i\" access=\"read\"/>\n" \
62 " <property name=\"CPUAffinity\" type=\"ay\" access=\"read\"/>\n" \
63 " <property name=\"TimerSlackNS\" type=\"t\" access=\"read\"/>\n" \
64 " <property name=\"CPUSchedulingResetOnFork\" type=\"b\" access=\"read\"/>\n" \
65 " <property name=\"NonBlocking\" type=\"b\" access=\"read\"/>\n" \
66 " <property name=\"StandardInput\" type=\"s\" access=\"read\"/>\n" \
67 " <property name=\"StandardOutput\" type=\"s\" access=\"read\"/>\n" \
68 " <property name=\"StandardError\" type=\"s\" access=\"read\"/>\n" \
69 " <property name=\"TTYPath\" type=\"s\" access=\"read\"/>\n" \
70 " <property name=\"SyslogPriority\" type=\"i\" access=\"read\"/>\n" \
71 " <property name=\"SyslogIdentifier\" type=\"s\" access=\"read\"/>\n" \
72 " <property name=\"SyslogLevelPrefix\" type=\"b\" access=\"read\"/>\n" \
73 " <property name=\"Capabilities\" type=\"s\" access=\"read\"/>\n" \
74 " <property name=\"SecureBits\" type=\"i\" access=\"read\"/>\n" \
75 " <property name=\"CapabilityBoundingSetDrop\" type=\"t\" access=\"read\"/>\n" \
76 " <property name=\"User\" type=\"s\" access=\"read\"/>\n" \
77 " <property name=\"Group\" type=\"s\" access=\"read\"/>\n" \
78 " <property name=\"SupplementaryGroups\" type=\"as\" access=\"read\"/>\n" \
79 " <property name=\"TCPWrapName\" type=\"s\" access=\"read\"/>\n" \
80 " <property name=\"PAMName\" type=\"s\" access=\"read\"/>\n" \
81 " <property name=\"ReadWriteDirectories\" type=\"as\" access=\"read\"/>\n" \
82 " <property name=\"ReadOnlyDirectories\" type=\"as\" access=\"read\"/>\n" \
83 " <property name=\"InaccessibleDirectories\" type=\"as\" access=\"read\"/>\n" \
84 " <property name=\"MountFlags\" type=\"t\" access=\"read\"/>\n" \
85 " <property name=\"PrivateTmp\" type=\"b\" access=\"read\"/>\n" \
86 " <property name=\"SameProcessGroup\" type=\"b\" access=\"read\"/>\n" \
87 " <property name=\"KillMode\" type=\"s\" access=\"read\"/>\n" \
88 " <property name=\"KillSignal\" type=\"i\" access=\"read\"/>\n" \
89 " <property name=\"UtmpIdentifier\" type=\"s\" access=\"read\"/>\n"
91 #define BUS_EXEC_COMMAND_INTERFACE(name) \
92 " <property name=\"" name "\" type=\"a(sasbttuii)\" access=\"read\"/>\n"
94 #define BUS_EXEC_CONTEXT_PROPERTIES(interface, context) \
95 { interface, "Environment", bus_property_append_strv, "as", (context).environment }, \
96 { interface, "UMask", bus_property_append_mode, "u", &(context).umask }, \
97 { interface, "LimitCPU", bus_execute_append_rlimits, "t", &(context) }, \
98 { interface, "LimitFSIZE", bus_execute_append_rlimits, "t", &(context) }, \
99 { interface, "LimitDATA", bus_execute_append_rlimits, "t", &(context) }, \
100 { interface, "LimitSTACK", bus_execute_append_rlimits, "t", &(context) }, \
101 { interface, "LimitCORE", bus_execute_append_rlimits, "t", &(context) }, \
102 { interface, "LimitRSS", bus_execute_append_rlimits, "t", &(context) }, \
103 { interface, "LimitNOFILE", bus_execute_append_rlimits, "t", &(context) }, \
104 { interface, "LimitAS", bus_execute_append_rlimits, "t", &(context) }, \
105 { interface, "LimitNPROC", bus_execute_append_rlimits, "t", &(context) }, \
106 { interface, "LimitMEMLOCK", bus_execute_append_rlimits, "t", &(context) }, \
107 { interface, "LimitLOCKS", bus_execute_append_rlimits, "t", &(context) }, \
108 { interface, "LimitSIGPENDING", bus_execute_append_rlimits, "t", &(context) }, \
109 { interface, "LimitMSGQUEUE", bus_execute_append_rlimits, "t", &(context) }, \
110 { interface, "LimitNICE", bus_execute_append_rlimits, "t", &(context) }, \
111 { interface, "LimitRTPRIO", bus_execute_append_rlimits, "t", &(context) }, \
112 { interface, "LimitRTTIME", bus_execute_append_rlimits, "t", &(context) }, \
113 { interface, "WorkingDirectory", bus_property_append_string, "s", (context).working_directory }, \
114 { interface, "RootDirectory", bus_property_append_string, "s", (context).root_directory }, \
115 { interface, "OOMScoreAdjust", bus_execute_append_oom_score_adjust, "i", &(context) }, \
116 { interface, "Nice", bus_execute_append_nice, "i", &(context) }, \
117 { interface, "IOScheduling", bus_execute_append_ioprio, "i", &(context) }, \
118 { interface, "CPUSchedulingPolicy", bus_execute_append_cpu_sched_policy, "i", &(context) }, \
119 { interface, "CPUSchedulingPriority", bus_execute_append_cpu_sched_priority, "i", &(context) }, \
120 { interface, "CPUAffinity", bus_execute_append_affinity,"ay", &(context) }, \
121 { interface, "TimerSlackNSec", bus_execute_append_timer_slack_nsec, "t", &(context) }, \
122 { interface, "CPUSchedulingResetOnFork", bus_property_append_bool, "b", &(context).cpu_sched_reset_on_fork }, \
123 { interface, "NonBlocking", bus_property_append_bool, "b", &(context).non_blocking }, \
124 { interface, "StandardInput", bus_execute_append_input, "s", &(context).std_input }, \
125 { interface, "StandardOutput", bus_execute_append_output, "s", &(context).std_output }, \
126 { interface, "StandardError", bus_execute_append_output, "s", &(context).std_error }, \
127 { interface, "TTYPath", bus_property_append_string, "s", (context).tty_path }, \
128 { interface, "SyslogPriority", bus_property_append_int, "i", &(context).syslog_priority }, \
129 { interface, "SyslogIdentifier", bus_property_append_string, "s", (context).syslog_identifier }, \
130 { interface, "SyslogLevelPrefix", bus_property_append_bool, "b", &(context).syslog_level_prefix }, \
131 { interface, "Capabilities", bus_execute_append_capabilities, "s",&(context) }, \
132 { interface, "SecureBits", bus_property_append_int, "i", &(context).secure_bits }, \
133 { interface, "CapabilityBoundingSetDrop", bus_property_append_uint64, "t", &(context).capability_bounding_set_drop }, \
134 { interface, "User", bus_property_append_string, "s", (context).user }, \
135 { interface, "Group", bus_property_append_string, "s", (context).group }, \
136 { interface, "SupplementaryGroups", bus_property_append_strv, "as", (context).supplementary_groups }, \
137 { interface, "TCPWrapName", bus_property_append_string, "s", (context).tcpwrap_name }, \
138 { interface, "PAMName", bus_property_append_string, "s", (context).pam_name }, \
139 { interface, "ReadWriteDirectories", bus_property_append_strv, "as", (context).read_write_dirs }, \
140 { interface, "ReadOnlyDirectories", bus_property_append_strv, "as", (context).read_only_dirs }, \
141 { interface, "InaccessibleDirectories", bus_property_append_strv, "as", (context).inaccessible_dirs }, \
142 { interface, "MountFlags", bus_property_append_ul, "t", &(context).mount_flags }, \
143 { interface, "PrivateTmp", bus_property_append_bool, "b", &(context).private_tmp }, \
144 { interface, "SameProcessGroup", bus_property_append_bool, "b", &(context).same_pgrp }, \
145 { interface, "KillMode", bus_execute_append_kill_mode, "s", &(context).kill_mode }, \
146 { interface, "KillSignal", bus_property_append_int, "i", &(context).kill_signal }, \
147 { interface, "UtmpIdentifier", bus_property_append_string, "s", (context).utmp_id }
149 #define BUS_EXEC_STATUS_PROPERTIES(interface, estatus, prefix) \
150 { interface, prefix "StartTimestamp", bus_property_append_usec, "t", &(estatus).start_timestamp.realtime }, \
151 { interface, prefix "ExitTimestamp", bus_property_append_usec, "t", &(estatus).start_timestamp.realtime }, \
152 { interface, prefix "PID", bus_property_append_pid, "u", &(estatus).pid }, \
153 { interface, prefix "Code", bus_property_append_int, "i", &(estatus).code }, \
154 { interface, prefix "Status", bus_property_append_int, "i", &(estatus).status }
156 #define BUS_EXEC_COMMAND_PROPERTY(interface, command, name) \
157 { interface, name, bus_execute_append_command, "a(sasbttuii)", (command) }
159 int bus_execute_append_output(Manager *m, DBusMessageIter *i, const char *property, void *data);
160 int bus_execute_append_input(Manager *m, DBusMessageIter *i, const char *property, void *data);
161 int bus_execute_append_oom_score_adjust(Manager *m, DBusMessageIter *i, const char *property, void *data);
162 int bus_execute_append_nice(Manager *m, DBusMessageIter *i, const char *property, void *data);
163 int bus_execute_append_ioprio(Manager *m, DBusMessageIter *i, const char *property, void *data);
164 int bus_execute_append_cpu_sched_policy(Manager *m, DBusMessageIter *i, const char *property, void *data);
165 int bus_execute_append_cpu_sched_priority(Manager *m, DBusMessageIter *i, const char *property, void *data);
166 int bus_execute_append_affinity(Manager *m, DBusMessageIter *i, const char *property, void *data);
167 int bus_execute_append_timer_slack_nsec(Manager *m, DBusMessageIter *i, const char *property, void *data);
168 int bus_execute_append_capabilities(Manager *m, DBusMessageIter *i, const char *property, void *data);
169 int bus_execute_append_rlimits(Manager *m, DBusMessageIter *i, const char *property, void *data);
170 int bus_execute_append_command(Manager *m, DBusMessageIter *u, const char *property, void *data);
171 int bus_execute_append_kill_mode(Manager *m, DBusMessageIter *i, const char *property, void *data);