libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] MHD_get_fdset throws "Illegal instruction" error


From: Vitaliy T
Subject: Re: [libmicrohttpd] MHD_get_fdset throws "Illegal instruction" error
Date: Wed, 15 Mar 2017 12:42:12 +0300

On 15 March 2017 at 12:10, Vitaliy T <address@hidden> wrote:
> Sorry, you are wrong.
Sorry, misread POLL vs EPOLL and I was wrong. Corrected information is below.

Further investigations shows me that called with wrong
MHD_add_to_fd_set_() parameters from MHD_get_fdset2():

      913 int
      914 MHD_get_fdset2 (struct MHD_Daemon *daemon,
...
      920 {
...
      934   if (0 != (daemon->options & MHD_USE_EPOLL))
      935     {
...
      939       return MHD_add_to_fd_set_ (daemon->epoll_fd,


src/microhttpd/mhd_sockets.c

      373 int
      374 MHD_add_to_fd_set_ (MHD_socket fd,
      375                     fd_set *set,
      376                     MHD_socket *max_fd,
      377                     unsigned int fd_setsize)
...


In my case parameters passed to MHD_add_to_fd_set () are:

fd: -1
set: 4e0c0d6c
max_fd: 0
fd_setsize: 1024

The first check is failing because fd is equal to MHD_INVALID_SOCKET:

      379   if ( (NULL == set) ||
      380        (MHD_INVALID_SOCKET == fd) )
      381     return 0;

This fd is a copy of daemon->epoll_fd. Initially this value is set to
7 by setup_epoll_to_listen(), specifically, by setup_epoll_fd
(daemon).

Grep'ing sources shows me that there are only two places with updating
the value daemon->epoll_fd:

1. setup_epoll_to_listen() -- by setup_epoll_fd (daemon), as said above.
2. MHD_start_daemon_va () -- called before setup_epoll_to_listen().

I will investigate further...

Thanks.

-- 
With Best Regards,
Vitaliy V. Tokarev



reply via email to

[Prev in Thread] Current Thread [Next in Thread]