diff --git a/proc/proc.go b/proc/proc.go index 8c2478fb..b6a76e1c 100644 --- a/proc/proc.go +++ b/proc/proc.go @@ -54,7 +54,6 @@ type Process struct { exited bool ptraceChan chan func() ptraceDoneChan chan interface{} - comm string } func New(pid int) *Process { diff --git a/proc/proc_linux.go b/proc/proc_linux.go index 6acd3c33..b2f99825 100644 --- a/proc/proc_linux.go +++ b/proc/proc_linux.go @@ -29,8 +29,9 @@ const ( STATUS_ZOMBIE = 'Z' ) -// Not actually needed for Linux. -type OSProcessDetails interface{} +type OSProcessDetails struct { + comm string +} // Create and begin debugging a new process. First entry in // `cmd` is the program to run, and then rest are the arguments @@ -321,7 +322,7 @@ func (dbp *Process) loadProcessInformation(wg *sync.WaitGroup) { } // removes newline character comm = comm[:len(comm)-1] - dbp.comm = strings.Replace(string(comm), "%", "%%", -1) + dbp.os.comm = strings.Replace(string(comm), "%", "%%", -1) } func status(pid int, comm string) rune { @@ -369,7 +370,7 @@ func (dbp *Process) wait(pid, options int) (int, *sys.WaitStatus, error) { if wpid != 0 { return wpid, &s, err } - if status(pid, dbp.comm) == STATUS_ZOMBIE { + if status(pid, dbp.os.comm) == STATUS_ZOMBIE { return pid, nil, nil } time.Sleep(200 * time.Millisecond) diff --git a/proc/threads_linux.go b/proc/threads_linux.go index d89b22d0..800601da 100644 --- a/proc/threads_linux.go +++ b/proc/threads_linux.go @@ -27,7 +27,7 @@ func (t *Thread) halt() (err error) { } func (thread *Thread) stopped() bool { - state := status(thread.Id, thread.dbp.comm) + state := status(thread.Id, thread.dbp.os.comm) return state == STATUS_TRACE_STOP }