1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-03 09:00:21 +00:00

Make it easier for programs to figure out what revision of FreeBSD they

are running under.  Here's how to bootstrap (order is important):

1) Re-compile gcc (just the driver is all you need).
2) Re-compile libc.
3) Re-compile your kernel.  Reboot.
4) cd /usr/src/include; make install

You can now detect the compilation environment with the following code:

#if !defined(__FreeBSD__)
#define __FreeBSD_version 199401
#elif __FreeBSD__ == 1
#define __FreeBSD_version 199405
#else
#include <osreldate.h>
#endif

You can determine the run-time environment by calling the new C library
function getosreldate(), or by examining the MIB variable kern.osreldate.

For the time being, the release date is defined as 199409, which we have
already established as our target.
This commit is contained in:
Garrett Wollman 1994-08-10 06:25:07 +00:00
parent 0a9783e5a2
commit 9ae159169a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=2004
5 changed files with 19 additions and 8 deletions

View File

@ -1,5 +1,5 @@
# From: @(#)Makefile 8.2 (Berkeley) 1/4/94
# $Id: Makefile,v 1.7 1994/08/04 20:49:28 wollman Exp $
# $Id: Makefile,v 1.8 1994/08/07 22:29:20 wollman Exp $
#
# Doing a make install builds /usr/include
#
@ -43,6 +43,11 @@ beforeinstall: ${SHARED}
install -c -o ${BINOWN} -g ${BINGRP} -m 444 $$i \
${DESTDIR}/usr/include/$$i; \
done
@echo creating osreldate.h
@rm -f ${DESTDIR}/usr/include/osreldate.h
@echo \#'undef __FreeBSD_version' > ${DESTDIR}/usr/include/osreldate.h
@echo \#'define __FreeBSD_version '`sysctl -n kern.osreldate` \
>> ${DESTDIR}/usr/include/osreldate.h
@echo installing ${DIRS}
@-for i in ${DIRS}; do \
if [ ! -d ${DESTDIR}/usr/include/$$i ]; \

View File

@ -7,10 +7,10 @@ SRCS+= alarm.c assert.c clock.c closedir.c confstr.c crypt.c ctermid.c \
ctime.c daemon.c devname.c difftime.c disklabel.c err.c errlst.c \
exec.c fnmatch.c frexp.c fstab.c fts.c getbsize.c getcap.c getcwd.c \
getdomainname.c getgrent.c getgrouplist.c gethostname.c getloadavg.c \
getlogin.c getmntinfo.c getnetgrent.c getpagesize.c getpass.c \
getpwent.c getttyent.c getusershell.c glob.c initgroups.c isatty.c \
nice.c nlist.c opendir.c pause.c popen.c psignal.c pwcache.c raise.c \
readdir.c rewinddir.c scandir.c seekdir.c setdomainname.c \
getlogin.c getmntinfo.c getnetgrent.c getosreldate.c getpagesize.c \
getpass.c getpwent.c getttyent.c getusershell.c glob.c initgroups.c \
isatty.c nice.c nlist.c opendir.c pause.c popen.c psignal.c pwcache.c \
raise.c readdir.c rewinddir.c scandir.c seekdir.c setdomainname.c \
sethostname.c setjmperr.c setmode.c siginterrupt.c siglist.c signal.c \
sigsetjmp.c sigsetops.c sleep.c sysconf.c sysctl.c syslog.c telldir.c \
termios.c time.c times.c timezone.c ttyname.c ttyslot.c ualarm.c \

View File

@ -32,7 +32,7 @@
# SUCH DAMAGE.
#
# @(#)newvers.sh 8.1 (Berkeley) 4/20/94
# $Id$
# $Id: newvers.sh,v 1.3 1994/08/02 07:38:27 davidg Exp $
if [ ! -r version ]
then
@ -43,6 +43,7 @@ touch version
v=`cat version` u=${USER-root} d=`pwd` h=`hostname` t=`date`
echo "char ostype[] = \"FreeBSD\";" > vers.c
echo "char osrelease[] = \"2.0.0 (Development)\";" >> vers.c
echo "int osreldate = 199409;" >> vers.c
echo "char sccs[4] = { '@', '(', '#', ')' };" >>vers.c
echo "char version[] = \"FreeBSD 2.0.0 (Development) #${v}: ${t}\\n ${u}@${h}:${d}\\n\";" >>vers.c

View File

@ -182,6 +182,7 @@ long hostid;
int securelevel = -1;
extern int vfs_update_wakeup;
extern int vfs_update_interval;
extern int osreldate;
/*
* kernel related system variables.
@ -212,6 +213,8 @@ kern_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
return (sysctl_rdint(oldp, oldlenp, newp, BSD));
case KERN_VERSION:
return (sysctl_rdstring(oldp, oldlenp, newp, version));
case KERN_OSRELDATE:
return (sysctl_rdint(oldp, oldlenp, newp, osreldate));
case KERN_MAXVNODES:
return(sysctl_int(oldp, oldlenp, newp, newlen, &desiredvnodes));
case KERN_MAXPROC:

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)sysctl.h 8.1 (Berkeley) 6/2/93
* $Id: sysctl.h,v 1.3 1994/08/08 00:30:12 wollman Exp $
* $Id: sysctl.h,v 1.4 1994/08/08 15:41:08 wollman Exp $
*/
#ifndef _SYS_SYSCTL_H_
@ -130,7 +130,8 @@ struct ctlname {
#define KERN_BOOTTIME 21 /* struct: time kernel was booted */
#define KERN_DOMAINNAME 22 /* string: YP domain name */
#define KERN_UPDATEINTERVAL 23 /* int: update process sleep time */
#define KERN_MAXID 24 /* number of valid kern ids */
#define KERN_OSRELDATE 24 /* int: OS release date */
#define KERN_MAXID 25 /* number of valid kern ids */
#define CTL_KERN_NAMES { \
{ 0, 0 }, \
@ -157,6 +158,7 @@ struct ctlname {
{ "boottime", CTLTYPE_STRUCT }, \
{ "domainname", CTLTYPE_STRING }, \
{ "update", CTLTYPE_INT }, \
{ "osreldate", CTLTYPE_INT }, \
}
/*