Class: Kamisama::ProcessCtrl
- Inherits:
-
Object
- Object
- Kamisama::ProcessCtrl
- Defined in:
- lib/kamisama/process_ctrl.rb
Defined Under Namespace
Modules: LibC
Constant Summary collapse
- SIGINT =
2
- SIGTERM =
15
Class Method Summary collapse
Class Method Details
.set_parent_death_signal(signal) ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/kamisama/process_ctrl.rb', line 25 def self.set_parent_death_signal(signal) case signal when :sigint LibC.prctl(LibC::PR_SET_PDEATHSIG, SIGINT, 0, 0, 0) when :sigterm LibC.prctl(LibC::PR_SET_PDEATHSIG, SIGTERM, 0, 0, 0) else raise "Unrecognized signal '#{signal.inspect}'" end end |
.set_process_name(process_name) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/kamisama/process_ctrl.rb', line 17 def self.set_process_name(process_name) # The process name is max 16 characters, so get the first 16, and if it is # less pad with spaces to avoid formatting wierdness process_name = "%-16.16s" % name LibC.prctl(LibC::PR_SET_NAME, process_name, 0, 0, 0) end |