libmemif: remove outdated unit tests
[vpp.git] / extras / libmemif / examples / icmp_responder-mt / main.c
index 8fa64cf..f37c6a0 100644 (file)
@@ -94,7 +94,7 @@ typedef struct
 typedef struct
 {
   uint16_t index;
-  /* memif conenction handle */
+  /* memif connection handle */
   memif_conn_handle_t conn;
   /* interface ip address */
   uint8_t ip_addr[4];
@@ -112,7 +112,6 @@ pthread_t thread[MAX_THREADS];
 void
 user_signal_handler (int sig)
 {
-  sig = sig;
 }
 
 static void
@@ -242,7 +241,7 @@ mod_epoll_fd (int epfd, int fd, uint32_t events)
       DBG ("epoll_ctl: %s fd %d", strerror (errno), fd);
       return -1;
     }
-  DBG ("fd %d moddified on epoll", fd);
+  DBG ("fd %d modified on epoll", fd);
   return 0;
 }
 
@@ -375,9 +374,8 @@ memif_rx_interrupt (void *ptr)
   memif_connection_t *c = &memif_connection[data->index];
   int err;
   uint16_t rx = 0, tx = 0, fb = 0;
-  struct epoll_event evt, *e;
+  struct epoll_event evt;
   int en = 0;
-  uint32_t events = 0;
   sigset_t sigset;
 
   signal (SIGUSR1, user_signal_handler);
@@ -550,7 +548,7 @@ on_disconnect (memif_conn_handle_t conn, void *private_ctx)
   memif_connection_t *c = &memif_connection[index];
   int i, ti;
   INFO ("memif disconnected!");
-  /* inform thread in polling mode about memif disconenction */
+  /* inform thread in polling mode about memif disconnection */
   c->pending_del = 1;
   for (i = 0; i < MAX_QUEUES; i++)
     {
@@ -567,7 +565,7 @@ on_disconnect (memif_conn_handle_t conn, void *private_ctx)
 /* user needs to watch new fd or stop watching fd that is about to be closed.
     control fd will be modified during connection establishment to minimize CPU usage */
 int
-control_fd_update (int fd, uint8_t events)
+control_fd_update (int fd, uint8_t events, void *ctx)
 {
   /* convert memif event definitions to epoll events */
   if (events & MEMIF_FD_EVENT_DEL)
@@ -602,7 +600,6 @@ icmpr_memif_create (long index)
 
   /* setting memif connection arguments */
   memif_conn_args_t args;
-  int fd = -1;
   memset (&args, 0, sizeof (args));
   args.is_master = 0;
   args.log2_ring_size = 10;
@@ -652,7 +649,7 @@ icmpr_memif_delete (long index)
   memif_connection_t *c = &memif_connection[index];
 
   int err;
-  /* disconenct then delete memif connection */
+  /* disconnect then delete memif connection */
   err = memif_delete (&c->conn);
   if (err != MEMIF_ERR_SUCCESS)
     INFO ("memif_delete: %s", memif_strerror (err));
@@ -765,7 +762,6 @@ error:
 int
 user_input_handler ()
 {
-  int i;
   char *in = (char *) malloc (256);
   char *ui = fgets (in, 256, stdin);
   char *end;
@@ -830,9 +826,8 @@ done:
 int
 poll_event (int timeout)
 {
-  struct epoll_event evt, *e;
+  struct epoll_event evt;
   int app_err = 0, memif_err = 0, en = 0;
-  int tmp, nfd;
   uint32_t events = 0;
   memset (&evt, 0, sizeof (evt));
   evt.events = EPOLLIN | EPOLLOUT;
@@ -850,7 +845,7 @@ poll_event (int timeout)
       if (evt.data.fd > 2)
        {
          /* event of memif control fd */
-         /* convert epolle events to memif events */
+         /* convert epoll events to memif events */
          if (evt.events & EPOLLIN)
            events |= MEMIF_FD_EVENT_READ;
          if (evt.events & EPOLLOUT)