commit:     ad3258a9108bc1113750cfe2bbb6bb322c49cd22
Author:     Z. Liu <zhixu.liu <AT> gmail <DOT> com>
AuthorDate: Sat May 10 11:13:15 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat May 10 17:59:22 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ad3258a9

sys-devel/dev86: fix reboot() for x86

Closes: https://bugs.gentoo.org/955712
Signed-off-by: Z. Liu <zhixu.liu <AT> gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/42015
Closes: https://github.com/gentoo/gentoo/pull/42015
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-devel/dev86/dev86-1.0.1.ebuild             |  1 +
 sys-devel/dev86/files/dev86-1.0.1-reboot.patch | 29 ++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/sys-devel/dev86/dev86-1.0.1.ebuild 
b/sys-devel/dev86/dev86-1.0.1.ebuild
index 7c050452a177..9f86dad543d5 100644
--- a/sys-devel/dev86/dev86-1.0.1.ebuild
+++ b/sys-devel/dev86/dev86-1.0.1.ebuild
@@ -19,6 +19,7 @@ DEPEND="${RDEPEND}"
 
 PATCHES=(
        "${FILESDIR}/${P}-makefile.patch"
+       "${FILESDIR}/${P}-reboot.patch"
 )
 
 src_prepare() {

diff --git a/sys-devel/dev86/files/dev86-1.0.1-reboot.patch 
b/sys-devel/dev86/files/dev86-1.0.1-reboot.patch
new file mode 100644
index 000000000000..000ff82cc856
--- /dev/null
+++ b/sys-devel/dev86/files/dev86-1.0.1-reboot.patch
@@ -0,0 +1,29 @@
+use modern reboot
+diff --git a/elksemu/elks_sys.c b/elksemu/elks_sys.c
+index 5699edc..45c97f7 100644
+--- a/elksemu/elks_sys.c
++++ b/elksemu/elks_sys.c
+@@ -17,6 +17,8 @@
+ #include <signal.h>
+ #include <errno.h>
+ #include <sys/types.h>
++#include <linux/reboot.h>
++#include <sys/reboot.h>
+ #include <sys/resource.h>
+ #include <sys/wait.h>
+ #include <sys/ioctl.h>
+@@ -656,11 +658,11 @@ static int elks_reboot(int bx,int cx,int dx,int di,int 
si)
+    switch(dx)
+    {
+    /* graceful shutdown, C-A-D off, kill -? 1 */
+-   case 0:     return reboot(0xfee1dead, 672274793, 0);
++   case 0:     return reboot(LINUX_REBOOT_CMD_CAD_OFF);
+    /* Enable C-A-D */
+-   case 0xCAD: return reboot(0xfee1dead, 672274793, 0x89abcdef);
++   case 0xCAD: return reboot(LINUX_REBOOT_CMD_CAD_ON);
+    /* Time to die! */
+-   case 0xD1E: return reboot(0xfee1dead, 672274793, 0x1234567);
++   case 0xD1E: return reboot(LINUX_REBOOT_CMD_RESTART);
+    }
+    return -1;
+ }

Reply via email to