Date: Mon, 9 Apr 2012 18:51:50 +0200 From: Robert Millan <rmh@freebsd.org> To: Nate Lawson <nate@root.org> Cc: freebsd-acpi@freebsd.org, Steven Chamberlain <steven@pyro.eu.org> Subject: Re: [PATCH] Abort powerd when no cpufreq(4) support is found Message-ID: <CAOfDtXPW8ipGE5p=76HQ5pe9wGx0u%2BKYddRYN26pMW6O7wtENA@mail.gmail.com> In-Reply-To: <E2E769FA-970A-4E1C-805B-DE6397B456C9@root.org> References: <CAOfDtXO=7ALiBVHdY-hHa158yXoM%2BXXigkU4SObPHRr0h-2iUQ@mail.gmail.com> <E2E769FA-970A-4E1C-805B-DE6397B456C9@root.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
Hi Nate,
El 9 d’abril de 2012 18:06, Nate Lawson <nate@root.org> ha escrit:
> The message is fine, but I think an error code of 0 is wrong. Powerd didn't start, whereas 0 means the daemon launched successfully.
In that case, may I suggest that we return one of the error codes
recommended by sysexists(3)? EX_UNAVAILABLE seems close enough to the
reason we're aborting.
--
Robert Millan
[-- Attachment #2 --]
Index: usr.sbin/powerd/powerd.c
===================================================================
--- usr.sbin/powerd/powerd.c (revision 234053)
+++ usr.sbin/powerd/powerd.c (working copy)
@@ -44,6 +44,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sysexits.h>
#include <unistd.h>
#ifdef __i386__
@@ -536,7 +537,7 @@
err(1, "lookup kern.cp_times");
len = 4;
if (sysctlnametomib("dev.cpu.0.freq", freq_mib, &len))
- err(1, "lookup freq");
+ err(EX_UNAVAILABLE, "no cpufreq(4) support -- aborting");
len = 4;
if (sysctlnametomib("dev.cpu.0.freq_levels", levels_mib, &len))
err(1, "lookup freq_levels");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOfDtXPW8ipGE5p=76HQ5pe9wGx0u%2BKYddRYN26pMW6O7wtENA>
