/* SPDX-License-Identifier: LGPL-2.1+ */
-/***
- This file is part of systemd.
-
- Copyright 2010 Lennart Poettering
-***/
#include <errno.h>
#include <limits.h>
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
+//#include "rlimit-util.h"
#include "signal-util.h"
#include "socket-util.h"
#include "string-util.h"
/// Additional includes needed by elogind
#include "def.h"
#include "fileio.h"
-//#include "rlimit-util.h"
-//#include "rlimit-util.h"
-//#include "rlimit-util.h"
-//#include "rlimit-util.h"
-//#include "rlimit-util.h"
-//#include "rlimit-util.h"
-//#include "rlimit-util.h"
-//#include "rlimit-util.h"
-//#include "rlimit-util.h"
int config_item_table_lookup(
const void *table,
/* Only log on request, except for ENOENT,
* since we return 0 to the caller. */
if ((flags & CONFIG_PARSE_WARN) || errno == ENOENT)
- log_full(errno == ENOENT ? LOG_DEBUG : LOG_ERR,
- "Failed to open configuration file '%s': %m", filename);
+ log_full_errno(errno == ENOENT ? LOG_DEBUG : LOG_ERR, errno,
+ "Failed to open configuration file '%s': %m", filename);
return errno == ENOENT ? 0 : -errno;
}
}
DEFINE_PARSER(sec, usec_t, parse_sec);
DEFINE_PARSER(mode, mode_t, parse_mode);
+#if 0 /// UNNEEDED by elogind
int config_parse_iec_size(const char* unit,
const char *filename,
unsigned line,
return 0;
}
-#if 0 /// UNNEEDED by elogind
int config_parse_si_size(
const char* unit,
const char *filename,
return fatal ? -ENOEXEC : 0;
}
- *b = !!k;
+ *b = k;
return 0;
}
return 0;
}
+#if 0 /// UNNEEDED by elogind
int config_parse_path(
const char *unit,
const char *filename,
void *data,
void *userdata) {
- char **s = data, *n;
+ _cleanup_free_ char *n = NULL;
bool fatal = ltype;
+ char **s = data;
int r;
assert(filename);
assert(rvalue);
assert(data);
- if (isempty(rvalue)) {
- n = NULL;
+ if (isempty(rvalue))
goto finalize;
- }
n = strdup(rvalue);
if (!n)
return fatal ? -ENOEXEC : 0;
finalize:
- free_and_replace(*s, n);
-
- return 0;
+ return free_and_replace(*s, n);
}
+#endif // 0
int config_parse_strv(
const char *unit,
return 0;
}
+#if 0 /// UNNEEDED by elogind
int config_parse_warn_compat(
const char *unit,
const char *filename,
return 0;
}
-#if 0 /// UNNEEDED by elogind
int config_parse_log_facility(
const char *unit,
const char *filename,
return 0;
}
-#endif // 0
int config_parse_log_level(
const char *unit,
return 0;
}
-#if 0 /// UNNEEDED by elogind
int config_parse_personality(
const char *unit,
const char *filename,
return 0;
}
-#endif // 0
int config_parse_mtu(
const char *unit,
return 0;
}
+
+int config_parse_permille(const char* unit,
+ const char *filename,
+ unsigned line,
+ const char *section,
+ unsigned section_line,
+ const char *lvalue,
+ int ltype,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+
+ unsigned *permille = data;
+ int r;
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+ assert(permille);
+
+ r = parse_permille(rvalue);
+ if (r < 0) {
+ log_syntax(unit, LOG_ERR, filename, line, r,
+ "Failed to parse permille value, ignoring: %s", rvalue);
+ return 0;
+ }
+
+ *permille = (unsigned) r;
+
+ return 0;
+}
+#endif // 0