Remove \n at end of syslog string. -Wall cleaning. Cosmetics in man page.
This commit is contained in:
parent
9ce3627ba1
commit
754c3c574d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=31421
@ -31,7 +31,7 @@
|
|||||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.\" $Id$
|
.\" $Id: rpc.rstatd.8,v 1.3 1997/02/22 14:22:12 peter Exp $
|
||||||
.\"
|
.\"
|
||||||
.Dd June 7, 1993
|
.Dd June 7, 1993
|
||||||
.Dt RPC.RSTATD 8
|
.Dt RPC.RSTATD 8
|
||||||
@ -42,20 +42,21 @@
|
|||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm /usr/libexec/rpc.rstatd
|
.Nm /usr/libexec/rpc.rstatd
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Nm rpc.rstatd
|
.Nm Rpc.rstatd
|
||||||
is a server which returns performance statistics obtained from the kernel.
|
is a server which returns performance statistics obtained from the kernel.
|
||||||
These statistics are read using the
|
These statistics are read using the
|
||||||
.Xr rup 1
|
.Xr rup 1
|
||||||
command.
|
command.
|
||||||
The
|
The
|
||||||
.Nm rpc.rstatd
|
.Nm
|
||||||
daemon is normally invoked by
|
daemon is normally invoked by
|
||||||
.Xr inetd 8 .
|
.Xr inetd 8 .
|
||||||
.Pp
|
.Pp
|
||||||
.Nm rpc.rstatd
|
.Nm Rpc.rstatd
|
||||||
uses an RPC protocol defined in
|
uses an
|
||||||
|
.Tn RPC
|
||||||
|
protocol defined in
|
||||||
.Pa /usr/include/rpcsvc/rstat.x .
|
.Pa /usr/include/rpcsvc/rstat.x .
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr rup 1 ,
|
.Xr rup 1 ,
|
||||||
.Xr inetd 8
|
.Xr inetd 8
|
||||||
|
|
||||||
|
@ -26,10 +26,14 @@
|
|||||||
* 2550 Garcia Avenue
|
* 2550 Garcia Avenue
|
||||||
* Mountain View, California 94043
|
* Mountain View, California 94043
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
/*static char sccsid[] = "from: @(#)rpc.rstatd.c 1.1 86/09/25 Copyr 1984 Sun Micro";*/
|
#if 0
|
||||||
/*static char sccsid[] = "from: @(#)rstat_proc.c 2.2 88/08/01 4.0 RPCSRC";*/
|
static char sccsid[] = "from: @(#)rpc.rstatd.c 1.1 86/09/25 Copyr 1984 Sun Micro";
|
||||||
static char rcsid[] = "$Id$";
|
static char sccsid[] = "from: @(#)rstat_proc.c 2.2 88/08/01 4.0 RPCSRC";
|
||||||
|
#endif
|
||||||
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -41,12 +45,12 @@ static char rcsid[] = "$Id$";
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/dkstat.h>
|
#include <sys/dkstat.h>
|
||||||
#include <sys/errno.h>
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/vmmeter.h>
|
#include <sys/vmmeter.h>
|
||||||
|
|
||||||
|
#include <err.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <kvm.h>
|
#include <kvm.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
@ -56,6 +60,7 @@ static char rcsid[] = "$Id$";
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include <net/if_mib.h>
|
#include <net/if_mib.h>
|
||||||
@ -82,6 +87,9 @@ struct nlist nl[] = {
|
|||||||
{ "_dk_ndrive" },
|
{ "_dk_ndrive" },
|
||||||
{ "" },
|
{ "" },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int havedisk __P((void));
|
||||||
|
void setup __P((void));
|
||||||
int stats_service();
|
int stats_service();
|
||||||
|
|
||||||
extern int from_inetd;
|
extern int from_inetd;
|
||||||
@ -97,7 +105,6 @@ union {
|
|||||||
void updatestat();
|
void updatestat();
|
||||||
static stat_is_init = 0;
|
static stat_is_init = 0;
|
||||||
static kvm_t *kd;
|
static kvm_t *kd;
|
||||||
extern int errno;
|
|
||||||
|
|
||||||
static int cp_time_xlat[RSTAT_CPUSTATES] = { CP_USER, CP_NICE, CP_SYS,
|
static int cp_time_xlat[RSTAT_CPUSTATES] = { CP_USER, CP_NICE, CP_SYS,
|
||||||
CP_IDLE };
|
CP_IDLE };
|
||||||
@ -108,6 +115,7 @@ static long bsd_cp_time[CPUSTATES];
|
|||||||
#define FSCALE (1 << 8)
|
#define FSCALE (1 << 8)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void
|
||||||
stat_init()
|
stat_init()
|
||||||
{
|
{
|
||||||
stat_is_init = 1;
|
stat_is_init = 1;
|
||||||
@ -171,7 +179,7 @@ rstatproc_havedisk_1()
|
|||||||
void
|
void
|
||||||
updatestat()
|
updatestat()
|
||||||
{
|
{
|
||||||
int off, i, hz;
|
int i, hz;
|
||||||
struct clockinfo clockrate;
|
struct clockinfo clockrate;
|
||||||
struct vmmeter cnt;
|
struct vmmeter cnt;
|
||||||
struct ifmibdata ifmd;
|
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))
|
if (kvm_read(kd, (long)nl[X_CPTIME].n_value, (char *)bsd_cp_time, sizeof(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);
|
exit(1);
|
||||||
}
|
}
|
||||||
for(i = 0; i < RSTAT_CPUSTATES ; i++)
|
for(i = 0; i < RSTAT_CPUSTATES ; i++)
|
||||||
@ -239,7 +247,7 @@ updatestat()
|
|||||||
|
|
||||||
/* XXX - should use sysctl */
|
/* XXX - should use sysctl */
|
||||||
if (kvm_read(kd, (long)nl[X_CNT].n_value, (char *)&cnt, sizeof cnt) != sizeof cnt) {
|
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);
|
exit(1);
|
||||||
}
|
}
|
||||||
stats_all.s1.v_pgpgin = cnt.v_vnodepgsin;
|
stats_all.s1.v_pgpgin = cnt.v_vnodepgsin;
|
||||||
@ -255,7 +263,7 @@ updatestat()
|
|||||||
/* XXX - should use sysctl */
|
/* 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))
|
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)) {
|
!= 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);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,9 +305,9 @@ updatestat()
|
|||||||
alarm(1);
|
alarm(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
setup()
|
setup()
|
||||||
{
|
{
|
||||||
int off;
|
|
||||||
char errbuf[_POSIX2_LINE_MAX];
|
char errbuf[_POSIX2_LINE_MAX];
|
||||||
|
|
||||||
int en;
|
int en;
|
||||||
@ -318,19 +326,19 @@ setup()
|
|||||||
/*
|
/*
|
||||||
* returns true if have a disk
|
* returns true if have a disk
|
||||||
*/
|
*/
|
||||||
|
int
|
||||||
havedisk()
|
havedisk()
|
||||||
{
|
{
|
||||||
int i, cnt;
|
|
||||||
int dk_ndrive;
|
int dk_ndrive;
|
||||||
|
|
||||||
if (kvm_nlist(kd, nl) != 0) {
|
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);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kvm_read(kd, (long)nl[X_DKNDRIVE].n_value, (char *)&dk_ndrive,
|
if (kvm_read(kd, (long)nl[X_DKNDRIVE].n_value, (char *)&dk_ndrive,
|
||||||
sizeof dk_ndrive)!= sizeof 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);
|
exit(1);
|
||||||
}
|
}
|
||||||
return (dk_ndrive != 0);
|
return (dk_ndrive != 0);
|
||||||
@ -406,10 +414,8 @@ rstat_service(rqstp, transp)
|
|||||||
if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
|
if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
|
||||||
svcerr_systemerr(transp);
|
svcerr_systemerr(transp);
|
||||||
}
|
}
|
||||||
if (!svc_freeargs(transp, xdr_argument, &argument)) {
|
if (!svc_freeargs(transp, xdr_argument, &argument))
|
||||||
(void)fprintf(stderr, "unable to free arguments\n");
|
errx(1, "unable to free arguments");
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
leave:
|
leave:
|
||||||
if (from_inetd)
|
if (from_inetd)
|
||||||
exit(0);
|
exit(0);
|
||||||
|
@ -32,13 +32,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "$Id$";
|
static const char rcsid[] =
|
||||||
|
"$Id$";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <rpc/rpc.h>
|
#include <rpc/rpc.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
|
#include <rpc/pmap_clnt.h>
|
||||||
#include <rpcsvc/rstat.h>
|
#include <rpcsvc/rstat.h>
|
||||||
|
|
||||||
extern void rstat_service();
|
extern void rstat_service();
|
||||||
@ -55,6 +58,7 @@ cleanup()
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
main(argc, argv)
|
main(argc, argv)
|
||||||
int argc;
|
int argc;
|
||||||
char *argv[];
|
char *argv[];
|
||||||
@ -96,19 +100,19 @@ main(argc, argv)
|
|||||||
|
|
||||||
transp = svcudp_create(sock);
|
transp = svcudp_create(sock);
|
||||||
if (transp == NULL) {
|
if (transp == NULL) {
|
||||||
syslog(LOG_ERR, "cannot create udp service.");
|
syslog(LOG_ERR, "cannot create udp service");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (!svc_register(transp, RSTATPROG, RSTATVERS_TIME, rstat_service, proto)) {
|
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);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (!svc_register(transp, RSTATPROG, RSTATVERS_SWTCH, rstat_service, proto)) {
|
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);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (!svc_register(transp, RSTATPROG, RSTATVERS_ORIG, rstat_service, proto)) {
|
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);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user