platform.h 2.0 KB

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