1 /* Suite version information for procps utilities
2 * Copyright (c) 1995 Martin Schulze <joey@infodrom.north.de>
3 * Ammended by cblake to only export the function symbol.
5 * Modified by Albert Cahalan, ????-2003
7 * Redistributable under the terms of the
8 * GNU Library General Public License; see COPYING
18 const char procps_version[] = "procps version " VERSION "." SUBVERSION "." MINORVERSION;
20 const char procps_version[] = "procps version " VERSION "." SUBVERSION;
23 void display_version(void) {
24 fprintf(stdout, "%s\n", procps_version);
27 /* Linux kernel version information for procps utilities
28 * Copyright (c) 1996 Charles Blake <cblake@bbn.com>
30 #include <sys/utsname.h>
32 #define LINUX_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z)
34 int linux_version_code;
36 static void init_Linux_version(void) __attribute__((constructor));
37 static void init_Linux_version(void) {
38 static struct utsname uts;
39 int x = 0, y = 0, z = 0; /* cleared in case sscanf() < 3 */
41 if (uname(&uts) == -1) /* failure implies impending death */
43 if (sscanf(uts.release, "%d.%d.%d", &x, &y, &z) < 3)
44 fprintf(stderr, /* *very* unlikely to happen by accident */
45 "Non-standard uts for running kernel:\n"
46 "release %s=%d.%d.%d gives version code %d\n",
47 uts.release, x, y, z, LINUX_VERSION(x,y,z));
48 linux_version_code = LINUX_VERSION(x, y, z);