platform.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /* $Id: platform.h,v 1.10 2008/04/06 13:02:12 dijkstra Exp $ */
  2. #ifndef _CONF_LINUX_H
  3. #define _CONF_LINUX_H
  4. #include <stdint.h>
  5. #include <stdio.h>
  6. #include <grp.h>
  7. #include "queue.h"
  8. #include "sylimits.h"
  9. #define SYMON_USER "symon"
  10. #define SEM_ARGS (S_IWUSR|S_IRUSR|IPC_CREAT|IPC_EXCL)
  11. #define SA_LEN(x) (((x)->sa_family == AF_INET6) ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in))
  12. #define SS_LEN(x) (((x)->ss_family == AF_INET6) ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in))
  13. #define strlcpy(x,y,z) snprintf((x),(z),"%s", (y))
  14. union semun {
  15. int val;
  16. };
  17. #ifdef LONG_LONG_MAX
  18. #define QUAD_MAX LONG_LONG_MAX
  19. #endif
  20. #ifndef QUAD_MAX
  21. #define QUAD_MAX (0x7fffffffffffffffLL)
  22. #endif
  23. #define CPUSTATES 8
  24. #define CP_USER 0
  25. #define CP_NICE 1
  26. #define CP_SYS 2
  27. #define CP_IDLE 3
  28. #define CP_IOWAIT 4
  29. #define CP_HARDIRQ 5
  30. #define CP_SOFTIRQ 6
  31. #define CP_STEAL 7
  32. #define MAX_PATH_LEN 1024
  33. union stream_parg {
  34. struct {
  35. u_int64_t time[CPUSTATES];
  36. u_int64_t old[CPUSTATES];
  37. u_int64_t diff[CPUSTATES];
  38. u_int64_t states[CPUSTATES];
  39. char name[6];
  40. } cp;
  41. struct {
  42. u_int64_t time[CPUSTATES];
  43. u_int64_t old[CPUSTATES];
  44. u_int64_t diff[CPUSTATES];
  45. u_int64_t states[CPUSTATES];
  46. char name[6];
  47. } cpw;
  48. struct {
  49. char mountpath[MAX_PATH_LEN];
  50. } df;
  51. };
  52. #endif