mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-10 21:51:06 +00:00
commit
fba10244ef
@ -321,7 +321,7 @@ if test "${enable_rr_semantics}" != "no" ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if test "${enable_poll}" = "yes" ; then
|
if test "${enable_poll}" = "yes" ; then
|
||||||
AC_DEFINE(HAVE_POLL,,Compile systemd support in)
|
AC_DEFINE(HAVE_POLL_CALL,,Compile systemd support in)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl ----------
|
dnl ----------
|
||||||
|
52
lib/thread.c
52
lib/thread.c
@ -486,7 +486,7 @@ thread_master_create (void)
|
|||||||
rv->timer->cmp = rv->background->cmp = thread_timer_cmp;
|
rv->timer->cmp = rv->background->cmp = thread_timer_cmp;
|
||||||
rv->timer->update = rv->background->update = thread_timer_update;
|
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.pfdsize = rv->fd_limit;
|
||||||
rv->handler.pfdcount = 0;
|
rv->handler.pfdcount = 0;
|
||||||
rv->handler.pfds = XCALLOC (MTYPE_THREAD_MASTER,
|
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_list_free (m, &m->unuse);
|
||||||
thread_queue_free (m, m->background);
|
thread_queue_free (m, m->background);
|
||||||
|
|
||||||
#if defined(HAVE_POLL)
|
#if defined(HAVE_POLL_CALL)
|
||||||
XFREE (MTYPE_THREAD_MASTER, m->handler.pfds);
|
XFREE (MTYPE_THREAD_MASTER, m->handler.pfds);
|
||||||
#endif
|
#endif
|
||||||
XFREE (MTYPE_THREAD_MASTER, m);
|
XFREE (MTYPE_THREAD_MASTER, m);
|
||||||
@ -705,7 +705,7 @@ thread_get (struct thread_master *m, u_char type,
|
|||||||
return thread;
|
return thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined (HAVE_POLL)
|
#if defined (HAVE_POLL_CALL)
|
||||||
|
|
||||||
#define fd_copy_fd_set(X) (X)
|
#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)
|
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;
|
int num;
|
||||||
#if defined(HAVE_POLL)
|
#if defined(HAVE_POLL_CALL)
|
||||||
/* recalc timeout for poll. Attention NULL pointer is no timeout with
|
/* recalc timeout for poll. Attention NULL pointer is no timeout with
|
||||||
select, where with poll no timeount is -1 */
|
select, where with poll no timeount is -1 */
|
||||||
int timeout = -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
|
static int
|
||||||
fd_is_set (struct thread *thread, thread_fd_set *fdset, int pos)
|
fd_is_set (struct thread *thread, thread_fd_set *fdset, int pos)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_POLL)
|
#if defined(HAVE_POLL_CALL)
|
||||||
return 1;
|
return 1;
|
||||||
#else
|
#else
|
||||||
return FD_ISSET (THREAD_FD (thread), fdset);
|
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
|
static int
|
||||||
fd_clear_read_write (struct thread *thread)
|
fd_clear_read_write (struct thread *thread)
|
||||||
{
|
{
|
||||||
#if !defined(HAVE_POLL)
|
#if !defined(HAVE_POLL_CALL)
|
||||||
thread_fd_set *fdset = NULL;
|
thread_fd_set *fdset = NULL;
|
||||||
int fd = THREAD_FD (thread);
|
int fd = THREAD_FD (thread);
|
||||||
|
|
||||||
@ -812,7 +812,7 @@ funcname_thread_add_read_write (int dir, struct thread_master *m,
|
|||||||
{
|
{
|
||||||
struct thread *thread = NULL;
|
struct thread *thread = NULL;
|
||||||
|
|
||||||
#if !defined(HAVE_POLL)
|
#if !defined(HAVE_POLL_CALL)
|
||||||
thread_fd_set *fdset = NULL;
|
thread_fd_set *fdset = NULL;
|
||||||
if (dir == THREAD_READ)
|
if (dir == THREAD_READ)
|
||||||
fdset = &m->handler.readfd;
|
fdset = &m->handler.readfd;
|
||||||
@ -820,7 +820,7 @@ funcname_thread_add_read_write (int dir, struct thread_master *m,
|
|||||||
fdset = &m->handler.writefd;
|
fdset = &m->handler.writefd;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (HAVE_POLL)
|
#if defined (HAVE_POLL_CALL)
|
||||||
thread = generic_thread_add(m, func, arg, fd, dir, debugargpass);
|
thread = generic_thread_add(m, func, arg, fd, dir, debugargpass);
|
||||||
|
|
||||||
if (thread == NULL)
|
if (thread == NULL)
|
||||||
@ -969,7 +969,7 @@ funcname_thread_add_event (struct thread_master *m,
|
|||||||
static void
|
static void
|
||||||
thread_cancel_read_or_write (struct thread *thread, short int state)
|
thread_cancel_read_or_write (struct thread *thread, short int state)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_POLL)
|
#if defined(HAVE_POLL_CALL)
|
||||||
nfds_t i;
|
nfds_t i;
|
||||||
|
|
||||||
for (i=0;i<thread->master->handler.pfdcount;++i)
|
for (i=0;i<thread->master->handler.pfdcount;++i)
|
||||||
@ -1003,7 +1003,7 @@ thread_cancel (struct thread *thread)
|
|||||||
switch (thread->type)
|
switch (thread->type)
|
||||||
{
|
{
|
||||||
case THREAD_READ:
|
case THREAD_READ:
|
||||||
#if defined (HAVE_POLL)
|
#if defined (HAVE_POLL_CALL)
|
||||||
thread_cancel_read_or_write (thread, POLLIN | POLLHUP);
|
thread_cancel_read_or_write (thread, POLLIN | POLLHUP);
|
||||||
#else
|
#else
|
||||||
thread_cancel_read_or_write (thread, 0);
|
thread_cancel_read_or_write (thread, 0);
|
||||||
@ -1011,7 +1011,7 @@ thread_cancel (struct thread *thread)
|
|||||||
thread_array = thread->master->read;
|
thread_array = thread->master->read;
|
||||||
break;
|
break;
|
||||||
case THREAD_WRITE:
|
case THREAD_WRITE:
|
||||||
#if defined (HAVE_POLL)
|
#if defined (HAVE_POLL_CALL)
|
||||||
thread_cancel_read_or_write (thread, POLLOUT | POLLHUP);
|
thread_cancel_read_or_write (thread, POLLOUT | POLLHUP);
|
||||||
#else
|
#else
|
||||||
thread_cancel_read_or_write (thread, 0);
|
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_delete_fd (thread_array, thread);
|
||||||
thread_list_add (&m->ready, thread);
|
thread_list_add (&m->ready, thread);
|
||||||
thread->type = THREAD_READY;
|
thread->type = THREAD_READY;
|
||||||
#if defined(HAVE_POLL)
|
#if defined(HAVE_POLL_CALL)
|
||||||
thread->master->handler.pfds[pos].events &= ~(state);
|
thread->master->handler.pfds[pos].events &= ~(state);
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
@ -1151,29 +1151,7 @@ thread_process_fds_helper (struct thread_master *m, struct thread *thread, threa
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_POLL)
|
#if defined(HAVE_POLL_CALL)
|
||||||
|
|
||||||
#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;i<fdsetsize;++i)
|
|
||||||
{
|
|
||||||
if (FD_ISSET(i, snmpfds))
|
|
||||||
{
|
|
||||||
assert (m->handler.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 */
|
/* check poll events */
|
||||||
static void
|
static void
|
||||||
@ -1214,7 +1192,7 @@ check_pollfds(struct thread_master *m, fd_set *readfd, int num)
|
|||||||
static void
|
static void
|
||||||
thread_process_fds (struct thread_master *m, thread_fd_set *rset, thread_fd_set *wset, int num)
|
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);
|
check_pollfds (m, rset, num);
|
||||||
#else
|
#else
|
||||||
int ready = 0, index;
|
int ready = 0, index;
|
||||||
@ -1302,7 +1280,7 @@ thread_fetch (struct thread_master *m, struct thread *fetch)
|
|||||||
thread_process (&m->event);
|
thread_process (&m->event);
|
||||||
|
|
||||||
/* Structure copy. */
|
/* Structure copy. */
|
||||||
#if !defined(HAVE_POLL)
|
#if !defined(HAVE_POLL_CALL)
|
||||||
readfd = fd_copy_fd_set(m->handler.readfd);
|
readfd = fd_copy_fd_set(m->handler.readfd);
|
||||||
writefd = fd_copy_fd_set(m->handler.writefd);
|
writefd = fd_copy_fd_set(m->handler.writefd);
|
||||||
exceptfd = fd_copy_fd_set(m->handler.exceptfd);
|
exceptfd = fd_copy_fd_set(m->handler.exceptfd);
|
||||||
|
@ -49,7 +49,7 @@ struct pqueue;
|
|||||||
*/
|
*/
|
||||||
typedef fd_set thread_fd_set;
|
typedef fd_set thread_fd_set;
|
||||||
|
|
||||||
#if defined(HAVE_POLL)
|
#if defined(HAVE_POLL_CALL)
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
struct fd_handler
|
struct fd_handler
|
||||||
{
|
{
|
||||||
|
@ -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)*/
|
/* Set router alert (RFC 2113) for all IGMP messages (RFC 3376 4. Message Formats)*/
|
||||||
if (protocol == IPPROTO_IGMP) {
|
if (protocol == IPPROTO_IGMP) {
|
||||||
char ra[4];
|
uint8_t ra[4];
|
||||||
ra[0] = 148;
|
ra[0] = 148;
|
||||||
ra[1] = 4;
|
ra[1] = 4;
|
||||||
ra[2] = 0;
|
ra[2] = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user