Module: OsCtl::Lib::CGroup

Defined in:
lib/libosctl/cgroup.rb

Defined Under Namespace

Classes: PathReader

Constant Summary collapse

FS =
'/sys/fs/cgroup'.freeze

Class Method Summary collapse

Class Method Details

.v1?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/libosctl/cgroup.rb', line 18

def self.v1?
  version == 1
end

.v2?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/libosctl/cgroup.rb', line 22

def self.v2?
  version == 2
end

.version1, 2

Returns cgroup hierarchy version.

Returns:

  • (1, 2)

    cgroup hierarchy version



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/libosctl/cgroup.rb', line 6

def self.version
  return @version if @version

  @version = if File.exist?(File.join(FS, 'cgroup.procs'))
               2
             else
               1
             end

  @version
end