From: Eric Wong Date: 2012-03-07T17:35:55+09:00 Subject: Re: [C extension] How to detect Linux Kernel and glibc version? I単aki Baz Castillo wrote: > 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). kgio just uses: have_func('accept4', %w(sys/socket.h)) I recently added an extra check for SOCK_* macros because of Debian GNU/kFreeBSD: http://bogomips.org/kgio.git/patch/?id=56cce133d979c22bbef80fdba1881d8f40876e2f > Also, no idea to get the current "glibc" version. No need to care about kernel version or glibc version. I try to avoid version-based checks entirely (not always possible). The trickier case is handling ENOSYS, because I've seen folks run into issues where code gets built on a newer machine and deployed on an old one.