LTP: reboot02 patch

Marcin Cieslak saper at SYSTEM.PL
Wed Sep 13 07:37:59 PDT 2006


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 at 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__


More information about the freebsd-emulation mailing list