Deleted Added
full compact
sprayd.c (50476) sprayd.c (90336)
1/*
2 * Copyright (c) 1994 Christos Zoulas
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#ifndef lint
32static const char rcsid[] =
1/*
2 * Copyright (c) 1994 Christos Zoulas
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#ifndef lint
32static const char rcsid[] =
33 "$FreeBSD: head/libexec/rpc.sprayd/sprayd.c 50476 1999-08-28 00:22:10Z peter $";
33 "$FreeBSD: head/libexec/rpc.sprayd/sprayd.c 90336 2002-02-07 05:24:53Z imp $";
34#endif /* not lint */
35
36#include <rpc/rpc.h>
37#include <rpc/pmap_clnt.h>
38#include <rpcsvc/spray.h>
39#include <signal.h>
40#include <stdio.h>
41#include <stdlib.h>
42#include <sys/time.h>
43#include <sys/socket.h>
44#include <syslog.h>
45#include <unistd.h>
46
34#endif /* not lint */
35
36#include <rpc/rpc.h>
37#include <rpc/pmap_clnt.h>
38#include <rpcsvc/spray.h>
39#include <signal.h>
40#include <stdio.h>
41#include <stdlib.h>
42#include <sys/time.h>
43#include <sys/socket.h>
44#include <syslog.h>
45#include <unistd.h>
46
47static void spray_service __P((struct svc_req *, SVCXPRT *));
47static void spray_service(struct svc_req *, SVCXPRT *);
48
49static int from_inetd = 1;
50
51#define timersub(tvp, uvp, vvp) \
52 do { \
53 (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
54 (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
55 if ((vvp)->tv_usec < 0) { \
56 (vvp)->tv_sec--; \
57 (vvp)->tv_usec += 1000000; \
58 } \
59 } while (0)
60
61#define TIMEOUT 120
62
63void
48
49static int from_inetd = 1;
50
51#define timersub(tvp, uvp, vvp) \
52 do { \
53 (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
54 (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
55 if ((vvp)->tv_usec < 0) { \
56 (vvp)->tv_sec--; \
57 (vvp)->tv_usec += 1000000; \
58 } \
59 } while (0)
60
61#define TIMEOUT 120
62
63void
64cleanup()
64cleanup(int sig __unused)
65{
66 (void) pmap_unset(SPRAYPROG, SPRAYVERS);
67 exit(0);
68}
69
70void
65{
66 (void) pmap_unset(SPRAYPROG, SPRAYVERS);
67 exit(0);
68}
69
70void
71die()
71die(int sig __unused)
72{
73 exit(0);
74}
75
76int
72{
73 exit(0);
74}
75
76int
77main(argc, argv)
78 int argc;
79 char *argv[];
77main(int argc, char *argv[])
80{
81 SVCXPRT *transp;
82 int sock = 0;
83 int proto = 0;
84 struct sockaddr_in from;
85 int fromlen;
86
87 /*

--- 35 unchanged lines hidden (view full) ---

123
124 svc_run();
125 syslog(LOG_ERR, "svc_run returned");
126 return 1;
127}
128
129
130static void
78{
79 SVCXPRT *transp;
80 int sock = 0;
81 int proto = 0;
82 struct sockaddr_in from;
83 int fromlen;
84
85 /*

--- 35 unchanged lines hidden (view full) ---

121
122 svc_run();
123 syslog(LOG_ERR, "svc_run returned");
124 return 1;
125}
126
127
128static void
131spray_service(rqstp, transp)
132 struct svc_req *rqstp;
133 SVCXPRT *transp;
129spray_service(struct svc_req *rqstp, SVCXPRT *transp)
134{
135 static spraycumul scum;
136 static struct timeval clear, get;
137
138 switch (rqstp->rq_proc) {
139 case SPRAYPROC_CLEAR:
140 scum.counter = 0;
141 (void) gettimeofday(&clear, 0);

--- 27 unchanged lines hidden ---
130{
131 static spraycumul scum;
132 static struct timeval clear, get;
133
134 switch (rqstp->rq_proc) {
135 case SPRAYPROC_CLEAR:
136 scum.counter = 0;
137 (void) gettimeofday(&clear, 0);

--- 27 unchanged lines hidden ---