]>
Commit | Line | Data |
---|---|---|
4139c1b2 LP |
1 | /*-*- Mode: C; c-basic-offset: 8 -*-*/ |
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" \ | |
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" | |
35 | ||
4139c1b2 | 36 | #define BUS_EXEC_CONTEXT_INTERFACE \ |
4288f619 LP |
37 | " <property name=\"Environment\" type=\"as\" access=\"read\"/>\n" \ |
38 | " <property name=\"UMask\" type=\"u\" access=\"read\"/>\n" \ | |
82c121a4 LP |
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" \ | |
4288f619 LP |
55 | " <property name=\"WorkingDirectory\" type=\"s\" access=\"read\"/>\n" \ |
56 | " <property name=\"RootDirectory\" type=\"s\" access=\"read\"/>\n" \ | |
82c121a4 LP |
57 | " <property name=\"OOMAdjust\" 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" \ | |
4288f619 LP |
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" \ | |
74922904 | 72 | " <property name=\"SyslogLevelPrefix\" type=\"b\" access=\"read\"/>\n" \ |
82c121a4 | 73 | " <property name=\"Capabilities\" type=\"s\" access=\"read\"/>\n" \ |
4288f619 LP |
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" \ | |
df1f0afe | 78 | " <property name=\"SupplementaryGroups\" type=\"as\" access=\"read\"/>\n" \ |
5b6319dc | 79 | " <property name=\"TCPWrapName\" type=\"s\" access=\"read\"/>\n" \ |
82c121a4 LP |
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" \ | |
2e22afe9 LP |
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" | |
fe68089d LP |
89 | |
90 | #define BUS_EXEC_COMMAND_INTERFACE(name) \ | |
91 | " <property name=\"" name "\" type=\"a(sasttuii)\" access=\"read\"/>\n" | |
4139c1b2 LP |
92 | |
93 | #define BUS_EXEC_CONTEXT_PROPERTIES(interface, context) \ | |
94 | { interface, "Environment", bus_property_append_strv, "as", (context).environment }, \ | |
95 | { interface, "UMask", bus_property_append_mode, "u", &(context).umask }, \ | |
82c121a4 LP |
96 | { interface, "LimitCPU", bus_execute_append_rlimits, "t", &(context) }, \ |
97 | { interface, "LimitFSIZE", bus_execute_append_rlimits, "t", &(context) }, \ | |
98 | { interface, "LimitDATA", bus_execute_append_rlimits, "t", &(context) }, \ | |
99 | { interface, "LimitSTACK", bus_execute_append_rlimits, "t", &(context) }, \ | |
100 | { interface, "LimitCORE", bus_execute_append_rlimits, "t", &(context) }, \ | |
101 | { interface, "LimitRSS", bus_execute_append_rlimits, "t", &(context) }, \ | |
102 | { interface, "LimitNOFILE", bus_execute_append_rlimits, "t", &(context) }, \ | |
103 | { interface, "LimitAS", bus_execute_append_rlimits, "t", &(context) }, \ | |
104 | { interface, "LimitNPROC", bus_execute_append_rlimits, "t", &(context) }, \ | |
105 | { interface, "LimitMEMLOCK", bus_execute_append_rlimits, "t", &(context) }, \ | |
106 | { interface, "LimitLOCKS", bus_execute_append_rlimits, "t", &(context) }, \ | |
107 | { interface, "LimitSIGPENDING", bus_execute_append_rlimits, "t", &(context) }, \ | |
108 | { interface, "LimitMSGQUEUE", bus_execute_append_rlimits, "t", &(context) }, \ | |
109 | { interface, "LimitNICE", bus_execute_append_rlimits, "t", &(context) }, \ | |
110 | { interface, "LimitRTPRIO", bus_execute_append_rlimits, "t", &(context) }, \ | |
111 | { interface, "LimitRTTIME", bus_execute_append_rlimits, "t", &(context) }, \ | |
4139c1b2 LP |
112 | { interface, "WorkingDirectory", bus_property_append_string, "s", (context).working_directory }, \ |
113 | { interface, "RootDirectory", bus_property_append_string, "s", (context).root_directory }, \ | |
82c121a4 LP |
114 | { interface, "OOMAdjust", bus_execute_append_oom_adjust, "i", &(context) }, \ |
115 | { interface, "Nice", bus_execute_append_nice, "i", &(context) }, \ | |
116 | { interface, "IOScheduling", bus_execute_append_ioprio, "i", &(context) }, \ | |
117 | { interface, "CPUSchedulingPolicy", bus_execute_append_cpu_sched_policy, "i", &(context) }, \ | |
118 | { interface, "CPUSchedulingPriority", bus_execute_append_cpu_sched_priority, "i", &(context) }, \ | |
119 | { interface, "CPUAffinity", bus_execute_append_affinity,"ay", &(context) }, \ | |
74922904 | 120 | { interface, "TimerSlackNSec", bus_execute_append_timer_slack_nsec, "t", &(context) }, \ |
4139c1b2 LP |
121 | { interface, "CPUSchedulingResetOnFork", bus_property_append_bool, "b", &(context).cpu_sched_reset_on_fork }, \ |
122 | { interface, "NonBlocking", bus_property_append_bool, "b", &(context).non_blocking }, \ | |
123 | { interface, "StandardInput", bus_execute_append_input, "s", &(context).std_input }, \ | |
124 | { interface, "StandardOutput", bus_execute_append_output, "s", &(context).std_output }, \ | |
125 | { interface, "StandardError", bus_execute_append_output, "s", &(context).std_error }, \ | |
126 | { interface, "TTYPath", bus_property_append_string, "s", (context).tty_path }, \ | |
127 | { interface, "SyslogPriority", bus_property_append_int, "i", &(context).syslog_priority }, \ | |
128 | { interface, "SyslogIdentifier", bus_property_append_string, "s", (context).syslog_identifier }, \ | |
74922904 | 129 | { interface, "SyslogLevelPrefix", bus_property_append_bool, "b", &(context).syslog_level_prefix }, \ |
82c121a4 | 130 | { interface, "Capabilities", bus_property_append_string, "s", (context).capabilities }, \ |
4139c1b2 LP |
131 | { interface, "SecureBits", bus_property_append_int, "i", &(context).secure_bits }, \ |
132 | { interface, "CapabilityBoundingSetDrop", bus_property_append_uint64, "t", &(context).capability_bounding_set_drop }, \ | |
133 | { interface, "User", bus_property_append_string, "s", (context).user }, \ | |
134 | { interface, "Group", bus_property_append_string, "s", (context).group }, \ | |
df1f0afe | 135 | { interface, "SupplementaryGroups", bus_property_append_strv, "as", (context).supplementary_groups }, \ |
5b6319dc | 136 | { interface, "TCPWrapName", bus_property_append_string, "s", (context).tcpwrap_name }, \ |
82c121a4 LP |
137 | { interface, "PAMName", bus_property_append_string, "s", (context).pam_name }, \ |
138 | { interface, "ReadWriteDirectories", bus_property_append_strv, "as", (context).read_write_dirs }, \ | |
139 | { interface, "ReadOnlyDirectories", bus_property_append_strv, "as", (context).read_only_dirs }, \ | |
140 | { interface, "InaccessibleDirectories", bus_property_append_strv, "as", (context).inaccessible_dirs }, \ | |
141 | { interface, "MountFlags", bus_property_append_ul, "t", &(context).mount_flags }, \ | |
142 | { interface, "PrivateTmp", bus_property_append_bool, "b", &(context).private_tmp }, \ | |
2e22afe9 LP |
143 | { interface, "SameProcessGroup", bus_property_append_bool, "b", &(context).same_pgrp }, \ |
144 | { interface, "KillMode", bus_execute_append_kill_mode, "s", &(context).kill_mode }, \ | |
145 | { interface, "KillSignal", bus_property_append_int, "i", &(context).kill_signal } | |
4139c1b2 | 146 | |
b58b4116 LP |
147 | #define BUS_EXEC_STATUS_PROPERTIES(interface, estatus, prefix) \ |
148 | { interface, prefix "StartTimestamp", bus_property_append_usec, "t", &(estatus).start_timestamp.realtime }, \ | |
149 | { interface, prefix "ExitTimestamp", bus_property_append_usec, "t", &(estatus).start_timestamp.realtime }, \ | |
150 | { interface, prefix "PID", bus_property_append_pid, "u", &(estatus).pid }, \ | |
151 | { interface, prefix "Code", bus_property_append_int, "i", &(estatus).code }, \ | |
152 | { interface, prefix "Status", bus_property_append_int, "i", &(estatus).status } | |
153 | ||
74922904 | 154 | #define BUS_EXEC_COMMAND_PROPERTY(interface, command, name) \ |
fe68089d LP |
155 | { interface, name, bus_execute_append_command, "a(sasttuii)", (command) } |
156 | ||
4139c1b2 LP |
157 | int bus_execute_append_output(Manager *m, DBusMessageIter *i, const char *property, void *data); |
158 | int bus_execute_append_input(Manager *m, DBusMessageIter *i, const char *property, void *data); | |
82c121a4 LP |
159 | int bus_execute_append_oom_adjust(Manager *m, DBusMessageIter *i, const char *property, void *data); |
160 | int bus_execute_append_nice(Manager *m, DBusMessageIter *i, const char *property, void *data); | |
161 | int bus_execute_append_ioprio(Manager *m, DBusMessageIter *i, const char *property, void *data); | |
162 | int bus_execute_append_cpu_sched_policy(Manager *m, DBusMessageIter *i, const char *property, void *data); | |
163 | int bus_execute_append_cpu_sched_priority(Manager *m, DBusMessageIter *i, const char *property, void *data); | |
164 | int bus_execute_append_affinity(Manager *m, DBusMessageIter *i, const char *property, void *data); | |
03fae018 | 165 | int bus_execute_append_timer_slack_nsec(Manager *m, DBusMessageIter *i, const char *property, void *data); |
82c121a4 LP |
166 | int bus_execute_append_capabilities(Manager *m, DBusMessageIter *i, const char *property, void *data); |
167 | int bus_execute_append_rlimits(Manager *m, DBusMessageIter *i, const char *property, void *data); | |
fe68089d | 168 | int bus_execute_append_command(Manager *m, DBusMessageIter *u, const char *property, void *data); |
2e22afe9 | 169 | int bus_execute_append_kill_mode(Manager *m, DBusMessageIter *i, const char *property, void *data); |
4139c1b2 LP |
170 | |
171 | #endif |