Do a better fake for uname information returned in utssys() call.

Currently, the emulator defaults to returning "FreeBSD" as the system
name, release "3.2", and version "2.0".  Some programs want to make
sure they are on a SYSV 3.2 system and check for 3.X release number.

Use the following defines to override the defaults:
	IBCS2_UNAME_SYSNAME
	IBCS2_UNAME_RELEASE
	IBCS2_UNAME_VERSION
(should be string)
for system name, release, and version, respectively.  This allows
someone to compile the emulator into the kernel so it can pretend
to be a specific system if needed.
This commit is contained in:
swallace 1995-10-16 05:32:20 +00:00
parent 9d38676afa
commit a7a55e98e3
2 changed files with 26 additions and 7 deletions

View File

@ -232,15 +232,22 @@ ibcs2_utssys(p, uap, retval)
case 0: /* uname(2) */
{
struct ibcs2_utsname sut;
bzero(&sut, ibcs2_utsname_len);
bcopy(ostype, sut.sysname, sizeof(sut.sysname) - 1);
bcopy(hostname, sut.nodename, sizeof(sut.nodename));
sut.nodename[sizeof(sut.nodename)-1] = '\0';
bcopy(osrelease, sut.release, sizeof(sut.release) - 1);
bcopy("1", sut.version, sizeof(sut.version) - 1);
bcopy(machine, sut.machine, sizeof(sut.machine) - 1);
strncpy(sut.sysname, IBCS2_UNAME_SYSNAME, sizeof(sut.sysname));
strncpy(sut.release, IBCS2_UNAME_RELEASE, sizeof(sut.release));
strncpy(sut.version, IBCS2_UNAME_VERSION, sizeof(sut.version));
strncpy(sut.nodename, hostname, sizeof(sut.nodename));
strncpy(sut.machine, machine, sizeof(sut.machine));
sut.sysname[sizeof(sut.sysname)-1] = '\0';
sut.release[sizeof(sut.release)-1] = '\0';
sut.version[sizeof(sut.version)-1] = '\0';
sut.nodename[sizeof(sut.nodename)-1] = '\0';
sut.machine[sizeof(sut.machine)-1] = '\0';
DPRINTF(("IBCS2 uname: sys=%s rel=%s ver=%s node=%s mach=%s\n",
sut.sysname, sut.release, sut.version, sut.nodename,
sut.machine));
return copyout((caddr_t)&sut, (caddr_t)SCARG(uap, a1),
ibcs2_utsname_len);
}

View File

@ -33,6 +33,18 @@
#ifndef _IBCS2_UTSNAME_H
#define _IBCS2_UTSNAME_H
#ifndef IBCS2_UNAME_SYSNAME
#define IBCS2_UNAME_SYSNAME ostype
#endif
#ifndef IBCS2_UNAME_RELEASE
#define IBCS2_UNAME_RELEASE "3.2"
#endif
#ifndef IBCS2_UNAME_VERSION
#define IBCS2_UNAME_VERSION "2.0"
#endif
struct ibcs2_utsname {
char sysname[9];
char nodename[9];