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.
10 #include <sys/utsname.h> /* for uname(2) */
14 /* Returns current kernel version encoded as major*65536 + minor*256 + patch,
15 * so, for example, to check if the kernel is greater than 2.2.11:
17 * if (get_linux_version_code() > KERNEL_VERSION(2,2,11)) { <stuff> }
19 int FAST_FUNC get_linux_version_code(void)
25 if (uname(&name) == -1) {
26 bb_perror_msg("cannot get system information");
32 for (i = 0; i < 3; i++) {
33 r = r * 256 + atoi(strtok(s, "."));