This is os-bsd43.c in view mode; [Download] [Up]
/*
* Copyright (c) 1992 Michael A. Cooper.
* This software may be freely distributed provided it is not sold for
* profit and the author is credited appropriately.
*/
#ifndef lint
static char *RCSid = "$Header: /src/common/usc/bin/sysinfo/RCS/os-bsd43.c,v 1.7 1992/11/24 04:10:21 mcooper Exp $";
#endif
/*
* $Log: os-bsd43.c,v $
* Revision 1.7 1992/11/24 04:10:21 mcooper
* Use new KVM/nlist interface.
*
* Revision 1.6 1992/04/26 23:32:06 mcooper
* Add Copyright notice
*
* Revision 1.5 1992/04/17 23:27:51 mcooper
* Add support for ROM Version information (Sun only for now).
*
* Revision 1.4 1992/04/17 01:07:59 mcooper
* More de-linting
*
* Revision 1.3 1992/04/16 19:58:12 mcooper
* De-linting stuff.
*
* Revision 1.2 1992/04/15 02:04:16 mcooper
* Change GetMemoryStr() to GetMemory().
*
* Revision 1.1 1992/03/31 02:39:03 mcooper
* Initial revision
*
*/
/*
* 4.3BSD specific functions
*/
#include <stdio.h>
#include "system.h"
#include "defs.h"
#include <sys/types.h>
#include <nlist.h>
/*
* Get the system model name.
* 4.3BSD (MtXinu) keeps a kernel variable "machineid" which
* is the type of machine as defined in <machine/cpu.h>.
*/
extern char *GetModelName()
{
struct nlist *nlptr;
extern NAMETAB ModelTab[];
extern char MachineIDSYM[];
static int machineid;
register int i;
KVMt *kd;
if (!(kd = KVMopen()))
return((char *) NULL);
if ((nlptr = KVMnlist(kd, MachineIDSYM, (struct nlist *) NULL)) == NULL)
return((char *) NULL);
if (CheckNlist(nlptr))
return((char *) NULL);
if (KVMread(kd, (u_long) nlptr->n_value, (char *) &machineid,
sizeof(machineid))) {
if (Debug) Error("Cannot read machineid from kernel.");
return((char *) NULL);
}
KVMclose(kd);
for (i = 0; ModelTab[i].name; ++i)
if (ModelTab[i].value == machineid)
return(ModelTab[i].name);
if (Debug)
printf("system model/type %d is unknown.\n", machineid);
return((char *) NULL);
}
/*
* Get kernel version string from kernel symbol "version".
*/
extern char *GetKernelVersionStr()
{
return(GetKernelVersionFromVersion());
}
/*
* Get amount of physical memory using kernel symbol "physmem".
*/
extern char *GetMemory()
{
return(GetMemoryFromPhysmem());
}
/*
* Get system serial number
*/
extern char *GetSerialNoStr()
{
/* No support */
return((char *) NULL);
}
/*
* Get ROM Version
*/
extern char *GetRomVer()
{
/* No support */
return((char *) NULL);
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.