Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Jan 1999 02:38:01 +0900 (JST)
From:      dcs@newsguy.com
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   kern/9460: Loader can't identify it's version
Message-ID:  <199901121738.CAA00626@daniel.sobral>

next in thread | raw e-mail | index | archive | help

>Number:         9460
>Category:       kern
>Synopsis:       Loader can't tell a program what it's version is
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 12 09:40:00 PST 1999
>Closed-Date:
>Last-Modified:
>Originator:     Daniel C. Sobral
>Release:        FreeBSD 3.0-CURRENT i386
>Organization:
>Environment:

	Current as of Jan 12/1999, three stage boot's loader.

>Description:

	There is no way a program can properly tell precisely what
version it of loader it is running on. This path leads to hacks an
eventual complete incompatibilities.

>How-To-Repeat:

	UTSL.

>Fix:

	The patch below creates a Forth "environment" variable.
These are accessed by the standard Forth word "environment?", and
are used to determine characteristics about the system (like char
and cell sizes, word sets supported, etc). The fix below sets a
"loader-version" environment variable to 3100, which I'm thinking
of as being FreeBSD's version. It need not need to be the same
as FreeBSD's version, but, this way, it gives *extra* information
to the loader, which, of course, can be *completely* incorrect,
as the loader doesn't necessarily reflect the world's version,
even if it *is* installed by it. :-) Still, it can be used to
tell ficl programs in what version of loader they are running in.

	Also, notice that I hardcoded 3100. I discarded almost
instantly using a macro because I knew I'd most surely get it
wrong anyway. :-)

	Finally, there are *two* patch files below. The first
apply to my kern/9412 interp_forth.c, and the second to a
current as of Jan 12 interp_forth.c.

--- interp_forth.c	1999/01/11 17:31:47	1.5
+++ interp_forth.c	1999/01/12 17:26:20	1.7
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$Id: interp_forth.c,v 1.5 1999/01/11 17:31:47 root Exp $
+ *	$Id: interp_forth.c,v 1.7 1999/01/12 17:26:20 root Exp $
  */
 
 #include <string.h>
@@ -137,6 +137,9 @@
 	sprintf(create_buf, "builtin: %s", (*cmdp)->c_name);
 	ficlExec(bf_vm, create_buf, -1);
     }
+
+    /* Set the version number */
+    ficlSetEnv("loader-version", 3100);
 
     /* try to load and run init file if present */
     if ((fd = open("/boot/boot.4th", O_RDONLY)) != -1) {
--- interp_forth.c	1999/01/12 14:43:46	1.1.2.1
+++ interp_forth.c	1999/01/12 17:27:05	1.1.2.3
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$Id: interp_forth.c,v 1.1.2.1 1999/01/12 14:43:46 root Exp $
+ *	$Id: interp_forth.c,v 1.1.2.3 1999/01/12 17:27:05 root Exp $
  */
 
 #include <string.h>
@@ -118,6 +118,9 @@
     /* make all commands appear as Forth words */
     SET_FOREACH(cmdp, Xcommand_set)
 	ficlBuild((*cmdp)->c_name, bf_command, FW_DEFAULT);
+
+    /* Set the version number */
+    ficlSetEnv("loader-version", 3100);
 
     /* try to load and run init file if present */
     if ((fd = open("/boot/boot.4th", O_RDONLY)) != -1) {

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199901121738.CAA00626>