platform.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #ifndef _CONF_LINUX_H
  2. #define _CONF_LINUX_H
  3. #include <stdint.h>
  4. #include <stdio.h>
  5. #include <grp.h>
  6. #include "queue.h"
  7. #include "sylimits.h"
  8. #define SYMON_USER "symon"
  9. #define SEM_ARGS (S_IWUSR|S_IRUSR|IPC_CREAT|IPC_EXCL)
  10. #define SA_LEN(x) (((x)->sa_family == AF_INET6) ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in))
  11. #define SS_LEN(x) (((x)->ss_family == AF_INET6) ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in))
  12. #define strlcpy(x,y,z) snprintf((x),(z),"%s", (y))
  13. union semun {
  14. int val;
  15. };
  16. #ifdef LONG_LONG_MAX
  17. #define QUAD_MAX LONG_LONG_MAX
  18. #endif
  19. #ifndef QUAD_MAX
  20. #define QUAD_MAX (0x7fffffffffffffffLL)
  21. #endif
  22. #define CPUSTATES 8
  23. #define CP_USER 0
  24. #define CP_NICE 1
  25. #define CP_SYS 2
  26. #define CP_IDLE 3
  27. #define CP_IOWAIT 4
  28. #define CP_HARDIRQ 5
  29. #define CP_SOFTIRQ 6
  30. #define CP_STEAL 7
  31. #define MAX_PATH_LEN 1024
  32. #define DISK_BLOCK_LEN 512
  33. #define SENSOR_FAN 0
  34. #define SENSOR_IN 1
  35. #define SENSOR_TEMP 2
  36. union stream_parg {
  37. struct {
  38. int64_t time[CPUSTATES];
  39. int64_t old[CPUSTATES];
  40. int64_t diff[CPUSTATES];
  41. int64_t states[CPUSTATES];
  42. char name[6];
  43. } cp;
  44. struct {
  45. int64_t time[CPUSTATES];
  46. int64_t old[CPUSTATES];
  47. int64_t diff[CPUSTATES];
  48. int64_t states[CPUSTATES];
  49. char name[6];
  50. } cpw;
  51. struct {
  52. char mountpath[MAX_PATH_LEN];
  53. } df;
  54. struct {
  55. int type;
  56. char path[MAX_PATH_LEN];
  57. } sn;
  58. int smart;
  59. };
  60. #endif