proc-wait3 1.7.1 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES +4 -0
- data/Rakefile +1 -1
- data/ext/extconf.rb +3 -0
- data/ext/proc/wait3.c +12 -3
- data/proc-wait3.gemspec +1 -1
- data/test/test_proc_wait3.rb +6 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e8e2adc295d743113110cd7ee38d0ccac0f3a4a
|
4
|
+
data.tar.gz: fa55f8271551d42e1c29192aa848f8e5804a924e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72ba5b8d8c710346a44bf28ddf4e0ef0399e3e12e3687e5e0afd8bfb2ff5bbec4b984c92bdfb2aa88e3bee2e0bbccfeebe3b9ff41f6e8921dbc68cb7c23fa18c
|
7
|
+
data.tar.gz: 4d83c90b9b086c04547cf06e736e8739fa8cd00df46747d726e4b674e520a871ae542d83a596ae7cc2806acc5a391b7ff9eb64f486213de24c827987d5f189ad
|
data/CHANGES
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
== 1.7.2 - 5-Sep-2014
|
2
|
+
* Added support for the RUSAGE_THREAD constant on Linux. Thanks go to
|
3
|
+
Bruno Michel for the patch.
|
4
|
+
|
1
5
|
== 1.7.1 - 24-Apr-2014
|
2
6
|
* Explicitly check for and include sys/resource.h because Debian. Thanks
|
3
7
|
go to Christos Trochalakis for the spot.
|
data/Rakefile
CHANGED
data/ext/extconf.rb
CHANGED
@@ -92,4 +92,7 @@ have_const('P_PID', 'signal.h') || have_const('P_PID', 'sys/wait.h')
|
|
92
92
|
have_const('P_PROJID', 'signal.h')
|
93
93
|
have_const('P_TASKID', 'signal.h')
|
94
94
|
|
95
|
+
# RUSAGE_THREAD is Linux-specific
|
96
|
+
have_const('RUSAGE_THREAD', 'sys/resource.h')
|
97
|
+
|
95
98
|
create_makefile('proc/wait3', 'proc')
|
data/ext/proc/wait3.c
CHANGED
@@ -730,6 +730,9 @@ static VALUE proc_sigsend(int argc, VALUE* argv, VALUE mod){
|
|
730
730
|
* process. If +children+ is set to true, it will return information for
|
731
731
|
* terminated and waited for children of the current process.
|
732
732
|
*
|
733
|
+
* On Linux platforms the +children+ argument can be set to RUSAGE_THREAD to
|
734
|
+
* retrieve thread information instead.
|
735
|
+
*
|
733
736
|
* The RUsage struct contains the following members:
|
734
737
|
*
|
735
738
|
* * utime - User time
|
@@ -758,7 +761,9 @@ static VALUE proc_getrusage(int argc, VALUE* argv, VALUE mod){
|
|
758
761
|
|
759
762
|
rb_scan_args(argc, argv, "01", &v_children);
|
760
763
|
|
761
|
-
if(
|
764
|
+
if(TYPE(v_children) == T_FIXNUM)
|
765
|
+
who = FIX2INT(v_children);
|
766
|
+
else if(RTEST(v_children))
|
762
767
|
who = RUSAGE_CHILDREN;
|
763
768
|
|
764
769
|
if(getrusage(who,&r) == -1)
|
@@ -966,8 +971,12 @@ void Init_wait3()
|
|
966
971
|
rb_define_const(rb_mProcess, "P_PROJID", INT2FIX(P_PROJID));
|
967
972
|
#endif
|
968
973
|
|
969
|
-
|
970
|
-
rb_define_const(rb_mProcess, "
|
974
|
+
#ifdef HAVE_CONST_RUSAGE_THREAD
|
975
|
+
rb_define_const(rb_mProcess, "RUSAGE_THREAD", INT2FIX(RUSAGE_THREAD));
|
976
|
+
#endif
|
977
|
+
|
978
|
+
/* 1.7.2: The version of the proc-wait3 library */
|
979
|
+
rb_define_const(rb_mProcess, "WAIT3_VERSION", rb_str_new2("1.7.2"));
|
971
980
|
|
972
981
|
/* Define this last in our Init_wait3 function */
|
973
982
|
rb_define_readonly_variable("$last_status", &v_last_status);
|
data/proc-wait3.gemspec
CHANGED
data/test/test_proc_wait3.rb
CHANGED
@@ -33,7 +33,7 @@ class TC_Proc_Wait3 < Test::Unit::TestCase
|
|
33
33
|
end
|
34
34
|
|
35
35
|
test "version constant is set to expected value" do
|
36
|
-
assert_equal('1.7.
|
36
|
+
assert_equal('1.7.2', Process::WAIT3_VERSION)
|
37
37
|
end
|
38
38
|
|
39
39
|
test "wait3 method is defined" do
|
@@ -165,6 +165,11 @@ class TC_Proc_Wait3 < Test::Unit::TestCase
|
|
165
165
|
assert_nothing_raised{ Process.getrusage(true) }
|
166
166
|
end
|
167
167
|
|
168
|
+
test "getrusage can get thread info on Linux" do
|
169
|
+
omit_unless(@@linux)
|
170
|
+
assert_nothing_raised{ Process.getrusage(Process::RUSAGE_THREAD) }
|
171
|
+
end
|
172
|
+
|
168
173
|
test "getrusage returns the expected struct" do
|
169
174
|
fork{ sleep 0.5 }
|
170
175
|
assert_kind_of(Struct::RUsage, Process.getrusage)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proc-wait3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-unit
|