proc-wait3 1.9.0 → 1.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGES.md +10 -0
- data/Gemfile +2 -7
- data/MANIFEST.md +1 -1
- data/README.md +38 -4
- data/Rakefile +7 -4
- data/doc/wait3.md +225 -0
- data/examples/example_getrusage.rb +5 -3
- data/examples/example_pause.rb +8 -6
- data/examples/example_wait3.rb +5 -2
- data/examples/example_wait4.rb +5 -2
- data/examples/example_waitid.rb +5 -2
- data/ext/extconf.rb +8 -16
- data/ext/proc/wait3.c +51 -39
- data/lib/proc-wait3.rb +2 -0
- data/proc-wait3.gemspec +12 -8
- data/spec/proc_wait3_spec.rb +107 -91
- data.tar.gz.sig +0 -0
- metadata +35 -5
- metadata.gz.sig +0 -0
- data/doc/wait3.txt +0 -192
data/proc-wait3.gemspec
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = 'proc-wait3'
|
5
|
-
spec.version = '1.9.
|
5
|
+
spec.version = '1.9.2'
|
6
6
|
spec.author = 'Daniel J. Berger'
|
7
7
|
spec.license = 'Apache-2.0'
|
8
8
|
spec.email = 'djberg96@gmail.com'
|
@@ -10,19 +10,23 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.summary = 'Adds wait3, wait4 and other methods to the Process module'
|
11
11
|
spec.test_file = 'spec/proc_wait3_spec.rb'
|
12
12
|
spec.extensions = ['ext/extconf.rb']
|
13
|
-
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
13
|
+
spec.files = Dir['**/*'].reject { |f| f.include?('git') }
|
14
14
|
spec.cert_chain = Dir['certs/*']
|
15
15
|
|
16
16
|
spec.add_development_dependency('rake')
|
17
17
|
spec.add_development_dependency('rspec', '~> 3.9')
|
18
|
+
spec.add_development_dependency('rubocop')
|
19
|
+
spec.add_development_dependency('rubocop-rspec')
|
18
20
|
|
19
21
|
spec.metadata = {
|
20
|
-
'homepage_uri'
|
21
|
-
'bug_tracker_uri'
|
22
|
-
'changelog_uri'
|
23
|
-
'documentation_uri'
|
24
|
-
'source_code_uri'
|
25
|
-
'wiki_uri'
|
22
|
+
'homepage_uri' => 'https://github.com/djberg96/proc-wait3',
|
23
|
+
'bug_tracker_uri' => 'https://github.com/djberg96/proc-wait3/issues',
|
24
|
+
'changelog_uri' => 'https://github.com/djberg96/proc-wait3/blob/main/CHANGES.md',
|
25
|
+
'documentation_uri' => 'https://github.com/djberg96/proc-wait3/wiki',
|
26
|
+
'source_code_uri' => 'https://github.com/djberg96/proc-wait3',
|
27
|
+
'wiki_uri' => 'https://github.com/djberg96/proc-wait3/wiki',
|
28
|
+
'rubygems_mfa_required' => 'true',
|
29
|
+
'github_repo' => 'https://github.com/djberg96/proc-wait3'
|
26
30
|
}
|
27
31
|
|
28
32
|
spec.description = <<-EOF
|
data/spec/proc_wait3_spec.rb
CHANGED
@@ -1,19 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#######################################################################
|
2
4
|
# proc_wait3_spec.rb
|
3
5
|
#
|
4
6
|
# Test suite for the Ruby proc-wait3 library. You should run these
|
5
7
|
# via the 'rake spec' task.
|
6
8
|
#######################################################################
|
9
|
+
require 'English'
|
7
10
|
require 'proc/wait3'
|
8
11
|
require 'rspec'
|
9
12
|
require 'rbconfig'
|
10
13
|
|
11
14
|
RSpec.describe Process do
|
15
|
+
# Something in the guts of Ruby was being a pain.
|
16
|
+
Signal.trap('CHLD', 'IGNORE') if RUBY_VERSION.to_f < 3
|
17
|
+
|
12
18
|
let(:solaris) { RbConfig::CONFIG['host_os'] =~ /sunos|solaris/i }
|
13
19
|
let(:darwin) { RbConfig::CONFIG['host_os'] =~ /darwin|osx/i }
|
14
20
|
let(:hpux) { RbConfig::CONFIG['host_os'] =~ /hpux/i }
|
15
21
|
let(:linux) { RbConfig::CONFIG['host_os'] =~ /linux/i }
|
16
|
-
let(:
|
22
|
+
let(:bsd) { RbConfig::CONFIG['host_os'] =~ /bsd|dragonfly/i }
|
17
23
|
|
18
24
|
let(:proc_stat_members) {
|
19
25
|
%i[
|
@@ -25,181 +31,182 @@ RSpec.describe Process do
|
|
25
31
|
|
26
32
|
before do
|
27
33
|
@proc_stat = nil
|
34
|
+
@pid = nil
|
28
35
|
end
|
29
36
|
|
30
|
-
example
|
31
|
-
expect(Process::WAIT3_VERSION).to eq('1.9.
|
37
|
+
example 'version constant is set to expected value' do
|
38
|
+
expect(Process::WAIT3_VERSION).to eq('1.9.2')
|
32
39
|
expect(Process::WAIT3_VERSION).to be_frozen
|
33
40
|
end
|
34
41
|
|
35
|
-
example
|
36
|
-
expect(
|
42
|
+
example 'wait3 method is defined' do
|
43
|
+
expect(described_class).to respond_to(:wait3)
|
37
44
|
end
|
38
45
|
|
39
|
-
example
|
46
|
+
example 'wait3 works as expected' do
|
40
47
|
skip 'wait3 test skipped on this platform' if darwin
|
41
|
-
fork{ sleep 0.5 }
|
42
|
-
expect{
|
48
|
+
@pid = fork { sleep 0.5 }
|
49
|
+
expect { described_class.wait3 }.not_to raise_error
|
43
50
|
end
|
44
51
|
|
45
|
-
example
|
52
|
+
example 'wait3 returns the expected proc status members' do
|
46
53
|
skip 'wait3 test skipped on this platform' if darwin
|
47
|
-
fork{ sleep 0.5 }
|
48
|
-
expect{ @proc_stat =
|
49
|
-
expect(
|
54
|
+
@pid = fork { sleep 0.5 }
|
55
|
+
expect { @proc_stat = described_class.wait3 }.not_to raise_error
|
56
|
+
expect(@proc_stat.members).to eq(proc_stat_members)
|
50
57
|
end
|
51
58
|
|
52
|
-
example
|
53
|
-
fork{ sleep 0.5 }
|
54
|
-
expect{
|
59
|
+
example 'wait3 with WNOHANG works as expected' do
|
60
|
+
@pid = fork { sleep 0.5 }
|
61
|
+
expect { described_class.wait3(Process::WNOHANG) }.not_to raise_error
|
55
62
|
end
|
56
63
|
|
57
|
-
example
|
64
|
+
example 'wait3 sets and returns $last_status to expected values' do
|
58
65
|
skip 'wait3 test skipped on this platform' if darwin
|
59
|
-
fork{ sleep 0.5 }
|
60
|
-
|
61
|
-
expect($last_status).to
|
66
|
+
@pid = fork { sleep 0.5 }
|
67
|
+
described_class.wait3
|
68
|
+
expect($last_status).to be_a(Struct::ProcStat)
|
62
69
|
expect($last_status).not_to be_nil
|
63
70
|
end
|
64
71
|
|
65
|
-
example
|
72
|
+
example 'wait3 sets pid and status members of $?' do
|
66
73
|
skip 'wait3 test skipped on this platform' if darwin
|
67
|
-
fork{ sleep 0.5 }
|
68
|
-
|
69
|
-
expect(
|
74
|
+
@pid = fork { sleep 0.5 }
|
75
|
+
described_class.wait3
|
76
|
+
expect($CHILD_STATUS).not_to be_nil
|
70
77
|
end
|
71
78
|
|
72
|
-
example
|
79
|
+
example 'wait3 returns frozen struct' do
|
73
80
|
skip 'wait3 test skipped on this platform' if darwin
|
74
|
-
fork{ sleep 0.5 }
|
75
|
-
struct =
|
81
|
+
@pid = fork { sleep 0.5 }
|
82
|
+
struct = described_class.wait3
|
76
83
|
expect(struct).to be_frozen
|
77
84
|
end
|
78
85
|
|
79
|
-
example
|
86
|
+
example 'getdtablesize works as expected' do
|
80
87
|
skip 'getdtablesize skipped on this platform' unless solaris
|
81
88
|
|
82
|
-
expect(
|
83
|
-
expect(
|
84
|
-
assert(
|
89
|
+
expect(described_class).to respond_to(:getdtablesize)
|
90
|
+
expect(described_class.getdtablesize).to be_a(Integer)
|
91
|
+
assert(described_class.getdtablesize > 0)
|
85
92
|
end
|
86
93
|
|
87
|
-
example
|
94
|
+
example 'wait4 method is defined' do
|
88
95
|
skip 'wait4 test skipped on this platform' if hpux
|
89
|
-
expect(
|
96
|
+
expect(described_class).to respond_to(:wait4)
|
90
97
|
end
|
91
98
|
|
92
|
-
example
|
99
|
+
example 'wait4 requires at least one argument' do
|
93
100
|
skip 'wait4 test skipped on this platform' if hpux
|
94
|
-
expect{
|
101
|
+
expect { described_class.wait4 }.to raise_error(ArgumentError)
|
95
102
|
end
|
96
103
|
|
97
|
-
example
|
104
|
+
example 'wait4 works as expected' do
|
98
105
|
skip 'wait4 test skipped on this platform' if hpux || darwin
|
99
106
|
|
100
|
-
pid = fork{ sleep 0.5 }
|
101
|
-
expect{ @proc_stat =
|
102
|
-
expect(@proc_stat).to
|
107
|
+
@pid = fork { sleep 0.5 }
|
108
|
+
expect { @proc_stat = described_class.wait4(@pid) }.not_to raise_error
|
109
|
+
expect(@proc_stat).to be_a(Struct::ProcStat)
|
103
110
|
end
|
104
111
|
|
105
|
-
example
|
112
|
+
example 'wait4 sets and returns $last_status to expected values' do
|
106
113
|
skip 'wait4 test skipped on this platform' if hpux || darwin
|
107
114
|
|
108
|
-
pid = fork{ sleep 0.5 }
|
109
|
-
|
110
|
-
expect($last_status).to
|
115
|
+
@pid = fork { sleep 0.5 }
|
116
|
+
described_class.wait4(@pid)
|
117
|
+
expect($last_status).to be_a(Struct::ProcStat)
|
111
118
|
expect($last_status).not_to be_nil
|
112
119
|
end
|
113
120
|
|
114
|
-
example
|
121
|
+
example 'wait4 sets pid and status members of $?' do
|
115
122
|
skip 'wait4 test skipped on this platform' if hpux || darwin
|
116
123
|
|
117
|
-
pid = fork{ sleep 0.5 }
|
118
|
-
|
119
|
-
expect(
|
124
|
+
@pid = fork { sleep 0.5 }
|
125
|
+
described_class.wait4(@pid)
|
126
|
+
expect($CHILD_STATUS).not_to be_nil
|
120
127
|
end
|
121
128
|
|
122
|
-
example
|
129
|
+
example 'wait4 returns frozen struct' do
|
123
130
|
skip 'wait4 test skipped on this platform' if hpux || darwin
|
124
131
|
|
125
|
-
pid = fork{ sleep 0.5 }
|
126
|
-
struct =
|
132
|
+
@pid = fork { sleep 0.5 }
|
133
|
+
struct = described_class.wait4(@pid)
|
127
134
|
expect(struct).to be_frozen
|
128
135
|
end
|
129
136
|
|
130
|
-
example
|
131
|
-
skip 'waitid test skipped on this platform' if hpux || darwin ||
|
137
|
+
example 'waitid method is defined' do
|
138
|
+
skip 'waitid test skipped on this platform' if hpux || darwin || bsd
|
132
139
|
|
133
|
-
expect(
|
140
|
+
expect(described_class).to respond_to(:waitid)
|
134
141
|
end
|
135
142
|
|
136
|
-
example
|
137
|
-
skip 'waitid test skipped on this platform' if hpux || darwin ||
|
143
|
+
example 'waitid method works as expected' do
|
144
|
+
skip 'waitid test skipped on this platform' if hpux || darwin || bsd
|
138
145
|
|
139
|
-
pid = fork{ sleep 0.5 }
|
140
|
-
expect{
|
146
|
+
@pid = fork { sleep 0.5 }
|
147
|
+
expect { described_class.waitid(Process::P_PID, @pid, Process::WEXITED) }.not_to raise_error
|
141
148
|
end
|
142
149
|
|
143
|
-
example
|
144
|
-
skip 'waitid test skipped on this platform' if hpux || darwin ||
|
150
|
+
example 'waitid method raises expected errors if wrong argument type is passed' do
|
151
|
+
skip 'waitid test skipped on this platform' if hpux || darwin || bsd
|
145
152
|
|
146
|
-
pid = fork{ sleep 0.5 }
|
147
|
-
expect{
|
148
|
-
expect{
|
149
|
-
expect{
|
153
|
+
@pid = fork { sleep 0.5 }
|
154
|
+
expect { described_class.waitid('foo', @pid, Process::WEXITED) }.to raise_error(TypeError)
|
155
|
+
expect { described_class.waitid(Process::P_PID, @pid, 'foo') }.to raise_error(TypeError)
|
156
|
+
expect { described_class.waitid(Process::P_PID, 'foo', Process::WEXITED) }.to raise_error(TypeError)
|
150
157
|
end
|
151
158
|
|
152
|
-
example
|
153
|
-
skip 'waitid test skipped on this platform' if hpux || darwin ||
|
159
|
+
example 'waitid method raises expected error if invalid argument is passed' do
|
160
|
+
skip 'waitid test skipped on this platform' if hpux || darwin || bsd
|
154
161
|
|
155
|
-
fork{ sleep 0.5 }
|
156
|
-
expect{
|
162
|
+
@pid = fork { sleep 0.5 }
|
163
|
+
expect { described_class.waitid(Process::P_PID, 99999999, Process::WEXITED) }.to raise_error(Errno::ECHILD)
|
157
164
|
end
|
158
165
|
|
159
|
-
example
|
166
|
+
example 'sigsend method is defined' do
|
160
167
|
skip 'sigsend test skipped on this platform' unless solaris
|
161
168
|
|
162
|
-
expect(
|
169
|
+
expect(described_class).to respond_to(:sigsend)
|
163
170
|
end
|
164
171
|
|
165
|
-
example
|
172
|
+
example 'sigsend works as expected' do
|
166
173
|
skip 'sigsend test skipped on this platform' unless solaris
|
167
174
|
|
168
|
-
pid = fork{ sleep 0.5 }
|
169
|
-
expect{
|
175
|
+
@pid = fork { sleep 0.5 }
|
176
|
+
expect { described_class.sigsend(Process::P_PID, @pid, 0) }.not_to raise_error
|
170
177
|
end
|
171
178
|
|
172
|
-
example
|
173
|
-
expect(
|
179
|
+
example 'getrusage method is defined' do
|
180
|
+
expect(described_class).to respond_to(:getrusage)
|
174
181
|
end
|
175
182
|
|
176
|
-
example
|
177
|
-
fork{ sleep 0.5 }
|
183
|
+
example 'getrusage works as expected' do
|
184
|
+
@pid = fork { sleep 0.5 }
|
178
185
|
|
179
|
-
expect{
|
180
|
-
expect{
|
186
|
+
expect { described_class.getrusage }.not_to raise_error
|
187
|
+
expect { described_class.getrusage(true) }.not_to raise_error
|
181
188
|
end
|
182
189
|
|
183
|
-
example
|
190
|
+
example 'getrusage can get thread info on Linux' do
|
184
191
|
skip 'getrusage only tested on Linux' unless linux
|
185
|
-
expect{
|
192
|
+
expect { described_class.getrusage(Process::RUSAGE_THREAD) }.not_to raise_error
|
186
193
|
end
|
187
194
|
|
188
|
-
example
|
195
|
+
example 'getrusage returns the expected struct' do
|
189
196
|
skip 'getrusage only tested on Linux' unless linux
|
190
197
|
|
191
|
-
fork{ sleep 0.5 }
|
192
|
-
expect(
|
193
|
-
expect(
|
194
|
-
expect(
|
198
|
+
@pid = fork { sleep 0.5 }
|
199
|
+
expect(described_class.getrusage).to be_a(Struct::RUsage)
|
200
|
+
expect(described_class.getrusage.stime).to be_a(Float)
|
201
|
+
expect(described_class.getrusage.utime).to be_a(Float)
|
195
202
|
end
|
196
203
|
|
197
|
-
example
|
198
|
-
expect(
|
204
|
+
example 'pause method is defined' do
|
205
|
+
expect(described_class).to respond_to(:pause)
|
199
206
|
end
|
200
207
|
|
201
|
-
example
|
202
|
-
skip 'wait constant check skipped on this platform' if darwin ||
|
208
|
+
example 'expected constants are defined' do
|
209
|
+
skip 'wait constant check skipped on this platform' if darwin || bsd
|
203
210
|
|
204
211
|
expect(Process::WCONTINUED).not_to be_nil
|
205
212
|
expect(Process::WEXITED).not_to be_nil
|
@@ -210,8 +217,8 @@ RSpec.describe Process do
|
|
210
217
|
expect(Process::WTRAPPED).not_to be_nil
|
211
218
|
end
|
212
219
|
|
213
|
-
example
|
214
|
-
skip 'process type flag check skipped on this platform' if linux || darwin ||
|
220
|
+
example 'expected process type flag constants are defined' do
|
221
|
+
skip 'process type flag check skipped on this platform' if linux || darwin || bsd
|
215
222
|
|
216
223
|
expect(Process::P_ALL).not_to be_nil
|
217
224
|
expect(Process::P_CID).not_to be_nil
|
@@ -225,10 +232,19 @@ RSpec.describe Process do
|
|
225
232
|
expect(Process::P_MYID).not_to be_nil
|
226
233
|
end
|
227
234
|
|
228
|
-
example
|
235
|
+
example 'solaris-specific process type flags are defined on solaris' do
|
229
236
|
skip 'P_TASKID and P_PROJID constant check skipped on this platform' unless solaris
|
230
237
|
|
231
238
|
expect(Process::P_TASKID).not_to be_nil
|
232
239
|
expect(Process::P_PROJID).not_to be_nil
|
233
240
|
end
|
241
|
+
|
242
|
+
example 'bsd-specific process type flags are defined on BSD platforms' do
|
243
|
+
skip 'P_JAILID constant check skipped on this platform' unless bsd
|
244
|
+
expect(Process::P_JAILID).not_to be_nil
|
245
|
+
end
|
246
|
+
|
247
|
+
def after
|
248
|
+
Process.kill(9, @pid) if @pid
|
249
|
+
end
|
234
250
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proc-wait3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
|
36
36
|
WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date: 2024-04-21 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: rake
|
@@ -65,6 +65,34 @@ dependencies:
|
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '3.9'
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
name: rubocop
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
type: :development
|
76
|
+
prerelease: false
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: rubocop-rspec
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
type: :development
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
68
96
|
description: |2
|
69
97
|
The proc-wait3 library adds the wait3, wait4, waitid, pause, sigsend,
|
70
98
|
and getrusage methods to the Process module.
|
@@ -81,7 +109,7 @@ files:
|
|
81
109
|
- README.md
|
82
110
|
- Rakefile
|
83
111
|
- certs/djberg96_pub.pem
|
84
|
-
- doc/wait3.
|
112
|
+
- doc/wait3.md
|
85
113
|
- examples/example_getrusage.rb
|
86
114
|
- examples/example_pause.rb
|
87
115
|
- examples/example_wait3.rb
|
@@ -98,10 +126,12 @@ licenses:
|
|
98
126
|
metadata:
|
99
127
|
homepage_uri: https://github.com/djberg96/proc-wait3
|
100
128
|
bug_tracker_uri: https://github.com/djberg96/proc-wait3/issues
|
101
|
-
changelog_uri: https://github.com/djberg96/proc-wait3/blob/
|
129
|
+
changelog_uri: https://github.com/djberg96/proc-wait3/blob/main/CHANGES.md
|
102
130
|
documentation_uri: https://github.com/djberg96/proc-wait3/wiki
|
103
131
|
source_code_uri: https://github.com/djberg96/proc-wait3
|
104
132
|
wiki_uri: https://github.com/djberg96/proc-wait3/wiki
|
133
|
+
rubygems_mfa_required: 'true'
|
134
|
+
github_repo: https://github.com/djberg96/proc-wait3
|
105
135
|
post_install_message:
|
106
136
|
rdoc_options: []
|
107
137
|
require_paths:
|
@@ -117,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
147
|
- !ruby/object:Gem::Version
|
118
148
|
version: '0'
|
119
149
|
requirements: []
|
120
|
-
rubygems_version: 3.
|
150
|
+
rubygems_version: 3.3.26
|
121
151
|
signing_key:
|
122
152
|
specification_version: 4
|
123
153
|
summary: Adds wait3, wait4 and other methods to the Process module
|
metadata.gz.sig
CHANGED
Binary file
|
data/doc/wait3.txt
DELETED
@@ -1,192 +0,0 @@
|
|
1
|
-
== Description
|
2
|
-
Adds the wait3, wait4, waitid, pause, sigsend, and getrusage methods to
|
3
|
-
the Process module.
|
4
|
-
|
5
|
-
== Synopsis
|
6
|
-
require 'proc/wait3'
|
7
|
-
|
8
|
-
pid = fork{ sleep 1; exit 2 }
|
9
|
-
p Time.now
|
10
|
-
Process.wait3
|
11
|
-
p $?
|
12
|
-
|
13
|
-
== Module Methods
|
14
|
-
Proc.pause(signals=nil)
|
15
|
-
Pauses the current process. If the process receives any of the signals
|
16
|
-
you pass as arguments it will return from the pause and continue with
|
17
|
-
the execution of your code. Otherwise, it will exit.
|
18
|
-
|
19
|
-
Note that you must leave out the 'SIG' prefix for the signal name, e.g.
|
20
|
-
use 'INT', not 'SIGINT'.
|
21
|
-
|
22
|
-
Returns the result of the pause() function, which should always be -1.
|
23
|
-
|
24
|
-
Process.sigsend(idtype, id, signal=0)
|
25
|
-
Sends a signal of type "idtype" to a process or process group "id". This
|
26
|
-
is more versatile method of sending signals to processes than Process.kill.
|
27
|
-
|
28
|
-
For a list of valid idtype values, see the "Process type constants" below.
|
29
|
-
Not supported on all platforms.
|
30
|
-
|
31
|
-
Proc.wait3(flags=0)
|
32
|
-
Delays its caller until a signal is received or one of its child processes
|
33
|
-
terminates or stops due to tracing.
|
34
|
-
|
35
|
-
The return value is a ProcStat structure and sets the $last_status global
|
36
|
-
variable. The special global $? is also set. Raises a SystemError if there
|
37
|
-
are no child processes.
|
38
|
-
|
39
|
-
Proc.wait4(pid, flags=0)
|
40
|
-
Waits for the given child process to exit. Returns a ProcStat structure.
|
41
|
-
The $last_status global variable is set. Also sets the $? special global
|
42
|
-
variable.
|
43
|
-
|
44
|
-
Proc.waitid(id_type, id_num=nil, options=nil)
|
45
|
-
Suspends the calling process until one of its children changes state,
|
46
|
-
returning immediately if a child process changed state prior to the call.
|
47
|
-
The state of a child process will change if it terminates, stops because
|
48
|
-
of a signal, becomes trapped or reaches a breakpoint.
|
49
|
-
|
50
|
-
The id_num corresponds to a process ID or process group ID, depending on
|
51
|
-
the value of +id_type+, which may be Process::P_PID, Process::P_PGID or
|
52
|
-
Process::P_ALL. If +id_type+ is Process::P_ALL, then the +id_num+ is ignored.
|
53
|
-
|
54
|
-
The options argument is used to specify which state changes are to be
|
55
|
-
waited for. It is constructed from the bitwise-OR of one or more of the
|
56
|
-
following constants:
|
57
|
-
|
58
|
-
Process::WCONTINUED
|
59
|
-
Process::WEXITED
|
60
|
-
Process::WNOHANG
|
61
|
-
Process::WNOWAIT
|
62
|
-
Process::WSTOPPED
|
63
|
-
Process::WTRAPPED (not supported on all platforms)
|
64
|
-
|
65
|
-
If Process::WNOHANG is set as an option, this method will return
|
66
|
-
immediately, whether or not a child has changed state.
|
67
|
-
|
68
|
-
Calling this method with an +id_type+ of Process::P_ALL and the options set
|
69
|
-
to 'Process::EXITED | Process::WTRAPPED' is equivalent to calling
|
70
|
-
Process.wait.
|
71
|
-
|
72
|
-
Returns a Proc::SigInfo struct and sets $?.
|
73
|
-
|
74
|
-
Not supported on all platforms.
|
75
|
-
|
76
|
-
== Constants
|
77
|
-
=== Standard
|
78
|
-
Process::WAIT3_VERSION
|
79
|
-
Returns the version of this package as a string.
|
80
|
-
|
81
|
-
=== Process type constants
|
82
|
-
==== All platforms
|
83
|
-
Process::P_ALL
|
84
|
-
All non-system process.
|
85
|
-
|
86
|
-
Process::P_PID
|
87
|
-
A standard process id.
|
88
|
-
|
89
|
-
Process::P_PGID
|
90
|
-
Any non-system process group id.
|
91
|
-
|
92
|
-
==== Not supported on all platforms
|
93
|
-
Process::P_CID
|
94
|
-
A scheduler process id.
|
95
|
-
|
96
|
-
Process::P_GID
|
97
|
-
Any non-system effective process group id.
|
98
|
-
|
99
|
-
Process::P_PROJID
|
100
|
-
A project process id. Solaris 8 or later only.
|
101
|
-
|
102
|
-
Process::P_SID
|
103
|
-
A session process id.
|
104
|
-
|
105
|
-
Process::P_TASKID
|
106
|
-
A task process id. Solaris 8 or later only.
|
107
|
-
|
108
|
-
Process::P_UID
|
109
|
-
Any non-system effective process user id.
|
110
|
-
|
111
|
-
=== The following additional constants are defined if the waitid function is
|
112
|
-
supported on your system.
|
113
|
-
|
114
|
-
Process::WCONTINUED
|
115
|
-
Return the status for any child that was stopped and has been continued.
|
116
|
-
|
117
|
-
Process::WEXITED
|
118
|
-
Wait for process(es) to exit.
|
119
|
-
|
120
|
-
Process::WNOWAIT
|
121
|
-
Keep the process in a waitable state.
|
122
|
-
|
123
|
-
Process::WSTOPPED
|
124
|
-
Wait for and return the process status of any child that has stopped upon
|
125
|
-
receipt of a signal.
|
126
|
-
|
127
|
-
Process::WTRAPPED
|
128
|
-
Wait for traced process(es) to become trapped or reach a breakpoint.
|
129
|
-
|
130
|
-
Not supported on all platforms.
|
131
|
-
|
132
|
-
=== RLIMIT constants
|
133
|
-
Process::RLIMIT_AS
|
134
|
-
A synonym for RLIMIT_VMEM
|
135
|
-
|
136
|
-
Process::RLIMIT_CORE
|
137
|
-
The maximum size of a core file, in bytes, that may be created.
|
138
|
-
|
139
|
-
Process::RLIMIT_CPU
|
140
|
-
The maximum amount of CPU time, in seconds, the process is allowed to use.
|
141
|
-
|
142
|
-
Process::RLIMIT_DATA
|
143
|
-
The maximum size of the process' heap size, in bytes.
|
144
|
-
|
145
|
-
Process::RLIMIT_FSIZE
|
146
|
-
The maximum size of a file, in bytes, that the process may create.
|
147
|
-
|
148
|
-
Process::RLIMIT_NOFILE
|
149
|
-
The maximum value that the kernel may assign to a file descriptor,
|
150
|
-
effectively limiting the number of open files for the calling process.
|
151
|
-
|
152
|
-
Process::RLIMIT_STACK
|
153
|
-
The maximum size of the process' stack in bytes.
|
154
|
-
|
155
|
-
Process::RLIMIT_VMEM
|
156
|
-
The maximum size of the process' mapped address space.
|
157
|
-
|
158
|
-
Process::RLIM_INFINITY
|
159
|
-
A infinite limit.
|
160
|
-
|
161
|
-
Process::RLIM_SAVED_CUR
|
162
|
-
Current soft limit.
|
163
|
-
|
164
|
-
Process::RLIM_SAVED_MAX
|
165
|
-
Current hard limit.
|
166
|
-
|
167
|
-
== Notes
|
168
|
-
The wait3 and wait4 methods are similar to the wait2 and waitpid2
|
169
|
-
methods, except that they return much more information via the rusage
|
170
|
-
struct.
|
171
|
-
|
172
|
-
== Known Bugs
|
173
|
-
None that I'm aware of. Please log any bugs on the Github project
|
174
|
-
page at https://github.com/djberg96/proc-wait3.
|
175
|
-
|
176
|
-
== License
|
177
|
-
Apache-2.0
|
178
|
-
|
179
|
-
== Copyright
|
180
|
-
(C) 2003-2019 Daniel J. Berger
|
181
|
-
All Rights Reserved.
|
182
|
-
|
183
|
-
== Warranty
|
184
|
-
This package is provided "as is" and without any express or
|
185
|
-
implied warranties, including, without limitation, the implied
|
186
|
-
warranties of merchantability and fitness for a particular purpose.
|
187
|
-
|
188
|
-
== Author
|
189
|
-
Daniel J. Berger
|
190
|
-
|
191
|
-
== See also
|
192
|
-
wait3, wait4, waitid, pause, sigsend
|