github.com/intel/goresctrl@v0.5.0/pkg/cgroups/cgroupid_linux.go (about)

     1  //go:build linux
     2  // +build linux
     3  
     4  package cgroups
     5  
     6  import (
     7  	"encoding/binary"
     8  	"golang.org/x/sys/unix"
     9  )
    10  
    11  func getID(path string) uint64 {
    12  	h, _, err := unix.NameToHandleAt(unix.AT_FDCWD, path, 0)
    13  	if err != nil {
    14  		return 0
    15  	}
    16  
    17  	return binary.LittleEndian.Uint64(h.Bytes())
    18  }