Module Name: src
Committed By: joerg
Date: Fri Nov 25 12:51:28 UTC 2011
Modified Files:
src/usr.sbin/apm: apm.c
src/usr.sbin/apmd: apmd.c
Log Message:
Use static + __dead
To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/apm/apm.c
cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/apmd/apmd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/apm/apm.c
diff -u src/usr.sbin/apm/apm.c:1.20 src/usr.sbin/apm/apm.c:1.21
--- src/usr.sbin/apm/apm.c:1.20 Fri May 2 19:59:19 2008
+++ src/usr.sbin/apm/apm.c Fri Nov 25 12:51:28 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: apm.c,v 1.20 2008/05/02 19:59:19 xtraeme Exp $ */
+/* $NetBSD: apm.c,v 1.21 2011/11/25 12:51:28 joerg Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -51,13 +51,13 @@
#define FALSE 0
#define TRUE 1
-void usage(void);
-void zzusage(void);
-int do_zzz(const char *, enum apm_action);
-int open_socket(const char *);
-int send_command(int, struct apm_command *, struct apm_reply *);
+__dead static void usage(void);
+__dead static void zzusage(void);
+static int do_zzz(const char *, enum apm_action);
+static int open_socket(const char *);
+static int send_command(int, struct apm_command *, struct apm_reply *);
-void
+static void
usage(void)
{
@@ -66,7 +66,7 @@ usage(void)
exit(1);
}
-void
+static void
zzusage(void)
{
@@ -75,7 +75,7 @@ zzusage(void)
exit(1);
}
-int
+static int
send_command(int fd,
struct apm_command *cmd,
struct apm_reply *reply)
@@ -96,7 +96,7 @@ send_command(int fd,
return (0);
}
-int
+static int
do_zzz(const char *pn, enum apm_action action)
{
struct apm_command command;
@@ -122,7 +122,7 @@ do_zzz(const char *pn, enum apm_action a
exit(send_command(fd, &command, &reply));
}
-int
+static int
open_socket(const char *sockname)
{
struct sockaddr_un s_un;
Index: src/usr.sbin/apmd/apmd.c
diff -u src/usr.sbin/apmd/apmd.c:1.31 src/usr.sbin/apmd/apmd.c:1.32
--- src/usr.sbin/apmd/apmd.c:1.31 Mon Apr 28 20:24:15 2008
+++ src/usr.sbin/apmd/apmd.c Fri Nov 25 12:51:27 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: apmd.c,v 1.31 2008/04/28 20:24:15 martin Exp $ */
+/* $NetBSD: apmd.c,v 1.32 2011/11/25 12:51:27 joerg Exp $ */
/*-
* Copyright (c) 1996, 2000 The NetBSD Foundation, Inc.
@@ -59,31 +59,31 @@
#define POWER_STATUS_ACON 0x1
#define POWER_STATUS_LOWBATTNOW 0x2
-const char apmdev[] = _PATH_APM_CTLDEV;
-const char sockfile[] = _PATH_APM_SOCKET;
+static const char apmdev[] = _PATH_APM_CTLDEV;
+static const char sockfile[] = _PATH_APM_SOCKET;
static int debug = 0;
static int verbose = 0;
-void usage (void);
-int power_status (int fd, int force, struct apm_power_info *pinfo);
-int bind_socket (const char *sn, mode_t mode, uid_t uid, gid_t gid);
-enum apm_state handle_client(int sock_fd, int ctl_fd);
-void suspend(int ctl_fd);
-void stand_by(int ctl_fd);
-void resume(int ctl_fd);
-void sigexit(int signo);
-void make_noise(int howmany);
-void do_etc_file(const char *file);
-void do_ac_state(int state);
+__dead static void usage (void);
+static int power_status (int fd, int force, struct apm_power_info *pinfo);
+static int bind_socket (const char *sn, mode_t mode, uid_t uid, gid_t gid);
+static enum apm_state handle_client(int sock_fd, int ctl_fd);
+static void suspend(int ctl_fd);
+static void stand_by(int ctl_fd);
+static void resume(int ctl_fd);
+__dead static void sigexit(int signo);
+static void make_noise(int howmany);
+static void do_etc_file(const char *file);
+static void do_ac_state(int state);
-void
+static void
sigexit(int signo)
{
exit(1);
}
-void
+static void
usage(void)
{
fprintf(stderr,"usage: %s [-adlqsv] [-t seconds] [-S sockname]\n\t[-m sockmode] [-o sockowner:sockgroup] [-f devname]\n", getprogname());
@@ -91,7 +91,7 @@ usage(void)
}
-int
+static int
power_status(int fd, int force, struct apm_power_info *pinfo)
{
struct apm_power_info bstate;
@@ -149,7 +149,7 @@ sockunlink(void)
(void) remove(socketname);
}
-int
+static int
bind_socket(const char *sockname, mode_t mode, uid_t uid, gid_t gid)
{
int sock;
@@ -175,7 +175,7 @@ bind_socket(const char *sockname, mode_t
return sock;
}
-enum apm_state
+static enum apm_state
handle_client(int sock_fd, int ctl_fd)
{
/* accept a handle from the client, process it, then clean up */
@@ -222,9 +222,8 @@ handle_client(int sock_fd, int ctl_fd)
static int speaker_ok = TRUE;
-void
-make_noise(howmany)
-int howmany;
+static void
+make_noise(int howmany)
{
int spkrfd;
int trycnt;
@@ -264,7 +263,7 @@ int howmany;
}
-void
+static void
suspend(int ctl_fd)
{
do_etc_file(_PATH_APM_ETC_SUSPEND);
@@ -276,7 +275,7 @@ suspend(int ctl_fd)
ioctl(ctl_fd, APM_IOC_SUSPEND, 0);
}
-void
+static void
stand_by(int ctl_fd)
{
do_etc_file(_PATH_APM_ETC_STANDBY);
@@ -290,7 +289,7 @@ stand_by(int ctl_fd)
#define TIMO (10*60) /* 10 minutes */
-void
+static void
resume(int ctl_fd)
{
do_etc_file(_PATH_APM_ETC_RESUME);
@@ -523,7 +522,7 @@ main(int argc, char *argv[])
exit(1);
}
-void
+static void
do_etc_file(const char *file)
{
pid_t pid;
@@ -567,7 +566,7 @@ do_etc_file(const char *file)
}
}
-void
+static void
do_ac_state(int state)
{
switch (state) {