1 /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 #pragma once 3 4 #include "sd-bus.h" 5 6 #include "bus-unit-util.h" 7 #include "format-table.h" 8 #include "systemctl.h" 9 10 typedef enum BusFocus { 11 BUS_FULL, /* The full bus indicated via --system or --user */ 12 BUS_MANAGER, /* The manager itself, possibly directly, possibly via the bus */ 13 _BUS_FOCUS_MAX 14 } BusFocus; 15 16 int acquire_bus(BusFocus focus, sd_bus **ret); 17 void release_busses(void); 18 19 void ask_password_agent_open_maybe(void); 20 void polkit_agent_open_maybe(void); 21 22 int translate_bus_error_to_exit_status(int r, const sd_bus_error *error); 23 24 int get_state_one_unit(sd_bus *bus, const char *name, UnitActiveState *ret_active_state); 25 int get_unit_list(sd_bus *bus, const char *machine, char **patterns, UnitInfo **unit_infos, int c, sd_bus_message **ret_reply); 26 int expand_unit_names(sd_bus *bus, char **names, const char* suffix, char ***ret, bool *ret_expanded); 27 28 int check_triggering_units(sd_bus *bus, const char *unit); 29 30 int need_daemon_reload(sd_bus *bus, const char *unit); 31 32 void warn_unit_file_changed(const char *unit); 33 34 int append_unit_dependencies(sd_bus *bus, char **names, char ***ret); 35 int maybe_extend_with_unit_dependencies(sd_bus *bus, char ***list); 36 37 int unit_file_find_path(LookupPaths *lp, const char *unit_name, char **ret_unit_path); 38 int unit_find_paths(sd_bus *bus, const char *unit_name, LookupPaths *lp, bool force_client_side, Hashmap **cached_id_map, Hashmap **cached_name_map, char **ret_fragment_path, char ***ret_dropin_paths); 39 40 int unit_is_masked(sd_bus *bus, LookupPaths *lp, const char *name); 41 int unit_exists(LookupPaths *lp, const char *unit); 42 43 int unit_get_dependencies(sd_bus *bus, const char *name, char ***ret); 44 45 const char* unit_type_suffix(const char *unit); 46 bool output_show_unit(const UnitInfo *u, char **patterns); 47 48 bool install_client_side(void); 49 50 int output_table(Table *table); 51 52 bool show_preset_for_state(UnitFileState state); 53 54 int mangle_names(const char *operation, char **original_names, char ***ret_mangled_names); 55 56 UnitFileFlags unit_file_flags_from_args(void); 57 58 int halt_now(enum action a); 59