diff --git a/Makefile.inc1 b/Makefile.inc1 index 6a93be9aa8fc..33776bb40e18 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -122,7 +122,7 @@ _CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \ .error CPUTYPE global should be set with ?=. .endif .if make(buildworld) -BUILD_ARCH!= uname -m +BUILD_ARCH!= uname -p .if ${MACHINE_ARCH} != ${BUILD_ARCH} .error To cross-build, set TARGET_ARCH. .endif diff --git a/lib/libc/gen/__xuname.c b/lib/libc/gen/__xuname.c index e5139b7260ca..ee96ad6678df 100644 --- a/lib/libc/gen/__xuname.c +++ b/lib/libc/gen/__xuname.c @@ -74,7 +74,7 @@ __xuname(int namesize, void *namebuf) } name->sysname[sizeof(name->sysname) - 1] = '\0'; if ((p = getenv("UNAME_s"))) - strncpy(name->sysname, p, sizeof(name->sysname)); + strlcpy(name->sysname, p, sizeof(name->sysname)); mib[0] = CTL_KERN; mib[1] = KERN_HOSTNAME; @@ -100,7 +100,7 @@ __xuname(int namesize, void *namebuf) } name->release[sizeof(name->release) - 1] = '\0'; if ((p = getenv("UNAME_r"))) - strncpy(name->release, p, sizeof(name->release)); + strlcpy(name->release, p, sizeof(name->release)); /* The version may have newlines in it, turn them into spaces. */ mib[0] = CTL_KERN; @@ -123,7 +123,7 @@ __xuname(int namesize, void *namebuf) } } if ((p = getenv("UNAME_v"))) - strncpy(name->version, p, sizeof(name->version)); + strlcpy(name->version, p, sizeof(name->version)); mib[0] = CTL_HW; mib[1] = HW_MACHINE; @@ -137,6 +137,6 @@ __xuname(int namesize, void *namebuf) } name->machine[sizeof(name->machine) - 1] = '\0'; if ((p = getenv("UNAME_m"))) - strncpy(name->machine, p, sizeof(name->machine)); + strlcpy(name->machine, p, sizeof(name->machine)); return (rval); } diff --git a/lib/libc/gen/getosreldate.3 b/lib/libc/gen/getosreldate.3 index 78dc7e5f0b46..ff4d10e6854a 100644 --- a/lib/libc/gen/getosreldate.3 +++ b/lib/libc/gen/getosreldate.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 30, 2003 +.Dd December 2, 2005 .Dt GETOSRELDATE 3 .Os .Sh NAME @@ -55,6 +55,15 @@ returns the value requested; otherwise the value \-1 is returned and the global variable .Va errno is set to indicate the error. +.Sh ENVIRONMENT +.Bl -tag -width ".Ev OSVERSION" +.It Ev OSVERSION +If the environment variable +.Ev OSVERSION +is set, it will override the +.Fn getosreldate +return value. +.El .Sh EXAMPLES An example can be found in .Pa /usr/share/examples/FreeBSD_version . diff --git a/lib/libc/gen/uname.3 b/lib/libc/gen/uname.3 index d88ba33cfd2d..b9e2c9a80bca 100644 --- a/lib/libc/gen/uname.3 +++ b/lib/libc/gen/uname.3 @@ -32,7 +32,7 @@ .\" @(#)uname.3 8.1 (Berkeley) 1/4/94 .\" $FreeBSD$ .\" -.Dd January 4, 1994 +.Dd December 2, 2005 .Dt UNAME 3 .Os .Sh NAME @@ -72,6 +72,33 @@ Machine hardware platform. .El .Sh RETURN VALUES .Rv -std uname +.Sh ENVIRONMENT +.Bl -tag -width ".Ev UNAME_s" +.It Ev UNAME_s +If the environment variable +.Ev UNAME_s +is set, it will override the +.Va sysname +member. +.It Ev UNAME_r +If the environment variable +.Ev UNAME_r +is set, it will override the +.Va release +member. +.It Ev UNAME_v +If the environment variable +.Ev UNAME_v +is set, it will override the +.Va version +member. +.It Ev UNAME_m +If the environment variable +.Ev UNAME_m +is set, it will override the +.Va machine +member. +.El .Sh ERRORS The .Fn uname