diff options
author | Leonard Kugis <leonard@kug.is> | 2025-05-23 11:41:09 +0000 |
---|---|---|
committer | Leonard Kugis <leonard@kug.is> | 2025-05-23 11:41:09 +0000 |
commit | c70505d7c7b7b48600f273357694b56ccf5d2a15 (patch) | |
tree | 21c27ac6ffced8d6d904e35bdb39baa5d685d829 /dwl-patches/patches/coredump | |
download | dotfiles-master.tar.gz dotfiles-master.tar.bz2 dotfiles-master.zip |
Diffstat (limited to 'dwl-patches/patches/coredump')
-rw-r--r-- | dwl-patches/patches/coredump/README.md | 11 | ||||
-rw-r--r-- | dwl-patches/patches/coredump/coredump-0.7.patch | 65 | ||||
-rw-r--r-- | dwl-patches/patches/coredump/coredump.patch | 65 |
3 files changed, 141 insertions, 0 deletions
diff --git a/dwl-patches/patches/coredump/README.md b/dwl-patches/patches/coredump/README.md new file mode 100644 index 0000000..5300890 --- /dev/null +++ b/dwl-patches/patches/coredump/README.md @@ -0,0 +1,11 @@ +### Description +Generate a coredump if dwl exited abnormally (to be more usefull you need to +compile dwl and wlroots with debug symbols) + +### Download +- [git branch](https://codeberg.org/sevz/dwl/src/branch/coredump) +- [main 2025-01-20](/dwl/dwl-patches/raw/branch/main/patches/coredump/coredump.patch) +- [coredump-0.7.patch](/dwl/dwl-patches/raw/branch/main/patches/coredump/coredump-0.7.patch) + +### Authors +- [sevz](https://codeberg.org/sevz) diff --git a/dwl-patches/patches/coredump/coredump-0.7.patch b/dwl-patches/patches/coredump/coredump-0.7.patch new file mode 100644 index 0000000..f39e7af --- /dev/null +++ b/dwl-patches/patches/coredump/coredump-0.7.patch @@ -0,0 +1,65 @@ +From 2abde87f9159ec3318a0489ac0ed512f166ef8c8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= + <leohdz172@proton.me> +Date: Wed, 5 Oct 2022 23:07:13 -0500 +Subject: [PATCH] increase RLIMIT_CORE (generate a coredump) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me> +--- + dwl.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/dwl.c b/dwl.c +index a2711f67..cfbb0bb8 100644 +--- a/dwl.c ++++ b/dwl.c +@@ -8,6 +8,7 @@ + #include <signal.h> + #include <stdio.h> + #include <stdlib.h> ++#include <sys/resource.h> + #include <sys/wait.h> + #include <time.h> + #include <unistd.h> +@@ -358,6 +359,8 @@ static void zoom(const Arg *arg); + + /* variables */ + static const char broken[] = "broken"; ++static struct rlimit oldrlimit; ++static struct rlimit newrlimit; + static pid_t child_pid = -1; + static int locked; + static void *exclusive_focus; +@@ -2232,6 +2235,7 @@ run(char *startup_cmd) + if ((child_pid = fork()) < 0) + die("startup: fork:"); + if (child_pid == 0) { ++ setrlimit(RLIMIT_CORE, &oldrlimit); + setsid(); + dup2(piperw[0], STDIN_FILENO); + close(piperw[0]); +@@ -2649,6 +2653,7 @@ void + spawn(const Arg *arg) + { + if (fork() == 0) { ++ setrlimit(RLIMIT_CORE, &oldrlimit); + dup2(STDERR_FILENO, STDOUT_FILENO); + setsid(); + execvp(((char **)arg->v)[0], (char **)arg->v); +@@ -3189,6 +3194,10 @@ main(int argc, char *argv[]) + char *startup_cmd = NULL; + int c; + ++ getrlimit(RLIMIT_CORE, &oldrlimit); ++ newrlimit.rlim_cur = newrlimit.rlim_max = oldrlimit.rlim_max; ++ setrlimit(RLIMIT_CORE, &newrlimit); ++ + while ((c = getopt(argc, argv, "s:hdv")) != -1) { + if (c == 's') + startup_cmd = optarg; +-- +2.46.0 + diff --git a/dwl-patches/patches/coredump/coredump.patch b/dwl-patches/patches/coredump/coredump.patch new file mode 100644 index 0000000..98ffbd8 --- /dev/null +++ b/dwl-patches/patches/coredump/coredump.patch @@ -0,0 +1,65 @@ +From 6d5017888891957615160fe7c015adf7a6f0fd45 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= + <leohdz172@proton.me> +Date: Wed, 5 Oct 2022 23:07:13 -0500 +Subject: [PATCH] increase RLIMIT_CORE (generate a coredump) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me> +--- + dwl.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/dwl.c b/dwl.c +index ad21e1ba..940fbeff 100644 +--- a/dwl.c ++++ b/dwl.c +@@ -8,6 +8,7 @@ + #include <signal.h> + #include <stdio.h> + #include <stdlib.h> ++#include <sys/resource.h> + #include <sys/wait.h> + #include <time.h> + #include <unistd.h> +@@ -353,6 +354,8 @@ static void xytonode(double x, double y, struct wlr_surface **psurface, + static void zoom(const Arg *arg); + + /* variables */ ++static struct rlimit oldrlimit; ++static struct rlimit newrlimit; + static pid_t child_pid = -1; + static int locked; + static void *exclusive_focus; +@@ -2248,6 +2251,7 @@ run(char *startup_cmd) + if ((child_pid = fork()) < 0) + die("startup: fork:"); + if (child_pid == 0) { ++ setrlimit(RLIMIT_CORE, &oldrlimit); + setsid(); + dup2(piperw[0], STDIN_FILENO); + close(piperw[0]); +@@ -2659,6 +2663,7 @@ void + spawn(const Arg *arg) + { + if (fork() == 0) { ++ setrlimit(RLIMIT_CORE, &oldrlimit); + dup2(STDERR_FILENO, STDOUT_FILENO); + setsid(); + execvp(((char **)arg->v)[0], (char **)arg->v); +@@ -3178,6 +3183,10 @@ main(int argc, char *argv[]) + char *startup_cmd = NULL; + int c; + ++ getrlimit(RLIMIT_CORE, &oldrlimit); ++ newrlimit.rlim_cur = newrlimit.rlim_max = oldrlimit.rlim_max; ++ setrlimit(RLIMIT_CORE, &newrlimit); ++ + while ((c = getopt(argc, argv, "s:hdv")) != -1) { + if (c == 's') + startup_cmd = optarg; +-- +2.48.0 + |