DarwinProcess.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef HEADER_DarwinProcess
  2. #define HEADER_DarwinProcess
  3. /*
  4. htop - DarwinProcess.h
  5. (C) 2015 Hisham H. Muhammad
  6. Released under the GNU GPLv2+, see the COPYING file
  7. in the source distribution for its full text.
  8. */
  9. #include <sys/sysctl.h>
  10. #include "Machine.h"
  11. #include "darwin/DarwinProcessTable.h"
  12. #define PROCESS_FLAG_TTY 0x00000100
  13. typedef struct DarwinProcess_ {
  14. Process super;
  15. uint64_t utime;
  16. uint64_t stime;
  17. bool taskAccess;
  18. bool translated;
  19. } DarwinProcess;
  20. extern const ProcessClass DarwinProcess_class;
  21. extern const ProcessFieldData Process_fields[LAST_PROCESSFIELD];
  22. Process* DarwinProcess_new(const Machine* settings);
  23. void Process_delete(Object* cast);
  24. void DarwinProcess_setFromKInfoProc(Process* proc, const struct kinfo_proc* ps, bool exists);
  25. void DarwinProcess_setFromLibprocPidinfo(DarwinProcess* proc, DarwinProcessTable* dpt, double timeIntervalNS);
  26. /*
  27. * Scan threads for process state information.
  28. * Based on: http://stackoverflow.com/questions/6788274/ios-mac-cpu-usage-for-thread
  29. * and https://github.com/max-horvath/htop-osx/blob/e86692e869e30b0bc7264b3675d2a4014866ef46/ProcessList.c
  30. */
  31. void DarwinProcess_scanThreads(DarwinProcess* dp, DarwinProcessTable* dpt);
  32. #endif