process_bsd.go 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //go:build darwin || freebsd || openbsd
  2. // +build darwin freebsd openbsd
  3. package process
  4. import (
  5. "bytes"
  6. "context"
  7. "encoding/binary"
  8. "github.com/shirou/gopsutil/v3/cpu"
  9. "github.com/shirou/gopsutil/v3/internal/common"
  10. )
  11. type MemoryInfoExStat struct{}
  12. type MemoryMapsStat struct{}
  13. func (p *Process) TgidWithContext(ctx context.Context) (int32, error) {
  14. return 0, common.ErrNotImplementedError
  15. }
  16. func (p *Process) IOniceWithContext(ctx context.Context) (int32, error) {
  17. return 0, common.ErrNotImplementedError
  18. }
  19. func (p *Process) RlimitWithContext(ctx context.Context) ([]RlimitStat, error) {
  20. return nil, common.ErrNotImplementedError
  21. }
  22. func (p *Process) RlimitUsageWithContext(ctx context.Context, gatherUsed bool) ([]RlimitStat, error) {
  23. return nil, common.ErrNotImplementedError
  24. }
  25. func (p *Process) NumCtxSwitchesWithContext(ctx context.Context) (*NumCtxSwitchesStat, error) {
  26. return nil, common.ErrNotImplementedError
  27. }
  28. func (p *Process) NumFDsWithContext(ctx context.Context) (int32, error) {
  29. return 0, common.ErrNotImplementedError
  30. }
  31. func (p *Process) CPUAffinityWithContext(ctx context.Context) ([]int32, error) {
  32. return nil, common.ErrNotImplementedError
  33. }
  34. func (p *Process) MemoryInfoExWithContext(ctx context.Context) (*MemoryInfoExStat, error) {
  35. return nil, common.ErrNotImplementedError
  36. }
  37. func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, error) {
  38. return nil, common.ErrNotImplementedError
  39. }
  40. func (p *Process) OpenFilesWithContext(ctx context.Context) ([]OpenFilesStat, error) {
  41. return nil, common.ErrNotImplementedError
  42. }
  43. func (p *Process) MemoryMapsWithContext(ctx context.Context, grouped bool) (*[]MemoryMapsStat, error) {
  44. return nil, common.ErrNotImplementedError
  45. }
  46. func (p *Process) ThreadsWithContext(ctx context.Context) (map[int32]*cpu.TimesStat, error) {
  47. return nil, common.ErrNotImplementedError
  48. }
  49. func (p *Process) EnvironWithContext(ctx context.Context) ([]string, error) {
  50. return nil, common.ErrNotImplementedError
  51. }
  52. func parseKinfoProc(buf []byte) (KinfoProc, error) {
  53. var k KinfoProc
  54. br := bytes.NewReader(buf)
  55. err := common.Read(br, binary.LittleEndian, &k)
  56. return k, err
  57. }