Class: Einhorn::PrctlLinux
- Inherits:
-
PrctlAbstract
- Object
- PrctlAbstract
- Einhorn::PrctlLinux
- Defined in:
- lib/einhorn/prctl_linux.rb
Constant Summary collapse
- IntStruct =
Reading integers is hard with fiddle. :(
Fiddle::CStructBuilder.create(Fiddle::CStruct, [Fiddle::TYPE_INT], ["i"])
Class Method Summary collapse
Class Method Details
.get_pdeathsig ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/einhorn/prctl_linux.rb', line 20 def self.get_pdeathsig out = IntStruct.malloc out.i = 0 if PrctlRaw.prctl(PrctlRaw::GET_PDEATHSIG, out.to_i, 0, 0, 0) != 0 raise SystemCallError.new("get_pdeathsig", Fiddle.last_error) end signo = out.i if signo == 0 return nil end Signal.signame(signo) end |
.set_pdeathsig(signal) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/einhorn/prctl_linux.rb', line 35 def self.set_pdeathsig(signal) signo = if signal.nil? 0 elsif signal.instance_of?(String) Signal.list.fetch(signal) else signal end if PrctlRaw.prctl(PrctlRaw::SET_PDEATHSIG, signo, 0, 0, 0) != 0 raise SystemCallError.new("set_pdeathsig(#{signal})", Fiddle.last_error) end end |