# ratelimit.h
# raw-clone.h
# raw-reboot.h
+# reboot-util.c
+# reboot-util.h
# refcnt.h
# replace-var.c
# replace-var.h
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1+ */
+
+//#include <errno.h>
+//#include <unistd.h>
+
+//#include "fileio.h"
+//#include "log.h"
+//#include "reboot-util.h"
+//#include "string-util.h"
+//#include "umask-util.h"
+
+int update_reboot_parameter_and_warn(const char *parameter) {
+ int r;
+
+ if (isempty(parameter)) {
+ if (unlink("/run/systemd/reboot-param") < 0) {
+ if (errno == ENOENT)
+ return 0;
+
+ return log_warning_errno(errno, "Failed to unlink reboot parameter file: %m");
+ }
+
+ return 0;
+ }
+
+ RUN_WITH_UMASK(0022) {
+ r = write_string_file("/run/systemd/reboot-param", parameter,
+ WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_ATOMIC);
+ if (r < 0)
+ return log_warning_errno(r, "Failed to write reboot parameter file: %m");
+ }
+
+ return 0;
+}
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1+ */
+#pragma once
+
+int update_reboot_parameter_and_warn(const char *parameter);
}
#if 0 /// UNNEEDED by elogind
-int update_reboot_parameter_and_warn(const char *param) {
- int r;
-
- if (isempty(param)) {
- if (unlink("/run/systemd/reboot-param") < 0) {
- if (errno == ENOENT)
- return 0;
-
- return log_warning_errno(errno, "Failed to unlink reboot parameter file: %m");
- }
-
- return 0;
- }
-
- RUN_WITH_UMASK(0022) {
- r = write_string_file("/run/systemd/reboot-param", param, WRITE_STRING_FILE_CREATE);
- if (r < 0)
- return log_warning_errno(r, "Failed to write reboot parameter file: %m");
- }
-
- return 0;
-}
#endif // 0
-
int version(void) {
puts(PACKAGE_STRING "\n"
SYSTEMD_FEATURES);
uint64_t system_tasks_max_scale(uint64_t v, uint64_t max);
#if 0 /// UNNEEDED by elogind
-int update_reboot_parameter_and_warn(const char *param);
#endif // 0
-
int version(void);
#if 0 /// UNNEEDED by elogind