GETVERSION(2)

NAME
getversion - gets kernel version information

SYNOPSIS
#include <sys/version.h>

#define VERSIONLEN 32
struct version {
	unsigned	v_id   : 20,	/* Object id for identifying program */
			v_iver : 12;	/* Internal version number */
	char	v_version[VERSIONLEN];	/* Version string for humans */
};
cc = getversion(buffer, bufsize)
int cc;
struct version *buffer;
int nbytes;

DESCRIPTION

getversion returnes the kernel version structure to the given buffer, at most bufsize bytes are copied. The v_id and v_iver are the numbers used by the versioning system, v_id is 1, and v_iver is unique for all released kernels. The v_version array contains the string printed when the kernel boots.

RETURN VALUE
If the call succeeds a value of 0 is returned. If the call fails, then a value of -1 is returned and an error code is placed in the global location errno.

ERRORS
getversion will fail if the following is true:

EFAULT
    The buffer points outside the allocated address space.

SEE ALSO
version(1)