2002-02-02 04:17:29 +05:30
|
|
|
/* Suite version information for procps utilities
|
|
|
|
* Copyright (c) 1995 Martin Schulze <joey@infodrom.north.de>
|
|
|
|
* Ammended by cblake to only export the function symbol.
|
2002-12-15 06:00:17 +05:30
|
|
|
*
|
2003-02-09 12:57:16 +05:30
|
|
|
* Modified by Albert Cahalan, ????-2003
|
2002-12-15 06:00:17 +05:30
|
|
|
*
|
2002-02-02 04:17:29 +05:30
|
|
|
* Redistributable under the terms of the
|
|
|
|
* GNU Library General Public License; see COPYING
|
|
|
|
*/
|
2002-09-27 18:50:17 +05:30
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
2002-02-02 04:17:29 +05:30
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2002-10-10 05:31:37 +05:30
|
|
|
#include "version.h"
|
2002-02-02 04:17:29 +05:30
|
|
|
|
|
|
|
#ifdef MINORVERSION
|
2002-10-15 07:13:21 +05:30
|
|
|
const char procps_version[] = "procps version " VERSION "." SUBVERSION "." MINORVERSION;
|
2002-02-02 04:17:29 +05:30
|
|
|
#else
|
2002-10-15 07:13:21 +05:30
|
|
|
const char procps_version[] = "procps version " VERSION "." SUBVERSION;
|
2002-02-02 04:17:29 +05:30
|
|
|
#endif
|
|
|
|
|
|
|
|
void display_version(void) {
|
|
|
|
fprintf(stdout, "%s\n", procps_version);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Linux kernel version information for procps utilities
|
|
|
|
* Copyright (c) 1996 Charles Blake <cblake@bbn.com>
|
|
|
|
*/
|
|
|
|
#include <sys/utsname.h>
|
|
|
|
|
|
|
|
#define LINUX_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z)
|
|
|
|
|
2003-02-09 12:57:16 +05:30
|
|
|
int linux_version_code;
|
2002-02-02 04:17:29 +05:30
|
|
|
|
|
|
|
static void init_Linux_version(void) __attribute__((constructor));
|
|
|
|
static void init_Linux_version(void) {
|
|
|
|
static struct utsname uts;
|
|
|
|
int x = 0, y = 0, z = 0; /* cleared in case sscanf() < 3 */
|
|
|
|
|
|
|
|
if (uname(&uts) == -1) /* failure implies impending death */
|
|
|
|
exit(1);
|
|
|
|
if (sscanf(uts.release, "%d.%d.%d", &x, &y, &z) < 3)
|
|
|
|
fprintf(stderr, /* *very* unlikely to happen by accident */
|
|
|
|
"Non-standard uts for running kernel:\n"
|
|
|
|
"release %s=%d.%d.%d gives version code %d\n",
|
|
|
|
uts.release, x, y, z, LINUX_VERSION(x,y,z));
|
|
|
|
linux_version_code = LINUX_VERSION(x, y, z);
|
|
|
|
}
|