Merge pull request #18580 from keszybz/signal-list

Add systemctl --signal=list
This commit is contained in:
Lennart Poettering
2021-02-15 14:37:03 +01:00
committed by GitHub
33 changed files with 272 additions and 170 deletions
-32
View File
@@ -752,38 +752,6 @@ int fsck_exists(const char *fstype) {
return executable_is_good(checker);
}
int parse_path_argument_and_warn(const char *path, bool suppress_root, char **arg) {
char *p;
int r;
/*
* This function is intended to be used in command line
* parsers, to handle paths that are passed in. It makes the
* path absolute, and reduces it to NULL if omitted or
* root (the latter optionally).
*
* NOTE THAT THIS WILL FREE THE PREVIOUS ARGUMENT POINTER ON
* SUCCESS! Hence, do not pass in uninitialized pointers.
*/
if (isempty(path)) {
*arg = mfree(*arg);
return 0;
}
r = path_make_absolute_cwd(path, &p);
if (r < 0)
return log_error_errno(r, "Failed to parse path \"%s\" and make it absolute: %m", path);
path_simplify(p, false);
if (suppress_root && empty_or_root(p))
p = mfree(p);
free_and_replace(*arg, p);
return 0;
}
char* dirname_malloc(const char *path) {
char *d, *dir, *dir2;
-2
View File
@@ -144,8 +144,6 @@ int fsck_exists(const char *fstype);
_ret; \
})
int parse_path_argument_and_warn(const char *path, bool suppress_root, char **arg);
char* dirname_malloc(const char *path);
const char *last_path_component(const char *path);
int path_extract_filename(const char *p, char **ret);
+1 -1
View File
@@ -198,7 +198,7 @@ static const char *const __signal_table[] = {
DEFINE_PRIVATE_STRING_TABLE_LOOKUP(__signal, int);
const char *signal_to_string(int signo) {
static thread_local char buf[STRLEN("RTMIN+") + DECIMAL_STR_MAX(int) + 1];
static thread_local char buf[STRLEN("RTMIN+") + DECIMAL_STR_MAX(int)];
const char *name;
name = __signal_to_string(signo);
+1 -2
View File
@@ -103,9 +103,8 @@ ssize_t string_table_lookup(const char * const *table, size_t len, const char *k
#define DUMP_STRING_TABLE(name,type,max) \
do { \
type _k; \
flockfile(stdout); \
for (_k = 0; _k < (max); _k++) { \
for (type _k = 0; _k < (max); _k++) { \
const char *_t; \
_t = name##_to_string(_k); \
if (!_t) \