private.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include "faux/faux.h"
  2. #include "faux/list.h"
  3. #include "faux/net.h"
  4. #include "faux/vec.h"
  5. #include "faux/sched.h"
  6. struct faux_eloop_s {
  7. bool_t working; // Is event loop active now. Can detect nested loop.
  8. faux_eloop_cb_fn default_event_cb; // Default callback function
  9. faux_sched_t *sched; // Service shed structure
  10. faux_list_t *fds; // List of registered file descriptors
  11. faux_pollfd_t *pollfds; // Service object for ppoll()
  12. faux_list_t *signals; // List of registered signals
  13. sigset_t sig_set; // Set of registered signals (1 for interested signal)
  14. sigset_t sig_mask; // Mask of registered signals (0 - interested) = not sig_set
  15. #ifdef HAVE_SIGNALFD
  16. int signal_fd; // Handler for signalfd(). Valid when loop is active only
  17. #endif
  18. };
  19. typedef struct faux_eloop_context_s {
  20. faux_eloop_cb_fn event_cb;
  21. void *user_data;
  22. } faux_eloop_context_t;
  23. typedef struct faux_eloop_fd_s {
  24. int fd;
  25. short events;
  26. faux_eloop_context_t context;
  27. } faux_eloop_fd_t;
  28. typedef struct faux_eloop_signal_s {
  29. int signo;
  30. struct sigaction oldact;
  31. faux_eloop_context_t context;
  32. } faux_eloop_signal_t;