From: "Iñaki Baz Castillo" Date: 2012-03-07T19:32:23+09:00 Subject: Re: [C extension] How to detect Linux Kernel and glibc version? 2012/3/7 Eric Wong : > kgio just uses: have_func('accept4', %w(sys/socket.h)) Just great :) > I recently added an extra check for SOCK_* macros because of > Debian GNU/kFreeBSD: > > http://bogomips.org/kgio.git/patch/?id=56cce133d979c22bbef80fdba1881d8f40876e2f So SOCK_CLOEXEC is set when loading some .h file, in my case /usr/include/x86_64-linux-gnu/bits/socket.h which includes: ---------------------------- SOCK_CLOEXEC = 02000000, /* Atomically set close-on-exec flag for the new descriptor(s). */ #define SOCK_CLOEXEC SOCK_CLOEXEC ----------------------------- Am I right? (I don't understand the purpose of lines 8-14 in your above link). >> 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). Ok. > 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. Yes, but that should be considered an "human" error :) Thanks a lot. -- Iñaki Baz Castillo