Пример #1
0
func processes() ([]Process, error) {
	darwinLock.Lock()
	defer darwinLock.Unlock()
	darwinProcs = make([]Process, 0, 50)

	_, err := C.darwinProcesses()
	if err != nil {
		return nil, err
	}

	return darwinProcs, nil
}
Пример #2
0
// ProcessMap returns a map of processes for the main library package.
func ProcessMap() (map[int]*DarwinProcess, error) {
	darwinLock.Lock()
	defer darwinLock.Unlock()
	darwinProcsByPID = make(map[int]*DarwinProcess)

	// To ignore deadcode warnings for exported functions
	_ = goDarwinAppendProc
	_ = goDarwinSetPath

	// TODO: Investigate why darwinProcesses returns error even if process list
	// succeeds
	C.darwinProcesses()
	C.darwinProcessPaths()

	return darwinProcsByPID, nil
}