From: "Iñaki Baz Castillo" Date: 2012-03-07T01:01:21+09:00 Subject: [C extension] How to detect Linux Kernel and glibc version? Hi, for a Ruby C extension I need to check in extconf.rb the Linux kernel and glibc version in which the extension is being compiled (so when running "gem install xxxx"). I need to know this information in order to use the accept4 system call which exists from kernel 2.6.28 and from glibc 2.10 (both conditions must be satisfied). So I expect something like the following in my extconf.rb: ---------------------------------- case RUBY_PLATFORM when /linux/ if KERNEL_VERSION >= "2.6.28" and GLIBC_VERSION >= "2.10" add_define 'HAVE_ACCEPT4' end ---------------------------------- Well, I could run "uname -r" but that is dangerous, example: "2.6.3" >= "2.6.28" => true OPSSSSS !!! And unfortunatelly I cannot add more gems (i.e. versionomy) as depencency. Also, no idea to get the current "glibc" version. Thanks for any tip. -- Iñaki Baz Castillo