From 7e5e32b62f83c893eaf3d9bd0b77e3b5f029dc16 Mon Sep 17 00:00:00 2001 From: Sam Tannous Date: Thu, 4 May 2017 06:54:17 -0700 Subject: [PATCH 1/3] Remove uncalled function causing compiler error Ticket: CM-16086 Reviewed By: sharpd Testing Done: Built debs and tested on hardnode With snmp enabled, this function was causing compiler errors since it was not being called. Removed it. Signed-off-by: Sam Tannous --- lib/thread.c | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/lib/thread.c b/lib/thread.c index e10d0c48bf..e3db7a93e5 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -1153,28 +1153,6 @@ thread_process_fds_helper (struct thread_master *m, struct thread *thread, threa #if defined(HAVE_POLL) -#if defined(HAVE_SNMP) -/* add snmp fds to poll set */ -static void -add_snmp_pollfds(struct thread_master *m, fd_set *snmpfds, int fdsetsize) -{ - int i; - m->handler.pfdcountsnmp = m->handler.pfdcount; - /* cycle trough fds and add neccessary fds to poll set */ - for (i=0;ihandler.pfdcountsnmp <= m->handler.pfdsize); - - m->handler.pfds[m->handler.pfdcountsnmp].fd = i; - m->handler.pfds[m->handler.pfdcountsnmp].events = POLLIN; - m->handler.pfdcountsnmp++; - } - } -} -#endif - /* check poll events */ static void check_pollfds(struct thread_master *m, fd_set *readfd, int num) From a03d3c8040ff1f1b9ec907ed83918429d939ebb7 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 4 May 2017 10:24:25 -0400 Subject: [PATCH 2/3] lib: Rename HAVE_POLL to prevent conflicting #defines Rename HAVE_POLL to HAVE_POLL_CALL, when compiling with snmp and poll enabled this was causing issues. Signed-off-by: Donald Sharp --- configure.ac | 2 +- lib/thread.c | 30 +++++++++++++++--------------- lib/thread.h | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index 63fbc304fc..9b4af1f2bf 100755 --- a/configure.ac +++ b/configure.ac @@ -321,7 +321,7 @@ if test "${enable_rr_semantics}" != "no" ; then fi if test "${enable_poll}" = "yes" ; then - AC_DEFINE(HAVE_POLL,,Compile systemd support in) + AC_DEFINE(HAVE_POLL_CALL,,Compile systemd support in) fi dnl ---------- diff --git a/lib/thread.c b/lib/thread.c index e3db7a93e5..e71b1cb139 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -486,7 +486,7 @@ thread_master_create (void) rv->timer->cmp = rv->background->cmp = thread_timer_cmp; rv->timer->update = rv->background->update = thread_timer_update; -#if defined(HAVE_POLL) +#if defined(HAVE_POLL_CALL) rv->handler.pfdsize = rv->fd_limit; rv->handler.pfdcount = 0; rv->handler.pfds = XCALLOC (MTYPE_THREAD_MASTER, @@ -642,7 +642,7 @@ thread_master_free (struct thread_master *m) thread_list_free (m, &m->unuse); thread_queue_free (m, m->background); -#if defined(HAVE_POLL) +#if defined(HAVE_POLL_CALL) XFREE (MTYPE_THREAD_MASTER, m->handler.pfds); #endif XFREE (MTYPE_THREAD_MASTER, m); @@ -705,7 +705,7 @@ thread_get (struct thread_master *m, u_char type, return thread; } -#if defined (HAVE_POLL) +#if defined (HAVE_POLL_CALL) #define fd_copy_fd_set(X) (X) @@ -759,7 +759,7 @@ static int fd_select (struct thread_master *m, int size, thread_fd_set *read, thread_fd_set *write, thread_fd_set *except, struct timeval *timer_wait) { int num; -#if defined(HAVE_POLL) +#if defined(HAVE_POLL_CALL) /* recalc timeout for poll. Attention NULL pointer is no timeout with select, where with poll no timeount is -1 */ int timeout = -1; @@ -777,7 +777,7 @@ fd_select (struct thread_master *m, int size, thread_fd_set *read, thread_fd_set static int fd_is_set (struct thread *thread, thread_fd_set *fdset, int pos) { -#if defined(HAVE_POLL) +#if defined(HAVE_POLL_CALL) return 1; #else return FD_ISSET (THREAD_FD (thread), fdset); @@ -787,7 +787,7 @@ fd_is_set (struct thread *thread, thread_fd_set *fdset, int pos) static int fd_clear_read_write (struct thread *thread) { -#if !defined(HAVE_POLL) +#if !defined(HAVE_POLL_CALL) thread_fd_set *fdset = NULL; int fd = THREAD_FD (thread); @@ -812,7 +812,7 @@ funcname_thread_add_read_write (int dir, struct thread_master *m, { struct thread *thread = NULL; -#if !defined(HAVE_POLL) +#if !defined(HAVE_POLL_CALL) thread_fd_set *fdset = NULL; if (dir == THREAD_READ) fdset = &m->handler.readfd; @@ -820,7 +820,7 @@ funcname_thread_add_read_write (int dir, struct thread_master *m, fdset = &m->handler.writefd; #endif -#if defined (HAVE_POLL) +#if defined (HAVE_POLL_CALL) thread = generic_thread_add(m, func, arg, fd, dir, debugargpass); if (thread == NULL) @@ -969,7 +969,7 @@ funcname_thread_add_event (struct thread_master *m, static void thread_cancel_read_or_write (struct thread *thread, short int state) { -#if defined(HAVE_POLL) +#if defined(HAVE_POLL_CALL) nfds_t i; for (i=0;imaster->handler.pfdcount;++i) @@ -1003,7 +1003,7 @@ thread_cancel (struct thread *thread) switch (thread->type) { case THREAD_READ: -#if defined (HAVE_POLL) +#if defined (HAVE_POLL_CALL) thread_cancel_read_or_write (thread, POLLIN | POLLHUP); #else thread_cancel_read_or_write (thread, 0); @@ -1011,7 +1011,7 @@ thread_cancel (struct thread *thread) thread_array = thread->master->read; break; case THREAD_WRITE: -#if defined (HAVE_POLL) +#if defined (HAVE_POLL_CALL) thread_cancel_read_or_write (thread, POLLOUT | POLLHUP); #else thread_cancel_read_or_write (thread, 0); @@ -1143,7 +1143,7 @@ thread_process_fds_helper (struct thread_master *m, struct thread *thread, threa thread_delete_fd (thread_array, thread); thread_list_add (&m->ready, thread); thread->type = THREAD_READY; -#if defined(HAVE_POLL) +#if defined(HAVE_POLL_CALL) thread->master->handler.pfds[pos].events &= ~(state); #endif return 1; @@ -1151,7 +1151,7 @@ thread_process_fds_helper (struct thread_master *m, struct thread *thread, threa return 0; } -#if defined(HAVE_POLL) +#if defined(HAVE_POLL_CALL) /* check poll events */ static void @@ -1192,7 +1192,7 @@ check_pollfds(struct thread_master *m, fd_set *readfd, int num) static void thread_process_fds (struct thread_master *m, thread_fd_set *rset, thread_fd_set *wset, int num) { -#if defined (HAVE_POLL) +#if defined (HAVE_POLL_CALL) check_pollfds (m, rset, num); #else int ready = 0, index; @@ -1280,7 +1280,7 @@ thread_fetch (struct thread_master *m, struct thread *fetch) thread_process (&m->event); /* Structure copy. */ -#if !defined(HAVE_POLL) +#if !defined(HAVE_POLL_CALL) readfd = fd_copy_fd_set(m->handler.readfd); writefd = fd_copy_fd_set(m->handler.writefd); exceptfd = fd_copy_fd_set(m->handler.exceptfd); diff --git a/lib/thread.h b/lib/thread.h index 3440a92999..35a11cb77e 100644 --- a/lib/thread.h +++ b/lib/thread.h @@ -49,7 +49,7 @@ struct pqueue; */ typedef fd_set thread_fd_set; -#if defined(HAVE_POLL) +#if defined(HAVE_POLL_CALL) #include struct fd_handler { From ff871f86e119c5b916907fce4ac042d6e0125d58 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Wed, 8 Mar 2017 16:37:42 +0100 Subject: [PATCH 3/3] pimd: fix clang warning pimd/pim_sock.c:178:13: error: implicit conversion from 'int' to 'char' changes value from 148 to -108 [-Werror,-Wconstant-conversion] ra[0] = 148; Signed-off-by: David Lamparter --- pimd/pim_sock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pimd/pim_sock.c b/pimd/pim_sock.c index 54816d126b..e1949e3602 100644 --- a/pimd/pim_sock.c +++ b/pimd/pim_sock.c @@ -136,7 +136,7 @@ int pim_socket_mcast(int protocol, struct in_addr ifaddr, int ifindex, u_char lo /* Set router alert (RFC 2113) for all IGMP messages (RFC 3376 4. Message Formats)*/ if (protocol == IPPROTO_IGMP) { - char ra[4]; + uint8_t ra[4]; ra[0] = 148; ra[1] = 4; ra[2] = 0;