summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-10-14 19:39:28 +0200
committerLennart Poettering <lennart@poettering.net>2015-10-14 19:39:28 +0200
commit64f283c39b1b8311f4dd99466ecc8df7e4407950 (patch)
tree33528fafccaf94de0ec165007446ec662623973f /src/basic
parent6777e2ad7282bb52076b92e130cba17cebb81b02 (diff)
parente0d6e0fa55054b7eacf58c511abff710fef5712f (diff)
Merge pull request #1528 from evverx/systemd-run-syslog-pri-fac
systemd-run can launch units with SyslogLevel and SyslogFacility
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/util.c8
-rw-r--r--src/basic/util.h2
2 files changed, 10 insertions, 0 deletions
diff --git a/src/basic/util.c b/src/basic/util.c
index ca5e4befa0..8b896a2df3 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -3699,6 +3699,10 @@ static const char *const log_facility_unshifted_table[LOG_NFACILITIES] = {
DEFINE_STRING_TABLE_LOOKUP_WITH_FALLBACK(log_facility_unshifted, int, LOG_FAC(~0));
+bool log_facility_unshifted_is_valid(int facility) {
+ return facility >= 0 && facility <= LOG_FAC(~0);
+}
+
static const char *const log_level_table[] = {
[LOG_EMERG] = "emerg",
[LOG_ALERT] = "alert",
@@ -3712,6 +3716,10 @@ static const char *const log_level_table[] = {
DEFINE_STRING_TABLE_LOOKUP_WITH_FALLBACK(log_level, int, LOG_DEBUG);
+bool log_level_is_valid(int level) {
+ return level >= 0 && level <= LOG_DEBUG;
+}
+
static const char* const sched_policy_table[] = {
[SCHED_OTHER] = "other",
[SCHED_BATCH] = "batch",
diff --git a/src/basic/util.h b/src/basic/util.h
index 79c7ad1b39..2544ad0830 100644
--- a/src/basic/util.h
+++ b/src/basic/util.h
@@ -456,9 +456,11 @@ int sigchld_code_from_string(const char *s) _pure_;
int log_facility_unshifted_to_string_alloc(int i, char **s);
int log_facility_unshifted_from_string(const char *s);
+bool log_facility_unshifted_is_valid(int faciliy);
int log_level_to_string_alloc(int i, char **s);
int log_level_from_string(const char *s);
+bool log_level_is_valid(int level);
int sched_policy_to_string_alloc(int i, char **s);
int sched_policy_from_string(const char *s);