1 /* vi: set sw=4 ts=4: */
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
13 #include <sys/utsname.h> /* for uname(2) */
17 /* Returns current kernel version encoded as major*65536 + minor*256 + patch,
18 * so, for example, to check if the kernel is greater than 2.2.11:
20 * if (get_linux_version_code() > KERNEL_VERSION(2,2,11)) { <stuff> }
22 int get_linux_version_code(void)
28 if (uname(&name) == -1) {
29 bb_perror_msg("cannot get system information");
35 for (i=0 ; i<3 ; i++) {
36 r = r * 256 + atoi(strtok(s, "."));