/* * System dependent file for BSDI and possibly BSD4.4 */ /* Andy Beals, Telebit */ /* LINTLIBRARY */ #include #include #include #include #include #include #include #ifndef MAXHOSTNAMELEN /* Some U*x deviants managed to not have this in sys/param.h */ # define MAXHOSTNAMELEN 64 #endif extern char *xmalloc(/* int nbytes */); extern int open(), read(); extern long lseek(); long cp_time[CPUSTATES]; long cp_old[CPUSTATES]; #define NPROCS 1 /* Called by -version */ void version() { printf("BSDI: maxcpu=%d, maxdisk=0\n", NPROCS); } /* Called at the beginning to inquire how many bars are needed. */ int num_bars() { return NPROCS; } /* Called after num_bars to ask for the bar names */ /* ARGSUSED */ char ** label_bars(nbars) { static char *name[NPROCS]; static char hname[MAXHOSTNAMELEN]; name[0] = hname; if (gethostname(name[0], MAXHOSTNAMELEN) < 0) { perror("gethostname"); *name[0] = '\0'; } return name; } /* * Called after the bars are created to perform any machine dependent * initializations. */ /* ARGSUSED */ void init_bars(nbars) int nbars; { struct cpustats s; int t = sizeof s, j; if(getkerninfo(KINFO_CPU, &s, &t, 0) == -1) { perror("getkerninfo"); for(j=0;j