Module: Cap2

Defined in:
lib/cap2.rb,
lib/cap2/file.rb,
lib/cap2/process.rb,
lib/cap2/version.rb,
ext/cap2/cap2.c

Overview

Cap2 is a module for querying the POSIX 1003.1e capabilities available in Linux kernels. These capabilities are a partitioning of the all powerful root privilege into a set of distinct privileges.

For more information see capabilities(7).

Defined Under Namespace

Classes: File, FileNotFound, Process, ProcessNotFound

Constant Summary collapse

Version =
'0.2.2'

Class Method Summary collapse

Class Method Details

.allcapsObject



82
83
84
85
86
87
88
89
90
91
92
# File 'ext/cap2/cap2.c', line 82

VALUE cap2_allcaps(VALUE self) {
  int i;
  VALUE caps;

  caps = rb_ary_new();

  for(i = 0; i < __CAP_COUNT; i++)
    rb_ary_push(caps, ID2SYM(rb_intern(cap2_caps[i].name)));

  return caps;
}

.file(filename) ⇒ Object

Returns a Cap2::File initialized with the given filename



23
24
25
26
27
# File 'lib/cap2.rb', line 23

def file(filename)
  check_file! filename

  File.new(filename)
end

.process(pid = ::Process.pid) ⇒ Object

Returns a Cap2::Process initialized with the given pid, defaulting to the current pid.



16
17
18
19
20
# File 'lib/cap2.rb', line 16

def process(pid = ::Process.pid)
  check_pid! pid

  Process.new(pid)
end