9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Russ Cox" <rsc@plan9.bell-labs.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Apm Enhancement + some bonuses
Date: Sat, 22 Feb 2003 16:51:16 -0500	[thread overview]
Message-ID: <0610ae68d7966ee68ba2033283925411@plan9.bell-labs.com> (raw)
In-Reply-To: <000001c2daaf$c28d7e60$f7e84dd5@makr4j0ty5i9an>

^t^t is an ugly hack -- it doesn't need more letters.
there are ways to provide everything you added
without going into the kernel.

because ^p currently does nothing on terminals,
we can sit at terminals, connect to the consoles of
cpu servers, and reboot them by typing ^p.
changing ^p to have a magic meaning on terminals
will break that behavior, hence it won't happen.
i'm still sorry that ^p kills drawterm.

as you noted, you can get aux/apm to let you turn
things off by uncommenting

/*
	else if(strcmp(p, "off")==0)
		respondx(r, apmsetpowerstate(&apm, dev, PowerOff));
*/

in /sys/src/cmd/aux/apm.c.

once you've done that, you don't need ^t^t 5 or ^t^t 6
to turn the screen on and off.

you don't need ^t^t g: ^t^t r already reboots both
cpu servers and terminals.

you are right that you can't run

	disk/kfscmd halt
	echo off >/mnt/apm/ctl

but you could easily write a program to
halt the file system and then turn off the machine:

	#!/bin/python

	import plan9

	# open both
	kfd = plan9.open("/srv/kfs.cmd", plan9.ORDWR)
	cfd = plan9.open("/mnt/apm/ctl", plan9.OWRITE)

	# halt kfs
	plan9.write(kfd, "halt")
	while 1:
		s = plan9.read(kfd)
		if s == "done" || s == "success":
			break
		plan9.write(1, s)

	# turn off system
	plan9.write(cfd, "off")

russ



  reply	other threads:[~2003-02-22 21:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-22 20:19 Maksim Radziwill
2003-02-22 21:51 ` Russ Cox [this message]
2003-02-23  2:13 ` Skip Tavakkolian
2003-02-23  4:59   ` Dan Cross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0610ae68d7966ee68ba2033283925411@plan9.bell-labs.com \
    --to=rsc@plan9.bell-labs.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).