UnsupportedMachine.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. htop - UnsupportedMachine.c
  3. (C) 2014 Hisham H. Muhammad
  4. Released under the GNU GPLv2+, see the COPYING file
  5. in the source distribution for its full text.
  6. */
  7. #include "UnsupportedMachine.h"
  8. #include <stdlib.h>
  9. #include <string.h>
  10. #include "Machine.h"
  11. Machine* Machine_new(UsersTable* usersTable, uid_t userId) {
  12. UnsupportedMachine* this = xCalloc(1, sizeof(UnsupportedMachine));
  13. Machine* super = &this->super;
  14. Machine_init(super, usersTable, userId);
  15. super->existingCPUs = 1;
  16. super->activeCPUs = 1;
  17. return super;
  18. }
  19. void Machine_delete(Machine* super) {
  20. UnsupportedMachine* this = (UnsupportedMachine*) super;
  21. Machine_done(super);
  22. free(this);
  23. }
  24. bool Machine_isCPUonline(const Machine* host, unsigned int id) {
  25. assert(id < host->existingCPUs);
  26. (void) host; (void) id;
  27. return true;
  28. }
  29. void Machine_scan(Machine* super) {
  30. super->existingCPUs = 1;
  31. super->activeCPUs = 1;
  32. super->totalMem = 0;
  33. super->usedMem = 0;
  34. super->buffersMem = 0;
  35. super->cachedMem = 0;
  36. super->sharedMem = 0;
  37. super->availableMem = 0;
  38. super->totalSwap = 0;
  39. super->usedSwap = 0;
  40. super->cachedSwap = 0;
  41. }