diff options
author | Gerrit Pape <pape@smarden.org> | 2014-07-28 07:01:55 +0000 |
---|---|---|
committer | Gerrit Pape <pape@smarden.org> | 2014-07-28 11:02:27 +0000 |
commit | 8dd6a3c62590ac90467d73fe3c556c7df59a57cb (patch) | |
tree | cacbd131f304f5e3b689e9b60b164f9cbdf5bbb3 | |
parent | f7ddf496ab2ed89817cb47f4b6e3a42cee79bcbc (diff) | |
download | runit-8dd6a3c62590ac90467d73fe3c556c7df59a57cb.tar.gz runit-8dd6a3c62590ac90467d73fe3c556c7df59a57cb.tar.xz runit-8dd6a3c62590ac90467d73fe3c556c7df59a57cb.zip |
* debian/diff/0003-support-etc-runit-nosync-file-to-make-sync...diff:
new; support /etc/runit/nosync file to make sync on shutdown/reboot optional (thx Andras Korn, closes: #695281).
-rw-r--r-- | debian/changelog | 3 | ||||
-rw-r--r-- | debian/diff/0003-support-etc-runit-nosync-file-to-make-sync-on-shutdow.diff | 106 |
2 files changed, 109 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog index fe5deaa..1090093 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,9 @@ runit (2.1.1-7) UNRELEASED; urgency=medium * debian/examples/start-stop-daemon.runit, debian/runit.examples: new; include start-stop-daemon.runit script by Andras Korn in /usr/share/doc/runit/examples/ (closes: #678985). + * debian/diff/0003-support-etc-runit-nosync-file-to-make-sync...diff: + new; support /etc/runit/nosync file to make sync on shutdown/reboot + optional (thx Andras Korn, closes: #695281). -- Gerrit Pape <pape@smarden.org> Mon, 28 Jul 2014 06:03:19 +0000 diff --git a/debian/diff/0003-support-etc-runit-nosync-file-to-make-sync-on-shutdow.diff b/debian/diff/0003-support-etc-runit-nosync-file-to-make-sync-on-shutdow.diff new file mode 100644 index 0000000..0891c2a --- /dev/null +++ b/debian/diff/0003-support-etc-runit-nosync-file-to-make-sync-on-shutdow.diff @@ -0,0 +1,106 @@ +From f5d02961e163deba8aa42ebce59921995770a138 Mon Sep 17 00:00:00 2001 +From: Andras Korn <korn-debbugs@elan.rulez.org> +Date: Thu, 6 Dec 2012 16:57:06 +0100 +Subject: [PATCH] support /etc/runit/nosync file to make sync on + shutdown/reboot optional + +https://bugs.debian.org/695281 +--- + runit-2.1.1/doc/runit.8.html | 2 ++ + runit-2.1.1/man/runit.8 | 5 +++++ + runit-2.1.1/src/runit.c | 15 ++++++++++----- + runit-2.1.1/src/runit.h | 1 + + 4 files changed, 18 insertions(+), 5 deletions(-) + +diff --git a/runit-2.1.1/doc/runit.8.html b/runit-2.1.1/doc/runit.8.html +index 6c46b39..3cc8287 100644 +--- a/runit-2.1.1/doc/runit.8.html ++++ b/runit-2.1.1/doc/runit.8.html +@@ -34,6 +34,8 @@ stage 2 if it is running, and runs <i>/etc/runit/3</i>. The systems tasks to shu + and possibly halt or reboot the system are done here. If stage 3 returns, + <b>runit</b> checks if the file <i>/etc/runit/reboot</i> exists and has the execute by + owner permission set. If so, the system is rebooted, it’s halted otherwise. ++If <i>/etc/runit/nosync</i> exists, <b>runit</b> doesn’t invoke ++sync(). This is useful in vservers. + + <h2><a name='sect6'>Ctrl-alt-del</a></h2> + If <b>runit</b> receives the ctrl-alt-del keyboard request and the file +diff --git a/runit-2.1.1/man/runit.8 b/runit-2.1.1/man/runit.8 +index a53cf6e..faf789b 100644 +--- a/runit-2.1.1/man/runit.8 ++++ b/runit-2.1.1/man/runit.8 +@@ -48,6 +48,11 @@ checks if the file + .I /etc/runit/reboot + exists and has the execute by owner permission set. + If so, the system is rebooted, it's halted otherwise. ++If ++.I /etc/runit/nosync ++exists, ++.B runit ++doesn't invoke sync(). This is useful in vservers. + .SH CTRL-ALT-DEL + If + .B runit +diff --git a/runit-2.1.1/src/runit.c b/runit-2.1.1/src/runit.c +index 48620b3..2bb4794 100644 +--- a/runit-2.1.1/src/runit.c ++++ b/runit-2.1.1/src/runit.c +@@ -41,6 +41,11 @@ void sig_int_handler (void) { + } + void sig_child_handler (void) { write(selfpipe[1], "", 1); } + ++void sync_if_needed() { ++ struct stat s; ++ if (stat(NOSYNC, &s) == -1) sync(); ++} ++ + int main (int argc, const char * const *argv, char * const *envp) { + const char * prog[2]; + int pid, pid2; +@@ -305,28 +310,28 @@ int main (int argc, const char * const *argv, char * const *envp) { + case -1: + if ((stat(REBOOT, &s) != -1) && (s.st_mode & S_IXUSR)) { + strerr_warn2(INFO, "system reboot.", 0); +- sync(); ++ sync_if_needed(); + reboot_system(RB_AUTOBOOT); + } + else { + #ifdef RB_POWER_OFF + strerr_warn2(INFO, "power off...", 0); +- sync(); ++ sync_if_needed(); + reboot_system(RB_POWER_OFF); + sleep(2); + #endif + #ifdef RB_HALT_SYSTEM + strerr_warn2(INFO, "system halt.", 0); +- sync(); ++ sync_if_needed(); + reboot_system(RB_HALT_SYSTEM); + #else + #ifdef RB_HALT + strerr_warn2(INFO, "system halt.", 0); +- sync(); ++ sync_if_needed(); + reboot_system(RB_HALT); + #else + strerr_warn2(INFO, "system reboot.", 0); +- sync(); ++ sync_if_needed(); + reboot_system(RB_AUTOBOOT); + #endif + #endif +diff --git a/runit-2.1.1/src/runit.h b/runit-2.1.1/src/runit.h +index ba98386..bccaf2d 100644 +--- a/runit-2.1.1/src/runit.h ++++ b/runit-2.1.1/src/runit.h +@@ -1,4 +1,5 @@ + #define RUNIT "/sbin/runit" + #define STOPIT "/etc/runit/stopit" + #define REBOOT "/etc/runit/reboot" ++#define NOSYNC "/erc/runit/nosync" + #define CTRLALTDEL "/etc/runit/ctrlaltdel" +-- +2.0.1 + |