Module: BSD::Capsicum::FFI::Private
Instance Method Summary collapse
-
#cap_lookup(capabilities, allowed) ⇒ Array<Integer>
private
Returns a list of capabilities (as integers).
-
#cap_all ⇒ Array<Symbol>
private
Returns all known capabilities.
-
#cap_fcntls ⇒ Array<Symbol>
private
Returns all known fcntl capabilities.
Instance Method Details
#cap_lookup(capabilities, allowed) ⇒ Array<Integer>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a list of capabilities (as integers)
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/bsd/capsicum/ffi.rb', line 82 def cap_lookup(capabilities, allowed) capabilities.flat_map do |cap| if Integer === cap cap elsif allowed.include?(cap) FFI.const_get(cap) elsif allowed.include?(:"CAP_#{cap.upcase}") FFI.const_get(:"CAP_#{cap.upcase}") elsif allowed.include?(:"CAP_FCNTL_#{cap.upcase}") FFI.const_get(:"CAP_FCNTL_#{cap.upcase}") else raise TypeError, "unknown capability: #{cap}" end end end |
#cap_all ⇒ Array<Symbol>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns all known capabilities
102 103 104 |
# File 'lib/bsd/capsicum/ffi.rb', line 102 def cap_all @cap_all ||= Constants.constants.select { _1.to_s.start_with?("CAP_") } end |
#cap_fcntls ⇒ Array<Symbol>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns all known fcntl capabilities
110 111 112 |
# File 'lib/bsd/capsicum/ffi.rb', line 110 def cap_fcntls @cap_fcntls ||= Constants.constants.select { _1.to_s.start_with?("CAP_FCNTL_") } end |