You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef UTIL_H
  2. #define UTIL_H
  3. #include <sys/types.h>
  4. #include <sys/types.h>
  5. #include <sys/socket.h>
  6. #include <sys/queue.h>
  7. #include <sys/time.h>
  8. #include <sys/un.h>
  9. #include <netinet/in.h>
  10. #include <arpa/inet.h>
  11. #include <signal.h>
  12. #include "main.h"
  13. struct config_file;
  14. /* Create socket and bind it to specified address and port */
  15. int make_socket(const char *, u_short );
  16. /* Create and bind unix socket */
  17. int make_unix_socket (const char *, struct sockaddr_un *);
  18. /* Parse command line arguments using getopt (3) */
  19. void read_cmd_line (int , char **, struct config_file *);
  20. /* Write pid to file */
  21. int write_pid (struct rspamd_main *);
  22. /* Make specified socket non-blocking */
  23. int event_make_socket_nonblocking(int);
  24. /* Init signals */
  25. void init_signals (struct sigaction *, sig_t);
  26. /* Send specified signal to each worker */
  27. void pass_signal_worker (struct workq *, int );
  28. /* Convert string to lowercase */
  29. void convert_to_lowercase (char *str, unsigned int size);
  30. #ifndef HAVE_SETPROCTITLE
  31. int init_title(int argc, char *argv[], char *envp[]);
  32. int setproctitle(const char *fmt, ...);
  33. #endif
  34. #ifndef HAVE_PIDFILE
  35. struct pidfh {
  36. int pf_fd;
  37. char pf_path[MAXPATHLEN + 1];
  38. __dev_t pf_dev;
  39. ino_t pf_ino;
  40. };
  41. struct pidfh *pidfile_open(const char *path, mode_t mode, pid_t *pidptr);
  42. int pidfile_write(struct pidfh *pfh);
  43. int pidfile_close(struct pidfh *pfh);
  44. int pidfile_remove(struct pidfh *pfh);
  45. #endif
  46. int open_log (struct config_file *cfg);
  47. int reopen_log (struct config_file *cfg);
  48. void syslog_log_function (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer arg);
  49. void file_log_function (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer arg);
  50. #endif