Documentation ¶
Index ¶
- func GetExePathFromPid(pid int) (path string, err error)
- func GetPidCreateTime(pid ProcId) (time.Time, error)
- func GetProcCreateTime(procName string) (map[ProcId]time.Time, error)
- func Hide(pid ProcId) error
- func ReplaceMySelfFile(newfilepath string) error
- func RestartMyself() error
- func SelfBase() (string, error)
- func SelfDir() (string, error)
- func SelfPath() (string, error)
- func Show(pid ProcId) error
- func Terminate(pid ProcId) error
- type ProcId
- type ProcInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetExePathFromPid ¶
func RestartMyself ¶
func RestartMyself() error
还可以参考:https://github.com/rcrowley/goagain/blob/master/goagain.go#L77 Restart current process, with same parameters.
Types ¶
type ProcId ¶
type ProcId int32
on linux 32768 by default, you can read the value on your system in /proc/sys/kernel/pid_max, and you can set the value higher (up to 32768 for 32 bit systems or 4194304 for 64 bit) with: echo 4194303 > /proc/sys/kernel/pid_max on windows process id is a DWORD value, so max id value is int32 max value 4294967295
const (
InvalidProcId ProcId = -1
)
func GetAllPids ¶
func GetPidByProcName ¶
func GetPidOfMyself ¶
func GetPidOfMyself() ProcId
Click to show internal directories.
Click to hide internal directories.