Platform.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #ifndef HEADER_Platform
  2. #define HEADER_Platform
  3. /*
  4. htop - unsupported/Platform.h
  5. (C) 2014 Hisham H. Muhammad
  6. (C) 2015 David C. Hunt
  7. Released under the GNU GPLv2+, see the COPYING file
  8. in the source distribution for its full text.
  9. */
  10. #include <stdbool.h>
  11. #include <sys/types.h>
  12. #include "Action.h"
  13. #include "BatteryMeter.h"
  14. #include "DiskIOMeter.h"
  15. #include "Hashtable.h"
  16. #include "NetworkIOMeter.h"
  17. #include "ProcessLocksScreen.h"
  18. #include "SignalsPanel.h"
  19. #include "CommandLine.h"
  20. #include "generic/gettime.h"
  21. #include "unsupported/UnsupportedProcess.h"
  22. extern const ScreenDefaults Platform_defaultScreens[];
  23. extern const unsigned int Platform_numberOfDefaultScreens;
  24. extern const SignalItem Platform_signals[];
  25. extern const unsigned int Platform_numberOfSignals;
  26. extern const MeterClass* const Platform_meterTypes[];
  27. bool Platform_init(void);
  28. void Platform_done(void);
  29. void Platform_setBindings(Htop_Action* keys);
  30. int Platform_getUptime(void);
  31. void Platform_getLoadAverage(double* one, double* five, double* fifteen);
  32. pid_t Platform_getMaxPid(void);
  33. double Platform_setCPUValues(Meter* this, unsigned int cpu);
  34. void Platform_setMemoryValues(Meter* this);
  35. void Platform_setSwapValues(Meter* this);
  36. char* Platform_getProcessEnv(pid_t pid);
  37. FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid);
  38. void Platform_getFileDescriptors(double* used, double* max);
  39. bool Platform_getDiskIO(DiskIOData* data);
  40. bool Platform_getNetworkIO(NetworkIOData* data);
  41. void Platform_getBattery(double* percent, ACPresence* isOnAC);
  42. void Platform_getHostname(char* buffer, size_t size);
  43. void Platform_getRelease(char** string);
  44. #define PLATFORM_LONG_OPTIONS
  45. static inline void Platform_longOptionsUsage(ATTR_UNUSED const char* name) { }
  46. static inline CommandLineStatus Platform_getLongOption(ATTR_UNUSED int opt, ATTR_UNUSED int argc, ATTR_UNUSED char** argv) {
  47. return STATUS_ERROR_EXIT;
  48. }
  49. static inline void Platform_gettime_realtime(struct timeval* tv, uint64_t* msec) {
  50. Generic_gettime_realtime(tv, msec);
  51. }
  52. static inline void Platform_gettime_monotonic(uint64_t* msec) {
  53. Generic_gettime_monotonic(msec);
  54. }
  55. static inline Hashtable* Platform_dynamicMeters(void) {
  56. return NULL;
  57. }
  58. static inline void Platform_dynamicMetersDone(ATTR_UNUSED Hashtable* table) { }
  59. static inline void Platform_dynamicMeterInit(ATTR_UNUSED Meter* meter) { }
  60. static inline void Platform_dynamicMeterUpdateValues(ATTR_UNUSED Meter* meter) { }
  61. static inline void Platform_dynamicMeterDisplay(ATTR_UNUSED const Meter* meter, ATTR_UNUSED RichString* out) { }
  62. static inline Hashtable* Platform_dynamicColumns(void) {
  63. return NULL;
  64. }
  65. static inline void Platform_dynamicColumnsDone(ATTR_UNUSED Hashtable* table) { }
  66. static inline const char* Platform_dynamicColumnName(ATTR_UNUSED unsigned int key) {
  67. return NULL;
  68. }
  69. static inline bool Platform_dynamicColumnWriteField(ATTR_UNUSED const Process* proc, ATTR_UNUSED RichString* str, ATTR_UNUSED unsigned int key) {
  70. return false;
  71. }
  72. static inline Hashtable* Platform_dynamicScreens(void) {
  73. return NULL;
  74. }
  75. static inline void Platform_defaultDynamicScreens(ATTR_UNUSED Settings* settings) { }
  76. static inline void Platform_addDynamicScreen(ATTR_UNUSED ScreenSettings* ss) { }
  77. static inline void Platform_addDynamicScreenAvailableColumns(ATTR_UNUSED Panel* availableColumns, ATTR_UNUSED const char* screen) { }
  78. static inline void Platform_dynamicScreensDone(ATTR_UNUSED Hashtable* screens) { }
  79. #endif