private.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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_f *default_event_cb; // Default callback function
  9. faux_list_t *scheds; // List of registered sched events
  10. faux_sched_t *faux_sched; // Service shed structure
  11. faux_list_t *fds; // List of registered file descriptors
  12. faux_pollfd_t *pollfds; // Service object for ppoll()
  13. faux_list_t *signals; // List of registered signals
  14. sigset_t sig_set; // Set of registered signals (1 for interested signal)
  15. sigset_t sig_mask; // Mask of registered signals (0 - interested) = not sig_set
  16. #ifdef HAVE_SIGNALFD
  17. int signal_fd; // Handler for signalfd(). Valid when loop is active only
  18. #endif
  19. };
  20. typedef struct faux_eloop_context_s {
  21. faux_eloop_cb_f *event_cb;
  22. void *user_data;
  23. } faux_eloop_context_t;
  24. typedef struct faux_eloop_shed_s {
  25. int ev_id;
  26. faux_eloop_context_t context;
  27. } faux_eloop_sched_t;
  28. typedef struct faux_eloop_fd_s {
  29. int fd;
  30. short events;
  31. faux_eloop_context_t context;
  32. } faux_eloop_fd_t;
  33. typedef struct faux_eloop_signal_s {
  34. int signo;
  35. struct sigaction oldact;
  36. bool_t set;
  37. faux_eloop_context_t context;
  38. } faux_eloop_signal_t;