diff options
author | charnier <charnier@FreeBSD.org> | 1997-11-26 07:34:56 +0000 |
---|---|---|
committer | charnier <charnier@FreeBSD.org> | 1997-11-26 07:34:56 +0000 |
commit | a1752dee71c9d0ef623d348bcbdb0dc83e3bbf65 (patch) | |
tree | f133aef40a6aafb93edc35de9ca2c2664d1d331a /libexec/rpc.rstatd | |
parent | 0a4b753b280853b41f27d7b886c691c71ede39b2 (diff) | |
download | FreeBSD-src-a1752dee71c9d0ef623d348bcbdb0dc83e3bbf65.zip FreeBSD-src-a1752dee71c9d0ef623d348bcbdb0dc83e3bbf65.tar.gz |
Remove \n at end of syslog string. -Wall cleaning. Cosmetics in man page.
Diffstat (limited to 'libexec/rpc.rstatd')
-rw-r--r-- | libexec/rpc.rstatd/rpc.rstatd.8 | 13 | ||||
-rw-r--r-- | libexec/rpc.rstatd/rstat_proc.c | 40 | ||||
-rw-r--r-- | libexec/rpc.rstatd/rstatd.c | 14 |
3 files changed, 39 insertions, 28 deletions
diff --git a/libexec/rpc.rstatd/rpc.rstatd.8 b/libexec/rpc.rstatd/rpc.rstatd.8 index 5a54b81..8897232 100644 --- a/libexec/rpc.rstatd/rpc.rstatd.8 +++ b/libexec/rpc.rstatd/rpc.rstatd.8 @@ -31,7 +31,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: rpc.rstatd.8,v 1.3 1997/02/22 14:22:12 peter Exp $ .\" .Dd June 7, 1993 .Dt RPC.RSTATD 8 @@ -42,20 +42,21 @@ .Sh SYNOPSIS .Nm /usr/libexec/rpc.rstatd .Sh DESCRIPTION -.Nm rpc.rstatd +.Nm Rpc.rstatd is a server which returns performance statistics obtained from the kernel. These statistics are read using the .Xr rup 1 command. The -.Nm rpc.rstatd +.Nm daemon is normally invoked by .Xr inetd 8 . .Pp -.Nm rpc.rstatd -uses an RPC protocol defined in +.Nm Rpc.rstatd +uses an +.Tn RPC +protocol defined in .Pa /usr/include/rpcsvc/rstat.x . .Sh SEE ALSO .Xr rup 1 , .Xr inetd 8 - diff --git a/libexec/rpc.rstatd/rstat_proc.c b/libexec/rpc.rstatd/rstat_proc.c index bb67bed..0f6e2ee 100644 --- a/libexec/rpc.rstatd/rstat_proc.c +++ b/libexec/rpc.rstatd/rstat_proc.c @@ -26,10 +26,14 @@ * 2550 Garcia Avenue * Mountain View, California 94043 */ + #ifndef lint -/*static char sccsid[] = "from: @(#)rpc.rstatd.c 1.1 86/09/25 Copyr 1984 Sun Micro";*/ -/*static char sccsid[] = "from: @(#)rstat_proc.c 2.2 88/08/01 4.0 RPCSRC";*/ -static char rcsid[] = "$Id$"; +#if 0 +static char sccsid[] = "from: @(#)rpc.rstatd.c 1.1 86/09/25 Copyr 1984 Sun Micro"; +static char sccsid[] = "from: @(#)rstat_proc.c 2.2 88/08/01 4.0 RPCSRC"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* @@ -41,12 +45,12 @@ static char rcsid[] = "$Id$"; #include <sys/types.h> #include <sys/param.h> #include <sys/dkstat.h> -#include <sys/errno.h> #include <sys/socket.h> #include <sys/sysctl.h> #include <sys/time.h> #include <sys/vmmeter.h> +#include <err.h> #include <fcntl.h> #include <kvm.h> #include <limits.h> @@ -56,6 +60,7 @@ static char rcsid[] = "$Id$"; #include <stdlib.h> #include <string.h> #include <syslog.h> +#include <unistd.h> #include <net/if.h> #include <net/if_mib.h> @@ -82,6 +87,9 @@ struct nlist nl[] = { { "_dk_ndrive" }, { "" }, }; + +int havedisk __P((void)); +void setup __P((void)); int stats_service(); extern int from_inetd; @@ -97,7 +105,6 @@ union { void updatestat(); static stat_is_init = 0; static kvm_t *kd; -extern int errno; static int cp_time_xlat[RSTAT_CPUSTATES] = { CP_USER, CP_NICE, CP_SYS, CP_IDLE }; @@ -108,6 +115,7 @@ static long bsd_cp_time[CPUSTATES]; #define FSCALE (1 << 8) #endif +void stat_init() { stat_is_init = 1; @@ -171,7 +179,7 @@ rstatproc_havedisk_1() void updatestat() { - int off, i, hz; + int i, hz; struct clockinfo clockrate; struct vmmeter cnt; struct ifmibdata ifmd; @@ -208,7 +216,7 @@ updatestat() if (kvm_read(kd, (long)nl[X_CPTIME].n_value, (char *)bsd_cp_time, sizeof(bsd_cp_time)) != sizeof(bsd_cp_time)) { - syslog(LOG_ERR, "rstat: can't read cp_time from kmem\n"); + syslog(LOG_ERR, "rstat: can't read cp_time from kmem"); exit(1); } for(i = 0; i < RSTAT_CPUSTATES ; i++) @@ -239,7 +247,7 @@ updatestat() /* XXX - should use sysctl */ if (kvm_read(kd, (long)nl[X_CNT].n_value, (char *)&cnt, sizeof cnt) != sizeof cnt) { - syslog(LOG_ERR, "rstat: can't read cnt from kmem\n"); + syslog(LOG_ERR, "rstat: can't read cnt from kmem"); exit(1); } stats_all.s1.v_pgpgin = cnt.v_vnodepgsin; @@ -255,7 +263,7 @@ updatestat() /* XXX - should use sysctl */ if (kvm_read(kd, (long)nl[X_DKXFER].n_value, (char *)stats_all.s1.dk_xfer, sizeof (stats_all.s1.dk_xfer)) != sizeof (stats_all.s1.dk_xfer)) { - syslog(LOG_ERR, "rstat: can't read dk_xfer from kmem\n"); + syslog(LOG_ERR, "rstat: can't read dk_xfer from kmem"); exit(1); } @@ -297,9 +305,9 @@ updatestat() alarm(1); } +void setup() { - int off; char errbuf[_POSIX2_LINE_MAX]; int en; @@ -318,19 +326,19 @@ setup() /* * returns true if have a disk */ +int havedisk() { - int i, cnt; int dk_ndrive; if (kvm_nlist(kd, nl) != 0) { - syslog(LOG_ERR, "rstatd: Can't get namelist.(d)"); + syslog(LOG_ERR, "rstatd: can't get namelist.(d)"); exit (1); } if (kvm_read(kd, (long)nl[X_DKNDRIVE].n_value, (char *)&dk_ndrive, sizeof dk_ndrive)!= sizeof dk_ndrive) { - syslog(LOG_ERR, "rstat: can't read kmem\n"); + syslog(LOG_ERR, "rstat: can't read kmem"); exit(1); } return (dk_ndrive != 0); @@ -406,10 +414,8 @@ rstat_service(rqstp, transp) if (result != NULL && !svc_sendreply(transp, xdr_result, result)) { svcerr_systemerr(transp); } - if (!svc_freeargs(transp, xdr_argument, &argument)) { - (void)fprintf(stderr, "unable to free arguments\n"); - exit(1); - } + if (!svc_freeargs(transp, xdr_argument, &argument)) + errx(1, "unable to free arguments"); leave: if (from_inetd) exit(0); diff --git a/libexec/rpc.rstatd/rstatd.c b/libexec/rpc.rstatd/rstatd.c index 72c449f..84f1c47 100644 --- a/libexec/rpc.rstatd/rstatd.c +++ b/libexec/rpc.rstatd/rstatd.c @@ -32,13 +32,16 @@ */ #ifndef lint -static char rcsid[] = "$Id$"; +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include <stdio.h> +#include <stdlib.h> #include <rpc/rpc.h> #include <signal.h> #include <syslog.h> +#include <rpc/pmap_clnt.h> #include <rpcsvc/rstat.h> extern void rstat_service(); @@ -55,6 +58,7 @@ cleanup() exit(0); } +int main(argc, argv) int argc; char *argv[]; @@ -96,19 +100,19 @@ main(argc, argv) transp = svcudp_create(sock); if (transp == NULL) { - syslog(LOG_ERR, "cannot create udp service."); + syslog(LOG_ERR, "cannot create udp service"); exit(1); } if (!svc_register(transp, RSTATPROG, RSTATVERS_TIME, rstat_service, proto)) { - syslog(LOG_ERR, "unable to register (RSTATPROG, RSTATVERS_TIME, udp)."); + syslog(LOG_ERR, "unable to register (RSTATPROG, RSTATVERS_TIME, udp)"); exit(1); } if (!svc_register(transp, RSTATPROG, RSTATVERS_SWTCH, rstat_service, proto)) { - syslog(LOG_ERR, "unable to register (RSTATPROG, RSTATVERS_SWTCH, udp)."); + syslog(LOG_ERR, "unable to register (RSTATPROG, RSTATVERS_SWTCH, udp)"); exit(1); } if (!svc_register(transp, RSTATPROG, RSTATVERS_ORIG, rstat_service, proto)) { - syslog(LOG_ERR, "unable to register (RSTATPROG, RSTATVERS_ORIG, udp)."); + syslog(LOG_ERR, "unable to register (RSTATPROG, RSTATVERS_ORIG, udp)"); exit(1); } |