Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Jan 2018 21:24:03 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r327793 - stable/10/libexec/rpc.sprayd
Message-ID:  <201801102124.w0ALO3KV025877@repo.freebsd.org>

Next in thread | Raw E-Mail | Index | Archive | Help
Author: pfg
Date: Wed Jan 10 21:24:03 2018
New Revision: 327793
URL: https://svnweb.freebsd.org/changeset/base/327793

Log:
  MFC r327289:
  rpc.sprayd: Bring some changes from NetBSD.
  
  Most notable, other than some style issues:
  CVS 1.11:
    do not use LOG_CONS.
  CVS 1.13:
    consistently use exit instead of return in main().
    use LOG_WARNING instead of LOG_ERR for non critical errors.
  
  Obtained from:	NetBSD

Modified:
  stable/10/libexec/rpc.sprayd/rpc.sprayd.8
  stable/10/libexec/rpc.sprayd/sprayd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/libexec/rpc.sprayd/rpc.sprayd.8
==============================================================================
--- stable/10/libexec/rpc.sprayd/rpc.sprayd.8	Wed Jan 10 21:18:46 2018	(r327792)
+++ stable/10/libexec/rpc.sprayd/rpc.sprayd.8	Wed Jan 10 21:24:03 2018	(r327793)
@@ -1,3 +1,4 @@
+.\"	$NetBSD: rpc.sprayd.8,v 1.9 2003/02/25 10:34:50 wiz Exp $
 .\"
 .\" Copyright (c) 1994 Christos Zoulas
 .\" All rights reserved.
@@ -29,11 +30,12 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 22, 1994
+.Dd December 27, 2017
 .Dt RPC.SPRAYD 8
 .Os
 .Sh NAME
-.Nm rpc.sprayd
+.Nm rpc.sprayd ,
+.Nm sprayd
 .Nd spray server
 .Sh SYNOPSIS
 .Nm /usr/libexec/rpc.sprayd

Modified: stable/10/libexec/rpc.sprayd/sprayd.c
==============================================================================
--- stable/10/libexec/rpc.sprayd/sprayd.c	Wed Jan 10 21:18:46 2018	(r327792)
+++ stable/10/libexec/rpc.sprayd/sprayd.c	Wed Jan 10 21:24:03 2018	(r327793)
@@ -1,3 +1,5 @@
+/*	$NetBSD: sprayd.c,v 1.14 2006/05/09 20:18:07 mrg Exp $	*/
+
 /*
  * Copyright (c) 1994 Christos Zoulas
  * All rights reserved.
@@ -62,7 +64,7 @@ static int from_inetd = 1;
 void
 cleanup(int sig __unused)
 {
-	(void) rpcb_unset(SPRAYPROG, SPRAYVERS, NULL);
+	(void)rpcb_unset(SPRAYPROG, SPRAYVERS, NULL);
 	exit(0);
 }
 
@@ -91,17 +93,17 @@ main(int argc, char *argv[])
 	if (!from_inetd) {
 		daemon(0, 0);
 
-		(void) rpcb_unset(SPRAYPROG, SPRAYVERS, NULL);
+		(void)rpcb_unset(SPRAYPROG, SPRAYVERS, NULL);
 
-		(void) signal(SIGINT, cleanup);
-		(void) signal(SIGTERM, cleanup);
-		(void) signal(SIGHUP, cleanup);
+		(void)signal(SIGINT, cleanup);
+		(void)signal(SIGTERM, cleanup);
+		(void)signal(SIGHUP, cleanup);
 	} else {
-		(void) signal(SIGALRM, die);
+		(void)signal(SIGALRM, die);
 		alarm(TIMEOUT);
 	}
 
-	openlog("rpc.sprayd", LOG_CONS|LOG_PID, LOG_DAEMON);
+	openlog("rpc.sprayd", LOG_PID, LOG_DAEMON);
 
 	if (from_inetd) {
 		transp = svc_tli_create(0, NULL, NULL, 0, 0);
@@ -118,7 +120,7 @@ main(int argc, char *argv[])
 		syslog(LOG_ERR,
 		    "unable to register (SPRAYPROG, SPRAYVERS, %s)",
 		    (!from_inetd)?"udp":"(inetd)");
-		return 1;
+		exit(1);
 	}
 
 	svc_run();
@@ -136,7 +138,7 @@ spray_service(struct svc_req *rqstp, SVCXPRT *transp)
 	switch (rqstp->rq_proc) {
 	case SPRAYPROC_CLEAR:
 		scum.counter = 0;
-		(void) gettimeofday(&clear, 0);
+		(void)gettimeofday(&clear, 0);
 		/*FALLTHROUGH*/
 
 	case NULLPROC:
@@ -148,7 +150,7 @@ spray_service(struct svc_req *rqstp, SVCXPRT *transp)
 		return;
 
 	case SPRAYPROC_GET:
-		(void) gettimeofday(&get, 0);
+		(void)gettimeofday(&get, 0);
 		timersub(&get, &clear, &get);
 		scum.clock.sec = get.tv_sec;
 		scum.clock.usec = get.tv_usec;
@@ -161,6 +163,6 @@ spray_service(struct svc_req *rqstp, SVCXPRT *transp)
 
 	if (!svc_sendreply(transp, (xdrproc_t)xdr_spraycumul, &scum)) {
 		svcerr_systemerr(transp);
-		syslog(LOG_ERR, "bad svc_sendreply");
+		syslog(LOG_WARNING, "bad svc_sendreply");
 	}
 }



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?201801102124.w0ALO3KV025877>