Closed gfrey closed 7 years ago
This looks pretty good, but we'd like to try to not introduce a cgo requirement for any OS on this library. It looks like the code though could probably be structured a lot like the FreeBSD one by recreating the psinfo struct in Go and loading it there. Would you be open to that?
I tried to do so, but failed. Problem seems to be, that the /proc/<pid>/psinfo
file has 336 bytes (reported by ls and when reading with python and c). But whenever I read that file with golang, I get 416 bytes. Pretty clueless at the moment.
Well, the solution is that whatever I did to evaluate the size of the /proc/<pid>/psinfo
file, I did it with 32bit binaries. From man -s4 proc
:
The format of the contents of any /proc file depends on the data model of the observer (the controlling process), not on the data model of the target process.
Now without the cgo dependency.
@mitchellh This LGTM and seems to work correctly on Illumos - merging will help port Nomad to Illumos.
@jen20 Sounds good, I just needed a verification + the removal of cgo. Both appear to now exist. :)
As solaris has a
/proc
this is pretty similar to linux. Restructured the code a little, so that only UnixProcess' Refresh method had to be implemented.The assumption is that
Executable()
returns only the name of the binary started. On solaris this is truncated to 16 characters.