Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Sep 2006 16:37:51 +0200
From:      Marcin Cieslak <saper@SYSTEM.PL>
To:        emulation@freebsd.org
Subject:   LTP: reboot02 patch
Message-ID:  <450817BF.8010402@SYSTEM.PL>
In-Reply-To: <20060913143521.9jf3a85qkocww4c4@webmail.leidinger.net>
References:  <4506ABF1.6010407@SYSTEM.PL> <20060913143521.9jf3a85qkocww4c4@webmail.leidinger.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Thanks! Can you also fix a link to your patch? I think one directory is missing....

Attached please also find a patch for linux_reboot(), fixes reboot02.

-- 
               << Marcin Cieslak // saper@system.pl >>


--- linux_misc.c	Wed Sep 13 16:16:56 2006
+++ linux_misc.c_new	Wed Sep 13 16:14:10 2006
@@ -1321,6 +1321,9 @@
  #define REBOOT_CAD_ON	0x89abcdef
  #define REBOOT_CAD_OFF	0
  #define REBOOT_HALT	0xcdef0123
+#define REBOOT_RESTART  0x01234567
+#define REBOOT_RESTART2 0xA1B2C3D4
+#define REBOOT_POWEROFF 0x4321FEDC

  int
  linux_reboot(struct thread *td, struct linux_reboot_args *args)
@@ -1331,10 +1334,24 @@
  	if (ldebug(reboot))
  		printf(ARGS(reboot, "0x%x"), args->cmd);
  #endif
-	if (args->cmd == REBOOT_CAD_ON || args->cmd == REBOOT_CAD_OFF)
-		return (0);
-	bsd_args.opt = (args->cmd == REBOOT_HALT) ? RB_HALT : 0;
-	return (reboot(td, &bsd_args));
+	switch(args->cmd) {
+	case REBOOT_CAD_ON:
+	case REBOOT_CAD_OFF:
+		return suser(td);
+	case REBOOT_HALT:
+		bsd_args.opt = RB_HALT;
+		break;
+	case REBOOT_RESTART:
+	case REBOOT_RESTART2:
+		bsd_args.opt = 0;
+		break;
+	case REBOOT_POWEROFF:
+		bsd_args.opt = RB_POWEROFF;
+		break;
+	default:
+		return EINVAL;
+	}
+	return reboot(td, &bsd_args);
  }

  #ifndef __alpha__



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?450817BF.8010402>