[packages/apinger] - drop forked receiver code, not enable by default and not supported by srcip patch :(
hawk
hawk at pld-linux.org
Thu Jul 26 11:27:51 CEST 2012
commit f7780d72a8b924cead7d4433fa46e2102dd32cbe
Author: Marcin Krol <hawk at tld-linux.org>
Date: Thu Jul 26 09:27:20 2012 +0000
- drop forked receiver code, not enable by default and not supported
by srcip patch :(
apinger-no_forked_receiver.patch | 303 +++++++++++++++++++++++++++++++++++++++
1 file changed, 303 insertions(+)
---
diff --git a/apinger-no_forked_receiver.patch b/apinger-no_forked_receiver.patch
new file mode 100644
index 0000000..98ee393
--- /dev/null
+++ b/apinger-no_forked_receiver.patch
@@ -0,0 +1,303 @@
+diff -ur apinger-0.6.1.orig//config.h.in apinger-0.6.1/config.h.in
+--- apinger-0.6.1.orig//config.h.in 2003-03-26 11:37:48.000000000 +0000
++++ apinger-0.6.1/config.h.in 2012-07-25 17:40:42.232252511 +0000
+@@ -1,8 +1,5 @@
+ /* config.h.in. Generated from configure.ac by autoheader. */
+
+-/* Define to enable receiver subprocess */
+-#undef FORKED_RECEIVER
+-
+ /* Define to 1 if you have the `access' function. */
+ #undef HAVE_ACCESS
+
+diff -ur apinger-0.6.1.orig//configure apinger-0.6.1/configure
+--- apinger-0.6.1.orig//configure 2003-03-26 11:37:37.000000000 +0000
++++ apinger-0.6.1/configure 2012-07-25 17:40:42.235252628 +0000
+@@ -851,8 +851,6 @@
+ --disable-dependency-tracking Speeds up one-time builds
+ --enable-dependency-tracking Do not reject slow dependency extractors
+ --disable-ipv6 Disable IPv6 support.
+- --enable-forked-receiver
+- Create subprocess for receiving pings.
+
+ Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+@@ -7132,23 +7130,6 @@
+ done
+
+
+-# Check whether --enable-forked-receiver or --disable-forked-receiver was given.
+-if test "${enable_forked_receiver+set}" = set; then
+- enableval="$enable_forked_receiver"
+-
+-else
+- enable_forked_receiver=no
+-fi;
+-
+-if test "x$enable_forked_receiver" = "xyes" ; then
+-
+-cat >>confdefs.h <<\_ACEOF
+-#define FORKED_RECEIVER
+-_ACEOF
+-
+-fi
+-
+-
+ # Check whether --with-rrdtool or --without-rrdtool was given.
+ if test "${with_rrdtool+set}" = set; then
+ withval="$with_rrdtool"
+diff -ur apinger-0.6.1.orig//configure.ac apinger-0.6.1/configure.ac
+--- apinger-0.6.1.orig//configure.ac 2003-03-26 11:37:16.000000000 +0000
++++ apinger-0.6.1/configure.ac 2012-07-25 17:40:42.235252628 +0000
+@@ -56,34 +56,6 @@
+
+ AC_CHECK_FUNCS([sched_yield recvmsg])
+
+-AC_ARG_ENABLE(forked-receiver,[AC_HELP_STRING([--enable-forked-receiver],
+- [Create subprocess for receiving pings.])],
+- [],[enable_forked_receiver=no])
+-
+-if test "x$enable_forked_receiver" = "xyes" ; then
+- AC_DEFINE(FORKED_RECEIVER,[],[Define to enable receiver subprocess])
+-dnl else
+-dnl AC_MSG_CHECKING([if PIPE_BUF is big enough])
+-dnl if test "x$enable_forked_receiver" != "xno" ; then
+-dnl AC_TRY_RUN([
+-dnl #ifdef HAVE_SYS_TYPES_H
+-dnl # include <sys/types.h>
+-dnl #endif
+-dnl #ifdef HAVE_LIMITS_H
+-dnl # include <limits.h>
+-dnl #endif
+-dnl
+-dnl int main(int argc,char **argv){
+-dnl
+-dnl if (PIPE_BUF<1024) return 1;
+-dnl return 0;
+-dnl }],
+-dnl [AC_DEFINE(FORKED_RECEIVER,[1],[Define to enable receiver subprocess])
+-dnl AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no])
+-dnl AC_MSG_WARN([Receiver subprocess will not be used.])])
+-dnl fi
+-fi
+-
+ AC_ARG_WITH(rrdtool,[AC_HELP_STRING([--with-rrdtool=path],[Location of rrdtool program])],
+ [ RRDTOOL="$withval" ],[ AC_PATH_PROG([RRDTOOL],[rrdtool],[rrdtool]) ])
+ AC_ARG_WITH(rrdcgi,[AC_HELP_STRING([--with-rrdcgi=path],[Location of rrdcgi program])],
+diff -ur apinger-0.6.1.orig//src/apinger.c apinger-0.6.1/src/apinger.c
+--- apinger-0.6.1.orig//src/apinger.c 2012-07-25 17:39:57.000000000 +0000
++++ apinger-0.6.1/src/apinger.c 2012-07-25 17:40:42.236091113 +0000
+@@ -862,51 +862,6 @@
+ fclose(f);
+ }
+
+-#ifdef FORKED_RECEIVER
+-int receiver_pipe=0;
+-
+-void pipe_reply(struct timeval time_recv,int icmp_seq,struct trace_info *ti){
+-struct piped_info pi;
+-
+- pi.recv_timestamp=time_recv;
+- pi.icmp_seq=icmp_seq;
+- pi.ti=*ti;
+- write(receiver_pipe,&pi,sizeof(pi));
+-}
+-
+-void receiver_loop(void){
+-struct pollfd pfd[2];
+-int npfd=0;
+-int i;
+-
+- signal(SIGTERM,SIG_DFL);
+- signal(SIGINT,SIG_DFL);
+- signal(SIGHUP,SIG_DFL);
+- signal(SIGUSR1,SIG_DFL);
+- signal(SIGPIPE,SIG_DFL);
+-
+- if (icmp_sock){
+- pfd[npfd].events=POLLIN|POLLERR|POLLHUP|POLLNVAL;
+- pfd[npfd].revents=0;
+- pfd[npfd++].fd=icmp_sock;
+- }
+- if (icmp6_sock){
+- pfd[npfd].events=POLLIN|POLLERR|POLLHUP|POLLNVAL;
+- pfd[npfd++].fd=icmp6_sock;
+- pfd[npfd].revents=0;
+- }
+- while(1){
+- poll(pfd,npfd,-1);
+- for(i=0;i<npfd;i++){
+- if (!pfd[i].revents&POLLIN) continue;
+- if (pfd[i].fd==icmp_sock) recv_icmp();
+- else if (pfd[i].fd==icmp6_sock) recv_icmp6();
+- pfd[i].revents=0;
+- }
+- };
+-}
+-#endif
+-
+ void main_loop(void){
+ struct target *t;
+ struct timeval cur_time,next_status={0,0},tv,next_report={0,0},next_rrd_update={0,0};
+@@ -919,35 +874,8 @@
+ struct alarm_list *al,*nal;
+ struct active_alarm_list *aal;
+ struct alarm_cfg *a;
+-#ifdef FORKED_RECEIVER
+-int recv_pipe[2];
+-int pid,r;
+-struct piped_info pi;
+-#endif
+
+ configure_targets();
+-#ifdef FORKED_RECEIVER
+- r=pipe(recv_pipe);
+- if (r){
+- myperror("pipe");
+- exit(1);
+- }
+- pid=fork();
+- if (pid==-1){
+- myperror("pipe");
+- exit(1);
+- }
+- else if (pid==0){
+- close(recv_pipe[0]);
+- receiver_pipe=recv_pipe[1];
+- receiver_loop();
+- exit(0);
+- }
+- close(recv_pipe[1]);
+- pfd[npfd].events=POLLIN|POLLERR|POLLHUP|POLLNVAL;
+- pfd[npfd].revents=0;
+- pfd[npfd++].fd=recv_pipe[0];
+-#else
+ if (icmp_sock){
+ pfd[npfd].events=POLLIN|POLLERR|POLLHUP|POLLNVAL;
+ pfd[npfd].revents=0;
+@@ -958,7 +886,6 @@
+ pfd[npfd++].fd=icmp6_sock;
+ pfd[npfd].revents=0;
+ }
+-#endif
+ if (config->status_interval){
+ gettimeofday(&cur_time,NULL);
+ tv.tv_sec=config->status_interval/1000;
+@@ -1045,16 +972,8 @@
+ poll(pfd,npfd,timeout);
+ for(i=0;i<npfd;i++){
+ if (!pfd[i].revents&POLLIN) continue;
+-#ifdef FORKED_RECEIVER
+- if (pfd[i].fd==recv_pipe[0]){
+- r=read(recv_pipe[0],&pi,sizeof(pi));
+- if (r==sizeof(pi))
+- analyze_reply(pi.recv_timestamp,pi.icmp_seq,&pi.ti);
+- }
+-#else
+ if (pfd[i].fd==icmp_sock) recv_icmp();
+ else if (pfd[i].fd==icmp6_sock) recv_icmp6();
+-#endif
+ pfd[i].revents=0;
+ }
+ if (status_request){
+@@ -1070,9 +989,6 @@
+ reload_config();
+ }
+ }
+-#ifdef FORKED_RECEIVER
+- kill(pid,SIGTERM);
+-#endif
+ while(delayed_reports!=NULL) make_delayed_reports();
+ free_targets();
+ if (macros_buf!=NULL) free(macros_buf);
+diff -ur apinger-0.6.1.orig//src/apinger.h apinger-0.6.1/src/apinger.h
+--- apinger-0.6.1.orig//src/apinger.h 2002-12-20 09:19:57.000000000 +0000
++++ apinger-0.6.1/src/apinger.h 2012-07-25 17:40:42.236091113 +0000
+@@ -104,14 +104,6 @@
+ void *target_id;
+ };
+
+-#ifdef FORKED_RECEIVER
+-struct piped_info {
+- struct trace_info ti;
+- int icmp_seq;
+- struct timeval recv_timestamp;
+-};
+-#endif
+-
+ struct target *targets;
+
+ extern int foreground;
+@@ -131,9 +123,6 @@
+ void recv_icmp6(void);
+ void send_icmp6_probe(struct target *t,int seq);
+
+-#ifdef FORKED_RECEIVER
+-void pipe_reply(struct timeval time_recv,int seq,struct trace_info *ti);
+-#endif
+ void analyze_reply(struct timeval time_recv,int seq,struct trace_info *ti);
+ void main_loop(void);
+
+diff -ur apinger-0.6.1.orig//src/icmp.c apinger-0.6.1/src/icmp.c
+--- apinger-0.6.1.orig//src/icmp.c 2002-12-19 08:24:33.000000000 +0000
++++ apinger-0.6.1/src/icmp.c 2012-07-25 17:40:42.237251321 +0000
+@@ -236,11 +236,7 @@
+ debug("Packet data truncated.");
+ return;
+ }
+-#ifdef FORKED_RECEIVER
+- pipe_reply(*time_recvp,icmp->icmp_seq,(struct trace_info*)(icmp+1));
+-#else
+ analyze_reply(*time_recvp,icmp->icmp_seq,(struct trace_info*)(icmp+1));
+-#endif
+ }
+
+ int make_icmp_socket(void){
+diff -ur apinger-0.6.1.orig//src/icmp6.c apinger-0.6.1/src/icmp6.c
+--- apinger-0.6.1.orig//src/icmp6.c 2002-12-19 08:34:16.000000000 +0000
++++ apinger-0.6.1/src/icmp6.c 2012-07-25 17:40:42.237251321 +0000
+@@ -192,11 +192,7 @@
+ debug("Packet data truncated.");
+ return;
+ }
+-#ifdef FORKED_RECEIVER
+- pipe_reply(*time_recvp,icmp->icmp6_seq,(struct trace_info*)(icmp+1));
+-#else
+ analyze_reply(*time_recvp,icmp->icmp6_seq,(struct trace_info*)(icmp+1));
+-#endif
+ }
+
+
+diff -ur apinger-0.6.1.orig//src/main.c apinger-0.6.1/src/main.c
+--- apinger-0.6.1.orig//src/main.c 2003-03-26 11:27:47.000000000 +0000
++++ apinger-0.6.1/src/main.c 2012-07-25 17:40:42.237251321 +0000
+@@ -125,19 +125,6 @@
+ }
+ }
+
+-#ifdef FORKED_RECEIVER
+-void sigchld_handler (int signum) {
+-int pid, status, serrno;
+-
+- serrno = errno;
+- while (1) {
+- pid = waitpid (WAIT_ANY, &status, WNOHANG);
+- if (pid <= 0) break;
+- }
+- errno = serrno;
+-}
+-#endif
+-
+ void usage(const char *name){
+ fprintf(stderr,"Alarm Pinger " PACKAGE_VERSION " (c) 2002 Jacek Konieczny <jajcus at pld.org.pl>\n");
+ fprintf(stderr,"Usage:\n");
+@@ -283,9 +270,6 @@
+ signal(SIGHUP,signal_handler);
+ signal(SIGUSR1,signal_handler);
+ signal(SIGPIPE,signal_handler);
+-#ifdef FORKED_RECEIVER
+- signal(SIGCHLD,sigchld_handler);
+-#endif
+ main_loop();
+ if (icmp_sock>=0) close(icmp_sock);
+ if (icmp6_sock>=0) close(icmp6_sock);
More information about the pld-cvs-commit
mailing list