summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorambrisko <ambrisko@FreeBSD.org>2005-12-03 05:11:07 +0000
committerambrisko <ambrisko@FreeBSD.org>2005-12-03 05:11:07 +0000
commit51d3b3edd07d501f9272f937cb63bea7e0d6fae1 (patch)
tree7a1ff1581632aadb1700b0e34fd2b550177ff557
parentb7c797730221439cd9b743de90a62191a1955ac4 (diff)
downloadFreeBSD-src-51d3b3edd07d501f9272f937cb63bea7e0d6fae1.zip
FreeBSD-src-51d3b3edd07d501f9272f937cb63bea7e0d6fae1.tar.gz
Switch BUILD_ARCH in Makefile to use uname -p suggested by ru.
Switch strncpy to strlcpy suggested by gad and issue found by pjd. Add to uname(3) man page describing: UNAME_s UNAME_r UNAME_v UNAME_m Add to getosreldate(3) man page describing: OSVERSION Submitted by: ru, pjd/gad Reviewed by: ru (man pages)
-rw-r--r--Makefile.inc12
-rw-r--r--lib/libc/gen/__xuname.c8
-rw-r--r--lib/libc/gen/getosreldate.311
-rw-r--r--lib/libc/gen/uname.329
4 files changed, 43 insertions, 7 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1
index 6a93be9..33776bb 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 e5139b7..ee96ad6 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 78dc7e5..ff4d10e 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 d88ba33..b9e2c9a 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
OpenPOWER on IntegriCloud