[#62297] Re: [ruby-cvs:52906] nari:r45760 (trunk): * gc.c (gc_after_sweep): suppress unnecessary expanding heap. — Eric Wong <normalperson@...>
nari@ruby-lang.org wrote:
7 messages
2014/05/02
[#62307] Re: [ruby-cvs:52906] nari:r45760 (trunk): * gc.c (gc_after_sweep): suppress unnecessary expanding heap.
— SASADA Koichi <ko1@...>
2014/05/03
(2014/05/03 4:41), Eric Wong wrote:
[#62402] Re: [ruby-cvs:52906] nari:r45760 (trunk): * gc.c (gc_after_sweep): suppress unnecessary expanding heap.
— Eric Wong <normalperson@...>
2014/05/05
SASADA Koichi <ko1@atdot.net> wrote:
[#62523] [ruby-trunk - Feature #9632] [PATCH 0/2] speedup IO#close with linked-list from ccan — ko1@...
Issue #9632 has been updated by Koichi Sasada.
3 messages
2014/05/11
[#62556] doxygen (Re: Re: [ruby-trunk - Feature #9632] [PATCH 0/2] speedup IO#close with linked-list from ccan) — Tanaka Akira <akr@...>
2014-05-11 8:50 GMT+09:00 Eric Wong <normalperson@yhbt.net>:
3 messages
2014/05/13
[#62727] [RFC] vm_method.c (rb_method_entry_make): avoid freed me in m_tbl — Eric Wong <normalperson@...>
rb_unlink_method_entry may cause old_me to be swept before the new
7 messages
2014/05/24
[#63039] Re: [RFC] vm_method.c (rb_method_entry_make): avoid freed me in m_tbl
— SASADA Koichi <ko1@...>
2014/06/10
Hi,
[#63077] Re: [RFC] vm_method.c (rb_method_entry_make): avoid freed me in m_tbl
— Eric Wong <normalperson@...>
2014/06/10
SASADA Koichi <ko1@atdot.net> wrote:
[#63086] Re: [RFC] vm_method.c (rb_method_entry_make): avoid freed me in m_tbl
— SASADA Koichi <ko1@...>
2014/06/11
(2014/06/11 4:47), Eric Wong wrote:
[#63087] Re: [RFC] vm_method.c (rb_method_entry_make): avoid freed me in m_tbl
— Eric Wong <normalperson@...>
2014/06/11
SASADA Koichi <ko1@atdot.net> wrote:
[#62862] [RFC] README.EXT: document rb_gc_register_mark_object — Eric Wong <normalperson@...>
Any comment on officially supporting this as part of the C API?
5 messages
2014/05/30
[ruby-core:62636] [ruby-trunk - Feature #9770] Etc.uname
From:
akr@...
Date:
2014-05-17 06:52:55 UTC
List:
ruby-core #62636
Issue #9770 has been updated by Akira Tanaka.
sys-uname gem is not usable for tests bundled in ruby.
----------------------------------------
Feature #9770: Etc.uname
https://bugs.ruby-lang.org/issues/9770#change-46772
* Author: Akira Tanaka
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version:
----------------------------------------
How about Etc.uname method to call the uname(2) system call?
```
% ./ruby -rpp -retc -e 'pp Etc.uname'
{:sysname=>"Linux",
:nodename=>"boron",
:release=>"2.6.18-6-xen-686",
:version=>"#1 SMP Thu Nov 5 19:54:42 UTC 2009",
:machine=>"i686"}
```
Sometimes we need to obtain OS (kernel) version or similar system information.
For example, there are several tests which invokes uname command (and function via Win32API):
```
test/ruby/test_io.rb: return false if (`/bin/uname -r`.split('.') <=> %w[3 8]) < 0
test/ruby/test_io.rb: return false if (`/bin/uname -r`.split('.') <=> %w[3 5]) < 0
test/ruby/test_io.rb: return false if (`/bin/uname -r`.split('.') <=> %w[3 8]) < 0
test/ruby/test_sleep.rb: 4.98 if /Linux ([\d.]+)/ =~ `uname -sr` && ($1.split('.')<=>%w/2 6 18/)<1
test/socket/test_socket.rb: (`uname -r`[/[0-9.]+/].split('.').map(&:to_i) <=> [2,6,18]) <= 0
test/dbm/test_dbm.rb: uname = Win32API.new('cygwin1', 'uname', 'P', 'I')
```
Etc.uname provides clean replacement for them.
`uname -r` can be changed to Etc.uname[:release].
uname function is defined by POSIX.
So it is pretty portable.
If the function is not available, NotImplementedError is raised.
I chose Etc module because uname() returns system wide information.
The return value is a plain hash because:
* Struct is marshal-incompatible if some OS add fields. (glibc has "domainname", for example. Current implementation doesn't support it, though.)
* No inspect method required to view contents.
Any idea?
---Files--------------------------------
etc-uname.patch (3.16 KB)
--
https://bugs.ruby-lang.org/