mirror of
				https://github.com/containers/podman.git
				synced 2025-10-31 18:08:51 +08:00 
			
		
		
		
	Bumps [github.com/containers/common](https://github.com/containers/common) from 0.6.1 to 0.8.0. - [Release notes](https://github.com/containers/common/releases) - [Commits](https://github.com/containers/common/compare/v0.6.1...v0.8.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
		
			
				
	
	
		
			28 lines
		
	
	
		
			539 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			539 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package cgroupv2
 | |
| 
 | |
| import (
 | |
| 	"sync"
 | |
| 	"syscall"
 | |
| 
 | |
| 	"golang.org/x/sys/unix"
 | |
| )
 | |
| 
 | |
| var (
 | |
| 	isCgroupV2Once sync.Once
 | |
| 	isCgroupV2     bool
 | |
| 	isCgroupV2Err  error
 | |
| )
 | |
| 
 | |
| // Enabled returns whether we are running in cgroup 2 cgroup2 mode.
 | |
| func Enabled() (bool, error) {
 | |
| 	isCgroupV2Once.Do(func() {
 | |
| 		var st syscall.Statfs_t
 | |
| 		if err := syscall.Statfs("/sys/fs/cgroup", &st); err != nil {
 | |
| 			isCgroupV2, isCgroupV2Err = false, err
 | |
| 		} else {
 | |
| 			isCgroupV2, isCgroupV2Err = st.Type == unix.CGROUP2_SUPER_MAGIC, nil
 | |
| 		}
 | |
| 	})
 | |
| 	return isCgroupV2, isCgroupV2Err
 | |
| }
 |