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);
return m / max;
}
-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;
-}
-
int version(void) {
puts(PACKAGE_STRING "\n"
SYSTEMD_FEATURES);
uint64_t system_tasks_max(void);
uint64_t system_tasks_max_scale(uint64_t v, uint64_t max);
-int update_reboot_parameter_and_warn(const char *param);
-
int version(void);
int str_verscmp(const char *s1, const char *s2);
#include "bus-util.h"
#include "emergency-action.h"
#include "raw-reboot.h"
+#include "reboot-util.h"
#include "special.h"
#include "string-table.h"
#include "terminal-util.h"
#include "path-util.h"
#include "process-util.h"
#include "raw-reboot.h"
+#include "reboot-util.h"
#include "rlimit-util.h"
#include "set.h"
#include "sigbus.h"