control.h 961 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // SPDX-License-Identifier: GPL-2.0 or GPL-3.0
  2. // Copyright © 2018-2019 Ariadne Devos
  3. /* shttpd - functions for control threads */
  4. #ifndef _sHT_CONTROL_H
  5. #define _sHT_CONTROL_H
  6. struct sHT_node
  7. {
  8. union {
  9. /* Only for killing misbehaving processes */
  10. int pid_err;
  11. /* Only for sHT_start_worker */
  12. int worker_fd_err;
  13. };
  14. /* Our end of it. A non-blocking SOCK_SEQPACKET, UNIX domain socket. */
  15. int controlfd;
  16. };
  17. /* errno values vary by architecture */
  18. enum sHT_node_errno
  19. {
  20. sHT_NODE_OTHER = 0,
  21. sHT_NODE_EINVAL,
  22. sHT_NODE_EMFILE,
  23. sHT_NODE_ENFILE,
  24. sHT_NODE_EAGAIN,
  25. sHT_NODE_ENOMEM,
  26. sHT_NODE_EPERM,
  27. };
  28. /* Possible error values:
  29. -EINVAL (bug)
  30. -EMFILE (process file descriptor limit)
  31. -ENFILE (process file descriptor limit)
  32. -EAGAIN (too many processes)
  33. -ENOMEM (lack of kernel memory)
  34. -EPERM (not allowed, configuration bug)
  35. Others that are not listed in the man pages
  36. */
  37. struct sHT_node
  38. sHT_start_worker(int workerfd);
  39. #endif