From owner-freebsd-questions Tue Nov 5 14:39:18 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6705937B401 for ; Tue, 5 Nov 2002 14:39:15 -0800 (PST) Received: from web14802.mail.yahoo.com (web14802.mail.yahoo.com [216.136.224.218]) by mx1.FreeBSD.org (Postfix) with SMTP id 2CFC143E3B for ; Tue, 5 Nov 2002 14:39:15 -0800 (PST) (envelope-from davemac11@yahoo.com) Message-ID: <20021105223914.64779.qmail@web14802.mail.yahoo.com> Received: from [168.91.4.66] by web14802.mail.yahoo.com via HTTP; Tue, 05 Nov 2002 14:39:14 PST Date: Tue, 5 Nov 2002 14:39:14 -0800 (PST) From: Dave McCammon Subject: Re: Junior hacker assignment :o To: freebsd-questions@freebsd.org In-Reply-To: <20021105210834.88642.qmail@web14807.mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --- Dave McCammon wrote: > --- Mike Hogsett wrote: > > > > > > Look in /usr/src/sys/kern/kern_shutdown.c > > > > static void > > shutdown_halt(void *junk, int howto) { > > ... > > } > > > > Looks interesting. > > > > - Mike > > > > > Hi, > > > > > > --- Mike Hogsett wrote: > > > > Well whatever function the kernel is in while > it > > > > loops, polling the > > > > keyboard asking "press any key to reboot" > could > > have > > > > additional logic for > > > > a countdown timer to reboot. > > > > > > Great! > > > > > > > How and where to do this? I don't know. > > > > > > Not so great ;) > > > > > > Thanks a lot, > > > Carlos. > Not a real programmer but.... > > I wonder if adding the following (taken from > shutdown_reset lines in kern_shutdown.c) > DELAY(1000000); > cpu_reset(); > > to the following in the cpu_halt(); area would work. > > You would have to modify the delay time. > > /* > * If the shutdown was a clean halt, behave > accordingly. > */ > static void > shutdown_halt(void *junk, int howto) > { > if (howto & RB_HALT) { > printf("\n"); > printf("The operating system has halted.\n"); > printf("Please press any key to reboot.\n\n"); > switch (cngetc()) { > case -1: /* No console, just die */ > cpu_halt(); > /* NOTREACHED */ > default: > howto &= ~RB_HALT; > break; > } > } > } DUH!! on my part. My previous response was a little overboard. Why not just increase the delay to close to your ups battery's runtime. (from kern_shutdown.c, starts on line 380) /* * Everything done, now reset */ static void shutdown_reset(void *junk, int howto) { printf("Rebooting...\n"); DELAY(1000000); /* wait 1 sec for printf's to complete and be read */ /* cpu_boot(howto); */ /* doesn't do anything at the moment */ cpu_reset(); /* NOTREACHED */ /* assuming reset worked */ } __________________________________________________ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message