home *** CD-ROM | disk | FTP | other *** search
- /*
- * 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.6 1992/04/26 23:32:06 mcooper Exp $";
- #endif
-
- /*
- * $Log: os-bsd43.c,v $
- * 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()
- {
- extern NAMETAB ModelTab[];
- extern struct nlist MachineIDNL[];
- static int machineid;
- register int i;
- kvm_t *kd;
-
- if (!(kd = KVM_open(MachineIDNL))) {
- if (Debug) Error("Cannot find MachineID symbol in kernel.");
- return((char *) NULL);
- }
-
- /*
- * See if we got a valid entry
- */
- if (CheckNlist(&MachineIDNL[0]))
- return((char *) NULL);
-
- if (KVM_read(kd, (u_long) MachineIDNL[0].n_value, (char *) &machineid,
- sizeof(machineid))) {
- if (Debug) Error("Cannot read machineid from kernel.");
- return((char *) NULL);
- }
-
- KVM_close(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);
- }
-