Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Define _PATH_POWER and use it.



details:   https://anonhg.NetBSD.org/src/rev/25789cafd77e
branches:  trunk
changeset: 754245:25789cafd77e
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Sat Apr 24 20:44:33 2010 +0000

description:
Define _PATH_POWER and use it.

diffstat:

 include/paths.h          |   3 ++-
 usr.sbin/powerd/powerd.c |  12 ++++++------
 2 files changed, 8 insertions(+), 7 deletions(-)

diffs (71 lines):

diff -r cc73b57c8dc9 -r 25789cafd77e include/paths.h
--- a/include/paths.h   Sat Apr 24 19:58:13 2010 +0000
+++ b/include/paths.h   Sat Apr 24 20:44:33 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: paths.h,v 1.36 2010/02/03 18:11:18 roy Exp $   */
+/*     $NetBSD: paths.h,v 1.37 2010/04/24 20:44:33 jruoho Exp $        */
 
 /*
  * Copyright (c) 1989, 1993
@@ -82,6 +82,7 @@
 #define        _PATH_MIXER0    "/dev/mixer0"
 #define        _PATH_NOLOGIN   "/etc/nologin"
 #define        _PATH_PRINTCAP  "/etc/printcap"
+#define _PATH_POWER    "/dev/power"
 #define        _PATH_PUD       "/dev/pud"
 #define        _PATH_PUFFS     "/dev/puffs"
 #define        _PATH_RANDOM    "/dev/random"
diff -r cc73b57c8dc9 -r 25789cafd77e usr.sbin/powerd/powerd.c
--- a/usr.sbin/powerd/powerd.c  Sat Apr 24 19:58:13 2010 +0000
+++ b/usr.sbin/powerd/powerd.c  Sat Apr 24 20:44:33 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: powerd.c,v 1.13 2007/12/15 19:44:56 perry Exp $        */
+/*     $NetBSD: powerd.c,v 1.14 2010/04/24 20:44:33 jruoho Exp $       */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -46,6 +46,7 @@
 #include <sys/wait.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <paths.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sysexits.h>
@@ -58,7 +59,6 @@
 
 static int kq;
 
-#define        _PATH_DEV_POWER         "/dev/power"
 #define        _PATH_POWERD_SCRIPTS    "/etc/powerd/scripts"
 
 static void usage(void) __dead;
@@ -110,8 +110,8 @@
                exit(EX_OSERR);
        }
 
-       if ((fd = open(_PATH_DEV_POWER, O_RDONLY|O_NONBLOCK, 0600)) == -1) {
-               syslog(LOG_ERR, "open %s: %m", _PATH_DEV_POWER);
+       if ((fd = open(_PATH_POWER, O_RDONLY|O_NONBLOCK, 0600)) == -1) {
+               syslog(LOG_ERR, "open %s: %m", _PATH_POWER);
                exit(EX_OSERR);
        }
 
@@ -266,7 +266,7 @@
        if (read(fd, &pev, sizeof(pev)) != sizeof(pev)) {
                if (errno == EWOULDBLOCK)
                        return;
-               syslog(LOG_ERR, "read of %s: %m", _PATH_DEV_POWER);
+               syslog(LOG_ERR, "read of %s: %m", _PATH_POWER);
                exit(EX_OSERR);
        }
 
@@ -281,7 +281,7 @@
                break;
        default:
                syslog(LOG_INFO, "unknown %s event type: %d",
-                   _PATH_DEV_POWER, pev.pev_type);
+                   _PATH_POWER, pev.pev_type);
        }
 
        goto again;



Home | Main Index | Thread Index | Old Index