c_helpers.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef C_HELPERS_H
  2. #define C_HELPERS_H
  3. #include <sys/types.h>
  4. #include <sys/mntctl.h>
  5. #include <sys/vmount.h>
  6. #include <sys/statfs.h>
  7. #include <libperfstat.h>
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10. #include <string.h>
  11. #include <utmpx.h>
  12. #define GETFUNC(TYPE) perfstat_##TYPE##_t *get_##TYPE##_stat(perfstat_##TYPE##_t *b, int n) { \
  13. if (!b) return NULL; \
  14. return &(b[n]); \
  15. }
  16. #define GETFUNC_EXT(TYPE) extern perfstat_##TYPE##_t *get_##TYPE##_stat(perfstat_##TYPE##_t *, int);
  17. GETFUNC_EXT(cpu)
  18. GETFUNC_EXT(disk)
  19. GETFUNC_EXT(diskadapter)
  20. GETFUNC_EXT(diskpath)
  21. GETFUNC_EXT(fcstat)
  22. GETFUNC_EXT(logicalvolume)
  23. GETFUNC_EXT(memory_page)
  24. GETFUNC_EXT(netadapter)
  25. GETFUNC_EXT(netbuffer)
  26. GETFUNC_EXT(netinterface)
  27. GETFUNC_EXT(pagingspace)
  28. GETFUNC_EXT(process)
  29. GETFUNC_EXT(thread)
  30. GETFUNC_EXT(volumegroup)
  31. struct fsinfo {
  32. char *devname;
  33. char *fsname;
  34. int flags;
  35. int fstype;
  36. unsigned long totalblks;
  37. unsigned long freeblks;
  38. unsigned long totalinodes;
  39. unsigned long freeinodes;
  40. };
  41. extern double get_partition_mhz(perfstat_partition_config_t);
  42. extern char *get_ps_hostname(perfstat_pagingspace_t *);
  43. extern char *get_ps_filename(perfstat_pagingspace_t *);
  44. extern char *get_ps_vgname(perfstat_pagingspace_t *);
  45. extern time_t boottime();
  46. struct fsinfo *get_filesystem_stat(struct fsinfo *, int);
  47. int get_mounts(struct vmount **);
  48. void fill_statfs(struct statfs, struct fsinfo *);
  49. int getfsinfo(char *, char *, char *, char *, int, int, struct fsinfo *);
  50. struct fsinfo *get_all_fs(int *);
  51. #endif