From owner-freebsd-current@FreeBSD.ORG Fri Dec 9 13:01:06 2005 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0F91016A41F; Fri, 9 Dec 2005 13:01:06 +0000 (GMT) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.FreeBSD.org (Postfix) with ESMTP id 03AA543D5F; Fri, 9 Dec 2005 13:01:02 +0000 (GMT) (envelope-from des@des.no) Received: from tim.des.no (localhost [127.0.0.1]) by spam.des.no (Postfix) with ESMTP id 735842082; Fri, 9 Dec 2005 14:00:55 +0100 (CET) X-Spam-Tests: AWL,BAYES_00,FORGED_RCVD_HELO X-Spam-Learn: ham X-Spam-Score: -3.3/3.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on tim.des.no Received: from xps.des.no (des.no [80.203.243.180]) by tim.des.no (Postfix) with ESMTP id E31332080; Fri, 9 Dec 2005 14:00:54 +0100 (CET) Received: by xps.des.no (Postfix, from userid 1001) id C1F4433C1D; Fri, 9 Dec 2005 14:00:54 +0100 (CET) To: Nate Lawson References: <43938F61.1050202@terranova.net> <4393F60E.2040106@shapeshifter.se> <86mzjflc97.fsf@xps.des.no> <439495B1.5060305@shapeshifter.se> <861x0qmuen.fsf@xps.des.no> <43956ADF.4050504@shapeshifter.se> <86slt6lb9s.fsf@xps.des.no> <4395A265.8080006@root.org> <86d5k9eric.fsf@xps.des.no> <43997CEC.1070607@root.org> From: des@des.no (=?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=) Date: Fri, 09 Dec 2005 14:00:54 +0100 In-Reply-To: <43997CEC.1070607@root.org> (Nate Lawson's message of "Fri, 09 Dec 2005 21:47:40 +0900") Message-ID: <864q5is9vd.fsf@xps.des.no> User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: njl@freebsd.org, Fredrik Lindberg , Travis Mikalson , current@freebsd.org Subject: Re: powerd X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2005 13:01:06 -0000 Nate Lawson writes: > Dag-Erling Sm=F8rgrav wrote: >> +static enum { >> + ac_none, >> + ac_acpi_sysctl, >> + ac_acpi_devd, >> +#ifdef USE_APM >> + ac_apm, >> +#endif >> +} acline_mode; > > Prefer enums be all CAPS, seems like ac_apm can be left in the enum > without an #ifdef because it's only checked by code in an #ifdef below. Having the #ifdef here allows the compiler to warn us if we forget it somewhere else. >> +#ifdef __i386__ >> + } else if ((apm_fd =3D open(APMDEV, O_RDONLY)) >=3D 0) { >> + if (vflag) >> + warnx("using APM for AC line status"); >> + acline_mode =3D ac_apm; >> +#endif > > Don't you want to use your new USE_APM define here? Yes, that was an oversight. >> -static int >> -acline_read() >> +static void >> +acline_read(void) > > Is this correct? I thought only the prototype (above) should have > void as an arg. Yes, and no. >> static void >> devd_close(void) >> { >> - if (devd_pipe < 0) >> - return; >> - >> - pthread_kill(devd_thread, SIGTERM); >> close(devd_pipe); >> -} > > Seems like this function can go away now and we can just conditionally > close devd_pipe (if !=3D -1) at the end of main(). actually, devd_close() should include the line 'devd_pipe =3D -1;' and all instances of close(devd_pipe) should be replaced with devd_close(). >> - /* >> - * Exit cleanly on signals; devd may send a SIGPIPE if it dies. We >> - * do this before acline_init() since it may create a thread and we >> - * want it to inherit our signal mask. >> - */ >> - signal(SIGINT, handle_sigs); >> - signal(SIGTERM, handle_sigs); >> - signal(SIGPIPE, SIG_IGN); >> - > > Don't we still need SIGPIPE handling if reading from devd? des@xps ~% man signal | grep SIGPIPE 13 SIGPIPE terminate process write on a pipe with no reader DES --=20 Dag-Erling Sm=F8rgrav - des@des.no