osutil.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * category: [misc]
  3. * apply status:
  4. * edit status:
  5. * build status:
  6. * description:
  7. */
  8. #ifndef __OSUTIL_H__
  9. #define __OSUTIL_H__
  10. #pragma once
  11. #include "config.h"
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #define MAX_ALIVE_PROCESS_COUNT 100
  16. #define ALIVE_PROCESS_PATH_LEN 512
  17. typedef struct t_process_info
  18. {
  19. int pid;
  20. char name[64];
  21. char path[ALIVE_PROCESS_PATH_LEN]; //or cmd
  22. } alive_process_info;
  23. typedef struct toolkit_utsname_s
  24. {
  25. char sysname[256];
  26. char release[256];
  27. char version[256];
  28. char machine[256];
  29. /* This struct does not contain the nodename and domainname fields present in
  30. the utsname type. domainname is a GNU extension. Both fields are referred
  31. to as meaningless in the docs. */
  32. }tk_utsname_t;
  33. // non-zero: unique
  34. // zero: has clone
  35. TOOLKIT_API int osutil_detect_unique_app(char **pNames, int nNum, int* alive, alive_process_info* alive_process_arr);
  36. TOOLKIT_API int osutil_restart_system();
  37. TOOLKIT_API int osutil_shutdown_system();
  38. //force: which is only available at UOS, non-zero meaning kill -9 otherwise -15
  39. TOOLKIT_API void osutil_terminate_related_process(char** process_array, const int array_size, int force);
  40. TOOLKIT_API int osutil_uname(tk_utsname_t* buffer);
  41. #ifdef __cplusplus
  42. } // extern "C" {
  43. #endif
  44. #endif //__OSUTIL_H__