Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin Use static + __dead
details: https://anonhg.NetBSD.org/src/rev/95dcf476f8e2
branches: trunk
changeset: 771571:95dcf476f8e2
user: joerg <joerg%NetBSD.org@localhost>
date: Fri Nov 25 12:51:27 2011 +0000
description:
Use static + __dead
diffstat:
usr.sbin/apm/apm.c | 22 ++++++++++----------
usr.sbin/apmd/apmd.c | 53 +++++++++++++++++++++++++--------------------------
2 files changed, 37 insertions(+), 38 deletions(-)
diffs (205 lines):
diff -r 320b8a8fe9c6 -r 95dcf476f8e2 usr.sbin/apm/apm.c
--- a/usr.sbin/apm/apm.c Fri Nov 25 12:50:32 2011 +0000
+++ b/usr.sbin/apm/apm.c Fri Nov 25 12:51:27 2011 +0000
@@ -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 @@
exit(1);
}
-void
+static void
zzusage(void)
{
@@ -75,7 +75,7 @@
exit(1);
}
-int
+static int
send_command(int fd,
struct apm_command *cmd,
struct apm_reply *reply)
@@ -96,7 +96,7 @@
return (0);
}
-int
+static int
do_zzz(const char *pn, enum apm_action action)
{
struct apm_command command;
@@ -122,7 +122,7 @@
exit(send_command(fd, &command, &reply));
}
-int
+static int
open_socket(const char *sockname)
{
struct sockaddr_un s_un;
diff -r 320b8a8fe9c6 -r 95dcf476f8e2 usr.sbin/apmd/apmd.c
--- a/usr.sbin/apmd/apmd.c Fri Nov 25 12:50:32 2011 +0000
+++ b/usr.sbin/apmd/apmd.c Fri Nov 25 12:51:27 2011 +0000
@@ -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 @@
}
-int
+static int
power_status(int fd, int force, struct apm_power_info *pinfo)
{
struct apm_power_info bstate;
@@ -149,7 +149,7 @@
(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 @@
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 @@
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 @@
}
-void
+static void
suspend(int ctl_fd)
{
do_etc_file(_PATH_APM_ETC_SUSPEND);
@@ -276,7 +275,7 @@
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 @@
#define TIMO (10*60) /* 10 minutes */
-void
+static void
resume(int ctl_fd)
{
do_etc_file(_PATH_APM_ETC_RESUME);
@@ -523,7 +522,7 @@
exit(1);
}
-void
+static void
do_etc_file(const char *file)
{
pid_t pid;
@@ -567,7 +566,7 @@
}
}
-void
+static void
do_ac_state(int state)
{
switch (state) {
Home |
Main Index |
Thread Index |
Old Index