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-aix.c,v 1.5 1992/04/26 23:32:06 mcooper Exp $";
- #endif
-
- /*
- * $Log: os-aix.c,v $
- * Revision 1.5 1992/04/26 23:32:06 mcooper
- * Add Copyright notice
- *
- * Revision 1.4 1992/04/17 23:27:51 mcooper
- * Add support for ROM Version information (Sun only for now).
- *
- * Revision 1.3 1992/04/17 01:07:59 mcooper
- * More de-linting
- *
- * Revision 1.2 1992/04/15 02:04:16 mcooper
- * Change GetMemoryStr() to GetMemory().
- *
- * Revision 1.1 1992/03/28 23:57:38 mcooper
- * Initial revision
- *
- */
-
-
- /*
- * AIX specific functions
- */
-
- #include <stdio.h>
- #include "system.h"
- #include "defs.h"
-
- #include <sys/utsname.h>
-
- /*
- * Get the system model name.
- */
- extern char *GetModelName()
- {
- extern NAMETAB ModelTab[];
- struct utsname utsname;
- register int i, type;
- register char *p;
-
- if (uname(&utsname) == SYSFAIL) {
- if (Debug) Error("uname() failed: %s.", SYSERR);
- return((char *) NULL);
- }
-
- /*
- * XXX HARDCODED value
- *
- * The following assumes that utsname.machine is of format
- *
- * xxyyyyyyMMss
- *
- * xx = 00 (always)
- * yyyyyy = unique CPU ID
- * MM = model number
- * ss = 00 (always)
- */
- if (strlen(utsname.machine) != 12) {
- if (Debug) Error("The format of utsname.machine has changed!");
- return((char *) NULL);
- }
- p = utsname.machine;
- p += 8;
- if (strlen(p) > 2)
- *(p+2) = (char)NULL;
-
- for (i = 0; ModelTab[i].name; ++i)
- if (EQ(p, ModelTab[i].valuestr))
- return(ModelTab[i].name);
-
- if (Debug)
- Error("system model/type %s is unknown.\n", p);
-
- 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 name of OS
- */
- extern char *GetOSNameStr()
- {
- return(GetOSNameFromUname());
- }
-
- /*
- * Get version of OS
- */
- extern char *GetOSVersionStr()
- {
- return(GetOSVersionFromUname());
- }
-
- /*
- * Get ROM Version
- */
- extern char *GetRomVer()
- {
- /* No support */
- return((char *) NULL);
- }
-