.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\" %%%LICENSE_END
.\"
-.TH PROCPS_LINUX_VERSION 3 2016-04-14 "libproc-2"
+.TH PROCPS_LINUX_VERSION 3 2016-05-01 "libproc-2"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
.B procps_linux_version()
first appeared in libproc-2 version 0.0.
+.SH BUGS
+Due to the way the three numbers are encoded into a single integer,
+.BR procps_linux_version ()
+and the associated macros assume 255 for the maximum value for the
+minor and patch level and 32767 (hex 0x7fff) for the maximum value
+for the major version. In other words, when Linux v 32768.0.0 comes
+out, this function will break.
+.\" Maj/6yr - In 7452 we'll think of something
+
.SH SEE ALSO
.BR fopen (3),
.BR proc (5).
int procps_linux_version(void);
/* Convenience macros for composing/decomposing version codes */
-#define LINUX_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z)
+#define LINUX_VERSION(x,y,z) (0x10000*((x)&0x7fff) + 0x100*((y)&0xff) + (z)&0xff)
#define LINUX_VERSION_MAJOR(x) (((x)>>16) & 0xFF)
#define LINUX_VERSION_MINOR(x) (((x)>> 8) & 0xFF)
#define LINUX_VERSION_PATCH(x) ( (x) & 0xFF)