[comp.sys.m88k] Small config program

newton@cit-vax.Caltech.Edu (Mike Newton) (02/19/90)

the following might be useful to some of you...

- mike

----------------------------------------------------------------
#include <unistd.h>
#include <sys/m88kbcs.h>

#include <stdio.h>

/* ignore all the warnings when compiling.  i got lazy. */


/* this should `really' work by doing an 'fgrep' for all variables
 * _SC_... in the above include files, and then automagically
 * calling sysconf with the associated values, but i dont want to do
 * this much parsing now.  -- MON */

/* If name is an invalid value, sysconf() shall return -1.  If the
 * variable corresponding to name is not defined on the system,
 * sysconf() shall return -1 without changing the value of errno.
 */



static char  * props[] =  {
          "_SC_ARG_MAX", _SC_ARG_MAX,
          "_SC_CHILD_MAX", _SC_CHILD_MAX,
          "_SC_CLK_TCK", _SC_CLK_TCK,
          "_SC_NGROUPS_MAX", _SC_NGROUPS_MAX,
          "_SC_OPEN_MAX", _SC_OPEN_MAX,
          "_SC_JOB_CONTROL", _SC_JOB_CONTROL,
          "_SC_SAVED_IDS", _SC_SAVED_IDS,
          "_SC_VERSION", _SC_VERSION,
/* the above are standard for all systems */
/* the below are dg specific, though many others probably use them */
          "_SC_BCS_VERSION", _SC_BCS_VERSION,
          "_SC_BCS_VENDOR_STAMP", _SC_BCS_VENDOR_STAMP,
          "_SC_BCS_SYS_ID", _SC_BCS_SYS_ID,
          "_SC_MAXUMEMV", _SC_MAXUMEMV,
          "_SC_MAXUPROC", _SC_MAXUPROC,
          "_SC_MAXMSGSZ", _SC_MAXMSGSZ,
          "_SC_NMSGHDRS", _SC_NMSGHDRS,
          "_SC_SHMMAXSZ", _SC_SHMMAXSZ,
          "_SC_SHMMINSZ", _SC_SHMMINSZ,
          "_SC_SHMSEGS", _SC_SHMSEGS,
/*           "_SC_NMSYSEM", _SC_NMSYSEM, */
          "_SC_MAXSEMVL", _SC_MAXSEMVL,
          "_SC_NSEMMAP", _SC_NSEMMAP,
          "_SC_NSEMMSL", _SC_NSEMMSL,
          "_SC_NSHMMNI", _SC_NSHMMNI,
          "_SC_ITIMER_VIRT", _SC_ITIMER_VIRT,
          "_SC_ITIMER_PROF", _SC_ITIMER_PROF,
          "_SC_TIMER_GRAN", _SC_TIMER_GRAN,
          "_SC_PHYSMEM", _SC_PHYSMEM,
          "_SC_AVAILMEM", _SC_AVAILMEM,
          "_SC_NICE", _SC_NICE,
          "_SC_MEMCTL_UNIT", _SC_MEMCTL_UNIT,
          "_SC_SHMLBA", _SC_SHMLBA,
          "_SC_SVSTREAMS", _SC_SVSTREAMS,
          "_SC_CPUID", _SC_CPUID,
	  0,0
	  };

main()
{
  register int i;		/* props index */

  printf("\n\n DG System parameters \n\n");

  for (i=0; props[i]; ) {
    printf("%30s  %8x  %12d\n", 
	   props[i++], 
	   sysconf(props[i]), 
	   sysconf(props[i++]));
  }
  printf("Warning: DGUX has been know to lie about _SC_CPUID, so\n");
  printf("use the PROM monitor to check this value\n");
}



-- 
newton@csvax.caltech.edu	Beach Bums Anonymous, Pasadena President
Caltech 256-80			(Hilo -- it's not just another rainy day!)
Pasadena CA 91125		Life's a beach.  Then you graduate.
-- 
newton@csvax.caltech.edu	Beach Bums Anonymous, Pasadena President
Caltech 256-80			(Hilo -- it's not just another rainy day!)
Pasadena CA 91125		Life's a beach.  Then you graduate.