process_bsd.go 2.4 KB

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