This message contains all you should need to get AUIS 6.3.3 going on an SGI5.2 system. We've run EZ successfully. (Printing didn't work, but that's probably because troff is in the wrong place or something.) We had to make a few niggly little changes, so there are some patches included, in addition to the necessary new files. You also take two files from the Solaris port :-). Share and enjoy, -wdc Manifest: inst/inst.c (patch) added a line for the sgi's to use mode_t instead of long for file modes, which made pinstall break on Irix 5.2 overhead/class/cmd/doindex.c (patch) changed it so that things done for sgi_4 aren't done for sgi_5, like dounload. config/andrew.rls (patch) added stuff to configure for the new Irix port also fixed the lack of the class library defines in the file -fixes overhead/class/testing/testmain config/platform.tmpl (patch) added stuff to configure for the new Irix port atk/console/stats/sgi_mips_52 new directory with stuff for Irix 5.2 port: Imakefile, getstats.c (included) config/sgi_52 new directory filled with system.h and system.mcr for Irix 5.2 (included) overhead/class/machdep/sgi_mips_52 new directory with stuff for the Irix 5.2 port: Imakefile, entry.c, makedo.csh (included) doload.[ch] (take them from your own machdep/sun_sparc_51 dir.) Configs: For site.mcr we added the following: ----8<---- site.mcr ---- #ifdef SGI_52_ENV #undef sgi /* can't have sgi be replaced by a 1 */ BASEDIR = /mit/andydevo/texport/6.3/sgi #ifdef AFS_ENV AFSBASEDIR = /afs/dev.mit.edu/project/andrew/build/sgi/afsbuild #endif /* AFS_ENV */ LAUNCHAPP = launchapp SHARED_LIB_PATH = -L/mit/andrew/6.3/sgi/lib -L/usr/andrew/lib -rpath /mit/andrew/6.3/sgi/lib:/usr/andrew/lib XBASEDIR = /usr/ XINCDIR = ${XBASEDIR}/include/X11 XLIBDIR = ${XBASEDIR}/lib XLIB = -lX11 #endif /* SGI */ ----8<---- site.h ----8<---- #ifdef SGI_52_ENV #define DEFAULT_ANDREWDIR_ENV /mit/andrew/6.3/sgi #ifdef ANDREW_MALLOC_ENV #undef ANDREW_MALLOC_ENV /* seems to have problem with PIC */ #endif /* ANDREW_MALLOC_ENV */ #ifdef DEBUG_MALLOC_ENV #undef DEBUG_MALLOC_ENV #endif /* DEBUG_MALLOC_ENV */ #ifndef FONTS_TO_PCF_ENV #define FONTS_TO_PCF_ENV 1 #endif #endif /* SGI */ ----8<---- END site.h ----8<---- Patches: ----8<----Cut Here ----8<---- *** /tmp/,RCSt1a28913 Wed Jul 5 20:45:14 1995 --- inst.c Wed Jul 5 20:44:21 1995 *************** *** 28,34 **** #ifndef NORCSID #define NORCSID ! static char rcsid[]="$Header: /afs/dev.mit.edu/project/andrew/auis-63/inst/RCS/inst.c,v 1.3 95/02/11 22:33:35 yoav Exp $"; #endif /* ALSO utimes and strip the file --- 28,34 ---- #ifndef NORCSID #define NORCSID ! static char rcsid[]="$Header: /afs/dev.mit.edu/project/andrew/auis-63/inst/RCS/inst.c,v 1.4 95/06/14 21:24:43 yoav Exp $"; #endif /* ALSO utimes and strip the file *************** *** 187,193 **** int argc; char **argv; {int setOwner, setMode, setGroup, ifd, ofd; ! long mode, owner, group; struct passwd *tpw; char *fnames[MAXFILES], *newNames[MAXFILES]; long rcode, code, newcode; --- 187,198 ---- int argc; char **argv; {int setOwner, setMode, setGroup, ifd, ofd; ! #ifdef sgi ! mode_t mode; ! #else ! long mode; ! #endif ! long owner, group; struct passwd *tpw; char *fnames[MAXFILES], *newNames[MAXFILES]; long rcode, code, newcode; *** /tmp/,RCSt1a28936 Wed Jul 5 20:48:52 1995 --- doindex.c Mon Jun 19 11:18:07 1995 *************** *** 29,35 **** #ifndef NORCSID #define NORCSID ! static char rcsid[]="$Header: /afs/dev.mit.edu/project/andrew/auis-63/overhead/class/cmd/RCS/doindex.c,v 1.2 95/02/11 17:37:47 yoav Exp $"; #endif /* --- 29,35 ---- #ifndef NORCSID #define NORCSID ! static char rcsid[]="$Header: /mit/andydevo/src/cmu/overhead/class/cmd/RCS/doindex.c,v 1.2 95/02/11 17:37:47 yoav Exp Locker: yoav $"; #endif /* *************** *** 427,433 **** entry->Ent.Version = info->versionnumber; entry->Ent.Data = entry->Name; ! #ifdef SGI_4D_ENV dounload(base, textlength); #else free(base); --- 427,433 ---- entry->Ent.Version = info->versionnumber; entry->Ent.Data = entry->Name; ! #if defined(SGI_4D_ENV) && !defined(SGI_52_ENV) dounload(base, textlength); #else free(base); *** /tmp/,RCSt1a28960 Wed Jul 5 20:54:17 1995 --- andrew.rls Mon Jun 19 12:56:03 1995 *************** *** 168,173 **** --- 168,174 ---- * Variables: * mips * SGI_4D_ENV + * SGI_52_ENV * NeXT * hpux ***************************************************/ *************** *** 402,408 **** #ifdef mips ! #ifdef SGI_4D_ENV #define ClassTestProgramTarget(program, objs, libs, syslibs) @@\ test:: program @@\ @@\ --- 403,409 ---- #ifdef mips ! #if defined(SGI_4D_ENV) && !defined(SGI_52_ENV) #define ClassTestProgramTarget(program, objs, libs, syslibs) @@\ test:: program @@\ @@\ *************** *** 418,423 **** --- 419,428 ---- clean:: @@\ $(RM) program sd_$@.o #else /* SGI_4D_ENV */ + #if defined(SGI_52_ENV) + #define ClassTestProgramTarget(program, objs, libs, syslibs) @@\ + TestProgramTarget(program, objs, libs, $(CLASSLDFLAGS) syslibs) + #else #define ClassTestProgramTarget(program, objs, libs, syslibs) @@\ test:: program @@\ @@\ *************** *** 440,445 **** --- 445,451 ---- @@\ clean:: @@\ $(RM) program + #endif /* SGI_52 */ #endif /* SGI */ #else /* mips */ #ifdef NeXT *************** *** 467,473 **** $(RM) program #else /* _IBMR2 */ #define ClassTestProgramTarget(program, objs, libs, syslibs) @@\ ! TestProgramTarget(program, objs, libs, syslibs) #endif /* _IBMR2 */ #endif /* NeXT */ #endif /* mips */ --- 473,479 ---- $(RM) program #else /* _IBMR2 */ #define ClassTestProgramTarget(program, objs, libs, syslibs) @@\ ! TestProgramTarget(program, objs, libs, $(CLASSLDFLAGS) syslibs) #endif /* _IBMR2 */ #endif /* NeXT */ #endif /* mips */ *************** *** 482,488 **** #ifdef mips ! #ifdef SGI_4D_ENV #define ClassProgramTarget(program, objs, libs, syslibs) @@\ all:: program @@\ @@\ --- 488,494 ---- #ifdef mips ! #if defined(SGI_4D_ENV) && !defined(SGI_52_ENV) #define ClassProgramTarget(program, objs, libs, syslibs) @@\ all:: program @@\ @@\ *************** *** 498,503 **** --- 504,517 ---- clean:: @@\ $(RM) program sd_$@.o #else /* SGI_4D_ENV */ + #ifdef SGI_52_ENV + #define ClassProgramTarget(program, objs, libs, syslibs) @@\ + all:: program @@\ + program: objs libs @@\ + $(RM) $@ @@\ + $(CC) $(CFLAGS) -o $@ objs libs $(CLASSLDFLAGS) syslibs @@\ + clean:: ; $(RM) program + #else #define ClassProgramTarget(program, objs, libs, syslibs) @@\ all:: program @@\ @@\ *************** *** 519,524 **** --- 533,539 ---- @@\ clean:: @@\ $(RM) program + #endif /* SGI_52_ENV */ #endif /* SGI_4D_ENV */ #else /* mips */ #if defined(hpux) && (HP_OS >= 80) *** /tmp/,RCSt1a28993 Wed Jul 5 20:58:46 1995 --- platform.tmpl Wed Jul 5 20:58:24 1995 *************** *** 191,198 **** #endif /* mach && ultrix */ #if defined(sgi) ! #include ! #define MacroIncludeFile sgi_4d/system.mcr #endif /* sgi */ /* Perhaps this should be #if defined(apollo) && defined(mc68020) ? */ --- 191,203 ---- #endif /* mach && ultrix */ #if defined(sgi) ! # if defined(IRIX4) ! # include ! # define MacroIncludeFile sgi_4d/system.mcr ! # else /* SVR4 == Irix 5.x */ ! # include ! # define MacroIncludeFile sgi_52/system.mcr ! # endif #endif /* sgi */ /* Perhaps this should be #if defined(apollo) && defined(mc68020) ? */ ----8<---- Files begin: atk/console/stats/sgi_mips_52/Imakefile ----8<---- /* ********************************************************************** *\ * Copyright IBM Corporation 1988,1991 - All Rights Reserved * * For full copyright information see:'andrew/config/COPYRITE' * \* ********************************************************************** */ LOCALINCLUDES = -I../../lib DependTarget() NormalObjectRule() LibraryTarget(libgs.a, getstats.o) ----8<---- Files begin: atk/console/stats/sgi_mips_52/getstats.c ----8<---- /* ********************************************************************** *\ * Copyright IBM Corporation 1988,1991 - All Rights Reserved * * For full copyright information see:'andrew/config/COPYRITE' * \* ********************************************************************** */ /* $Disclaimer: * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and that * both that copyright notice, this permission notice, and the following * disclaimer appear in supporting documentation, and that the names of * IBM, Carnegie Mellon University, and other copyright holders, not be * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. * * IBM, CARNEGIE MELLON UNIVERSITY, AND THE OTHER COPYRIGHT HOLDERS * DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT * SHALL IBM, CARNEGIE MELLON UNIVERSITY, OR ANY OTHER COPYRIGHT HOLDER * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. * $ */ #ifndef NORCSID #define NORCSID static char rcsid[]="$Header: /afs/cs.cmu.edu/project/atk-dist/auis-6.3/atk/console/stats/RCS/getstats.c,v 2.23 1993/11/23 20:34:06 gk5g Exp $"; #endif /* ********************************************************************** * This code is designed to read what might be priveledged (setuid) * information regarding both Disk Statistics (% full) and a host of * stats from /dev/kmem (including but not limited to, CPU, I/O, and VM) * * When retriving the data - this program will print out to stdout * a string in the form of either "%d:%d\n" or "%d:%d:%s\n" * The latter case is for passing the name of where a disk is mounted * back to the parent program. * * The parent program (Console, or any other program which wishes to get * at this information) is responsible for setting up a pipe, binding the * child's (this program) stdout to one end of a pipe, and parsing the * strings which are passed back. * * The basic string format is an ID (int), a colon, a value (int), and * optionally another colon followed by a string. The ID is coded from * the included file "getstats.h" - ID values 50 and over represent * ERRORS as documented in the above mentioned inclued file. When an * ERROR or the optional string is passed, the value (second parameter) * can be safely ignored, and is usually set to 0. * * The arguments to be passed to this program are the effective UID from * the parent program, a polling frequency (# of seconds) for checking * /dev/kmem (usually between 1 and 5, must be > 0), and a polling * frequency for checking how full the local disks are (generally higher * than the value for /dev/kmem, but could vary greatly). Thus the call * is: * * execvp("getstats", argv) * * with argv as: * * argv[0]="getstats"; * argv[1]=~ ("%d", UID); * argv[2]=~ ("%d", kmempollfrequency); * argv[3]=~ ("%d", diskpollfrequency); * argv[4]=NULL; * ********************************************************************** */ #ifdef AIX /* * just be stupid and fake something for testing... */ #include #include #include #define min(a, b) (((a) <= (b)) ? (a) : (b)) #define sendval(text) {printf text ;fflush(stdout);} main(argc, argv) int argc; char **argv; { int GVMPollFreq = 0, DiskPollFreq = 0, UsersID = 0; int time1 = 0, time2 = 0, sleepTime = 0; int cpuload = 0; int userload = 0; if (argc < 4){ sendval(("%d:%d\n", PARSE_ERR_1, 0)); exit(-1); } *argv++; UsersID = atoi(*argv++); if ((GVMPollFreq = atoi(*argv++)) < 1){ sendval(("%d:%d\n", PARSE_ERR_2, 0)); exit(-1); } if ((DiskPollFreq = atoi(*argv)) < 1){ sendval(("%d:%d\n", PARSE_ERR_2, 0)); exit(-1); } while (1){ /* for lack of a better loop for now? */ if (time1 < 1){ cpuload +=10; if (cpuload >= 100) cpuload = 0; sendval(("%d:%d\n", LOADCPU, cpuload)); time1 = GVMPollFreq; } if (time2 < 1){ userload +=5; if (userload >= 100) userload = 0; sendval(("%d:%d\n", LOADUSER, userload)); time2 = DiskPollFreq; } sleepTime = min(time1, time2); sleep(sleepTime); time1 -= sleepTime; time2 -= sleepTime; } } #else /* #ifdef AIX */ #include /* The following include defines sys_vax_20 for Vax release 2.0 op sys, */ /* since that particular OS needs some special treatment. We would have */ /* used -Dsys_vax_20 except we want to use the same Makefile for each cpu... */ /* Wrap In_Imake around andrewos.h because we don't want any include files from this, only the op-sys info. This is a hack that gets around the fact that andrewos.h now includes and so does below... Gawd! */ #define In_Imake #include #undef In_Imake #include #include #ifdef hpux #include #endif /* hpux */ #include #include #include #include #include #ifndef hpux /* included indirectly by sys.user.h above */ #include /* search namelist in vmunix */ #endif /* hpux */ #ifndef sys_vax_20 #include #endif /* sys_vax_20 */ #include #include #include #ifndef sys_vax_20 #ifndef sun #ifdef hpux #include #include #define MOUNTED MNT_MNTTAB #define fstab checklist #define FSTAB_RW CHECKLIST_RW #define FSTAB_RO CHECKLIST_RO #else /* hpux */ #include #include #endif /* hpux */ #ifndef hpux #include #endif /* hpux */ #ifndef VAX_ENV #include #endif /* VAX_ENV */ #else /* sun */ #include #include #include #include #include #include #include #endif /* sun */ #endif /* sys_vax_20 */ #ifdef sys_vax_20 #include #include /* sys/types.h strings.h */ #include #endif /* sys_vax_20 */ #ifdef sys_vax_20 struct fs_data *mountbuffer; #define MSIZE (NMOUNT*sizeof(struct fs_data)) #endif /* sys_vax_20 */ #ifndef MAXUPRC /* This is a constant in BSD, but */ long maxuprc = 0; /* we have to nlist in Ultrix */ #else /* MAXUPRC */ long maxuprc = MAXUPRC; #endif /* MAXUPRC */ #define VMMON_DODECL #include extern struct nlist RawStatistics[]; #ifndef sys_vax_20 #if ! (defined(sun) | defined(hpux)) struct mtab mtab[NMOUNT]; int fi; daddr_t alloc(); char *strcpy(); #endif /* ! (defined(sun) | defined(hpux)) */ #endif /* sys_vax_20 */ char root[32]; int TotalTime; int deficit; int MemoryFile /* file descriptor for unix memory */ ; int nproc; int SwapMapAddress; int nSwapMapEntries; int SwapMapSize; int nSwapBlks; int CurrentSwapUsed; int dmmax; off_t procp; struct mapent *SwapMap; struct proc proc[8];/* 8 = a few, for fewer syscalls */ struct proc *mproc; extern char *malloc(); struct{ long time[CPUSTATES]; long xfer[DK_NDRIVE]; struct vmmeter Rate; struct vmtotal Total; #ifdef sun struct ndstat ndstat; #endif /* sun */ long dk_xfer[DK_NDRIVE]; }s, s1; #ifndef sys_vax_20 union { struct fs iu_fs; char dummy[SBSIZE]; } sb; #endif /* sys_vax_20 */ #define rate s.Rate #define total s.Total #define sblock sb.iu_fs #define sendval(text) {printf text ;fflush(stdout);} GetGVMStats(UsersID) int UsersID; { register int i; long t; struct mapent *sp; lseek(MemoryFile,(long) RawStatistics[X_CPTIME].n_value, 0); read(MemoryFile, s.time, sizeof(s.time)); #ifdef sun if (RawStatistics[X_NDSTAT].n_value != 0){ lseek(MemoryFile,(long) RawStatistics[X_NDSTAT].n_value, 0); read(MemoryFile, &s.ndstat, sizeof(s.ndstat)); } #endif /* sun */ if (RawStatistics[X_NDSTAT].n_value == 0){ lseek(MemoryFile,(long) RawStatistics[X_DKXFER].n_value, 0); read(MemoryFile, s.dk_xfer, sizeof(s.dk_xfer)); } lseek(MemoryFile,(long) RawStatistics[X_RATE].n_value, 0); read(MemoryFile, &rate, sizeof(rate)); sp = SwapMap; lseek(MemoryFile, SwapMapAddress, 0); read(MemoryFile, sp, SwapMapSize); for (CurrentSwapUsed = nSwapBlks;sp->m_size;sp++){ CurrentSwapUsed -= sp->m_size; } lseek(MemoryFile,(long) RawStatistics[X_TOTAL].n_value, 0); read(MemoryFile, &total, sizeof(total)); lseek(MemoryFile,(long) RawStatistics[X_DEFICIT].n_value, 0); read(MemoryFile, &deficit, sizeof(deficit)); for (i = 0; i < CPUSTATES; i++) { t = s.time[i]; s.time[i] -= s1.time[i]; s1.time[i] = t; } s.time[1] += s.time[0]; TotalTime = 0; for (i = 1; i < CPUSTATES; i++) TotalTime += s.time[i]; if (TotalTime == 0) TotalTime = 1; sendval(("%d:%d\n", LOADCPU, (s.time[1] + s.time[2]) * 100 / TotalTime)); #ifdef sun if (RawStatistics[X_NDSTAT].n_value != 0){ int myval = 0; if (s1.ndstat.ns_rpacks == 0){ s1.ndstat = s.ndstat; } myval = s.ndstat.ns_rpacks - s1.ndstat.ns_rpacks + s.ndstat.ns_xpacks - s1.ndstat.ns_xpacks; if (myval > 100) myval = 100; sendval(("%d:%d\n", LOADIO, myval)); s1.ndstat = s.ndstat; } else #endif /* sun */ { int myval = 0; { register int i; for (i = 1; i < DK_NDRIVE - 1; i++) s.dk_xfer[0] += s.dk_xfer[i]; } if (s1.dk_xfer[0] == 0){ s1.dk_xfer[0] = s.dk_xfer[0]; } myval = s.dk_xfer[0] - s1.dk_xfer[0]; if (myval > 100) myval = 100; sendval(("%d:%d\n", LOADIO, myval)); s1.dk_xfer[0] = s.dk_xfer[0]; } sendval(("%d:%d\n", LOADUSER, s.time[1] * 100 / TotalTime)); sendval(("%d:%d\n", LOADSYS, s.time[2] * 100 / TotalTime)); sendval(("%d:%d\n", LOADIDLE, s.time[3] * 100 / TotalTime)); sendval(("%d:%d\n", VM, nSwapBlks ? CurrentSwapUsed * 100 / nSwapBlks : -1)); #if defined(sys_telmat) sendval(("%d:%d\n", PAGE_IN, rate.v_pgpgin / 2)); sendval(("%d:%d\n", PAGE_OUT, rate.v_pgpgout / 2)); #else /* sys_telmat */ sendval(("%d:%d\n", PAGEIN, rate.v_pgpgin / 2)); sendval(("%d:%d\n", PAGEOUT, rate.v_pgpgout / 2)); #endif /* sys_telmat */ sendval(("%d:%d\n", PAGEREPLACABLE, rate.v_scan)); sendval(("%d:%d\n", PAGEDEFICIT, deficit)); sendval(("%d:%d\n", MEMACTIVE, total.t_avm / 2)); sendval(("%d:%d\n", MEMFREE, total.t_free / 2)); sendval(("%d:%d\n", QUEUERUN, total.t_rq)); sendval(("%d:%d\n", QUEUEBLOCK, total.t_dw + total.t_pw)); sendval(("%d:%d\n", QUEUEMEM, total.t_sw)); sendval(("%d:%d\n", INTSIO, rate.v_intr)); sendval(("%d:%d\n", INTSSYS, rate.v_syscall)); sendval(("%d:%d\n", INTSSWAP, rate.v_swtch)); if (1) {/* DoPROCESSES */ int i, j, userprocesses, totalprocesses, otherprocs; off_t tmpprocp; userprocesses = 0; totalprocesses = 1; otherprocs = 0; tmpprocp = procp; for (i = 0; i < nproc; i += 8) { lseek(MemoryFile, (long) tmpprocp, 0); j = nproc - i; if (j > 8) j = 8; j *= sizeof(struct proc); if (read(MemoryFile, (char *) proc, j) != j) { sendval(("%d:%d\n", GVM_ERR_1, 0)); exit(-1); } tmpprocp += j; for (j = j / sizeof(struct proc) - 1; j >= 0; j--) { mproc = &proc[j]; if (mproc->p_pid != 0) { totalprocesses++; if (UsersID == mproc->p_uid) { userprocesses ++; } else if (mproc->p_uid) { otherprocs++; } } } } sendval(("%d:%d\n", PROCSUSER, maxuprc ? (userprocesses * 100) / maxuprc : -1)); sendval(("%d:%d\n", PROCSTOTAL, nproc ? totalprocesses * 100 / nproc : -1)); sendval(("%d:%d\n", PROCSOTHER, otherprocs)); } #ifdef sun if (s1.ndstat.ns_rpacks == 0) s1.ndstat = s.ndstat; sendval(("%d:%d\n", NDSTATIN, s.ndstat.ns_rpacks - s1.ndstat.ns_rpacks)); sendval(("%d:%d\n", NDSTATOUT, s.ndstat.ns_xpacks - s1.ndstat.ns_xpacks)); sendval(("%d:%d\n", NDSTATERR, s.ndstat.ns_utimo - s1.ndstat.ns_utimo + s.ndstat.ns_stimo - s1.ndstat.ns_stimo)); s1.ndstat = s.ndstat; #endif /* sun */ } InitGVMStats() { time_t bootime; int code = 0; /* set up Unix interface: scan name list for current system addresses and then open a file which is the memory image of the system. */ code = nlist(_SITE_VMUNIX, RawStatistics); if (code == -1){ sendval(("%d:%d\n", GVM_ERR_2, 0)); exit(-1); } else{ if (RawStatistics[0].n_type == 0){ sendval(("%d:%d\n", GVM_ERR_3, 0)); exit(-1); } } MemoryFile = open(_SITE_DEV_KMEM, 0); if (MemoryFile < 0){ sendval(("%d:%d\n", GVM_ERR_4, 0)); exit(-1); } lseek(MemoryFile,(long) RawStatistics[X_BOOTIME].n_value, 0); read(MemoryFile, &bootime, sizeof(bootime)); lseek(MemoryFile, (long) RawStatistics[X_PROC].n_value, 0); read(MemoryFile,(char *) &procp, sizeof(procp)); lseek(MemoryFile, (long) RawStatistics[X_NPROC].n_value, 0); read(MemoryFile,(char *) &nproc, sizeof(nproc)); #ifdef sun /* * Even if there is an nd driver in the system, we may not actually be * a client. If the nd driver has never been used, ignore it. */ if (RawStatistics[X_NDSTAT].n_value){ lseek(MemoryFile,(long) RawStatistics[X_NDSTAT].n_value, 0); read(MemoryFile, &s.ndstat, sizeof(s.ndstat)); if (s.ndstat.ns_xpacks == 0 || s.ndstat.ns_rpacks == 0) RawStatistics[X_NDSTAT].n_value = 0; } #endif /* sun */ #ifndef MAXUPRC lseek(MemoryFile, (long) RawStatistics[X_MAXUPRC].n_value, 0); read(MemoryFile,(char *) &maxuprc, sizeof(maxuprc)); #endif /* MAXUPRC */ lseek(MemoryFile,(long) RawStatistics[X_SWAPMAP].n_value, 0); read(MemoryFile, &SwapMapAddress, sizeof(SwapMapAddress)); SwapMapAddress += sizeof(struct map); lseek(MemoryFile,(long) RawStatistics[X_NSWAPMAP].n_value, 0); read(MemoryFile, &nSwapMapEntries, sizeof(nSwapMapEntries)); SwapMapSize = (--nSwapMapEntries)*sizeof(struct mapent); lseek(MemoryFile,(long) RawStatistics[X_NSWAPBLKS].n_value, 0); read(MemoryFile, &nSwapBlks, sizeof(nSwapBlks)); lseek(MemoryFile,(long) RawStatistics[X_DMMAX].n_value, 0); read(MemoryFile, &dmmax, sizeof(dmmax)); nSwapBlks -= dmmax/2; /* See vm_sw.c--initialization of swap space */ SwapMap = (struct mapent *) malloc(SwapMapSize); } /* the DeviceTable keeps a list of all the devices (and their mounted directory file name) that we should watch */ extern int getmnt(); GetDiskStats(Init) int Init; { int i = 0; #ifdef sys_vax_20 register int ret = 0; register struct fs_data *fd; int loc = 0; #else /* sys_vax_20 */ #if (defined(sun) | defined(hpux)) struct stat statb; char tmpname[1024]; register FILE *mtabp; register struct mntent *mnt; #else /* (defined(sun) | defined(hpux)) */ struct fstab *fsp; #endif /* (defined(sun) | defined(hpux)) */ #endif /* sys_vax_20 */ #ifdef sys_vax_20 if(Init){ mountbuffer = (struct fs_data *) malloc(MSIZE); } ret = getmnt(&loc, mountbuffer, MSIZE, NOSTAT_MANY, NULL); if (ret < 0) { sendval(("%d:%d\n", DISK_ERR_6, 0)); exit(1); } i = DISK1; for (fd=mountbuffer; fd < &mountbuffer[ret]; fd++) { print_df(i++, fd, Init); } #else /* sys_vax_20 */ #if (defined(sun) | defined(hpux)) sync(); if ((mtabp = setmntent(MOUNTED, "r")) == NULL) { sendval(("%d:%d\n", DISK_ERR_1, 0)); exit(1); } i = DISK1 - 1; /* figuratively 0 */ while ((mnt = getmntent(mtabp)) != NULL) { i++; if (strcmp(mnt->mnt_type, MNTTYPE_IGNORE) == 0 || strcmp(mnt->mnt_type, MNTTYPE_SWAP) == 0) continue; #ifdef sun if (strcmp(mnt->mnt_type, MNTTYPE_42) == 0 && (stat(mnt->mnt_fsname, &statb) >= 0) && (((statb.st_mode & S_IFMT) == S_IFBLK) || ((statb.st_mode & S_IFMT) == S_IFCHR))) { (void) strcpy(tmpname, mnt->mnt_fsname); dfree1(i, tmpname, 0, Init); } else { dfree2(i, mnt->mnt_dir, mnt, Init); } #endif /* sun */ } (void) endmntent(mtabp); #else /* (defined(sun) | defined(hpux)) */ i = open(_SITE_MTAB, 0); if (i >= 0) { (void) read(i, (char *)mtab, sizeof (mtab)); (void) close(i); } sync(); if (setfsent() == 0){ sendval(("%d:%d\n", DISK_ERR_5, 0)); exit(1); } i = DISK1 - 1; /* figuratively 0 */ while (fsp = getfsent()) { i++; #ifdef hpux if (strcmp(fsp->fs_type, FSTAB_RW) && strcmp(fsp->fs_type, FSTAB_RO)) continue; #else /* hpux */ if (strcmp(fsp->fs_type, FSTAB_RW) && strcmp(fsp->fs_type, FSTAB_RO) && strcmp(fsp->fs_type, FSTAB_RQ)) continue; #endif /* hpux */ if (root[0] == 0){ (void) strcpy(root, fsp->fs_spec); } dfree1(i, fsp->fs_spec, 1, Init); } endfsent(); #endif /* (defined(sun) | defined(hpux)) */ #endif /* sys_vax_20 */ } #ifndef sys_vax_20 int bread(fi, bno, buf, cnt) int fi; daddr_t bno; char *buf; int cnt; { extern int errno; (void) lseek(fi, (long)(bno * DEV_BSIZE), 0); #ifndef sun if (read(fi, buf, cnt) != cnt) #else /* sun */ if (read(fi, buf, (unsigned) cnt) < 0) #endif /* sun */ { /* probably a dismounted disk if errno == EIO */ if (errno != EIO) { sendval(("%d:%d\n", DISK_ERR_5, 0)); } return (0); } return (1); } #endif /* sys_vax_20 */ /* * Given a name like /dev/rrp0h, returns the mounted path, like /usr. */ #ifndef sys_vax_20 char *mpath(file) char *file; { #if defined(sun) | defined(hpux) FILE *mntp; register struct mntent *mnt; #else /* defined(sun) | defined(hpux) */ register struct mtab *mp; #endif /* defined(sun) | defined(hpux) */ #if defined(sun) | defined(hpux) if ((mntp = setmntent(MOUNTED, "r")) == 0) { sendval(("%d:%d\n", DISK_ERR_1, 0)); exit(1); } while ((mnt = getmntent(mntp)) != 0) { if (strcmp(file, mnt->mnt_fsname) == 0) { (void) endmntent(mntp); return (mnt->mnt_dir); } } (void) endmntent(mntp); #else /* defined(sun) | defined(hpux) */ if (eq(file, root)){ return ("/"); } for (mp = mtab; mp < mtab + NMOUNT; mp++){ if (eq(file, mp->m_dname)){ return (mp->m_path); } } #endif /* defined(sun) | defined(hpux) */ return ""; } #endif /* sys_vax_20 */ #ifndef sys_vax_20 #ifndef sun eq(f1, f2) char *f1, *f2; { if (strncmp(f1, "/dev/", 5) == 0) f1 += 5; if (strncmp(f2, "/dev/", 5) == 0) f2 += 5; if (!strcmp(f1, f2)) return (1); if (*f1 == 'r' && !strcmp(f1+1, f2)) return (1); if (*f2 == 'r' && !strcmp(f1, f2+1)) return (1); if (*f1 == 'r' && *f2 == 'r' && strcmp(f1+1, f2+1) == 0) return (1); return (0); } #endif /* sun */ #endif /* sys_vax_20 */ int round(num) double num; { int inum = (int) num; return(((num - inum) >= 0.5) ? (inum + 1) : inum); } #ifdef sys_vax_20 print_df(id, fd, Init) int id; register struct fs_data *fd; int Init; { register int used; used = fd->fd_btot - fd->fd_bfree; if (Init){ sendval(("%d:%d:%s\n", id, 0, fd->fd_path)); } else{ sendval(("%d:%d\n", id, fd->fd_btot == 0 ? 0 : round(used / (double)(fd->fd_btot - (fd->fd_bfree - fd->fd_bfreen)) * 100.0))); } } #endif /* sys_vax_20 */ #ifndef sys_vax_20 dfree1(id, file, infsent, Init) int id; char *file; int infsent; int Init; { long totalblks, availblks, free, used; int fi; #ifndef sun struct stat stbuf; struct fstab *fsp; if (stat(file, &stbuf) == 0 && (stbuf.st_mode&S_IFMT) != S_IFCHR && (stbuf.st_mode&S_IFMT) != S_IFBLK) { if (infsent) { sendval(("%d:%d\n", DISK_ERR_3, 0)); return; } setfsent(); while (fsp = getfsent()) { struct stat stb; if (stat(fsp->fs_spec, &stb) == 0 && stb.st_rdev == stbuf.st_dev) { file = fsp->fs_spec; endfsent(); goto found; } } endfsent(); sendval(("%d:%d\n", DISK_ERR_4, 0)); return; } found: fi = open(file, 0); #else /* sun */ fi = open(file, 0); #endif /* sun */ if (fi < 0){ return; } if (bread(fi, SBLOCK, (char *)&sblock, SBSIZE) == 0) { (void) close(fi); return; } totalblks = sblock.fs_dsize; free = sblock.fs_cstotal.cs_nbfree * sblock.fs_frag + sblock.fs_cstotal.cs_nffree; used = totalblks - free; availblks = totalblks * (100 - sblock.fs_minfree) / 100; if(Init){ sendval(("%d:%d:%s\n", id, 0, mpath(file))); } else{ sendval(("%d:%d\n", id, availblks == 0 ? 0 : round((double) used / (double) availblks * 100.0))); } (void) close(fi); } #endif /* sys_vax_20 */ #ifdef sun dfree2(id, file, mnt, Init) int id; char *file; struct mntent *mnt; int Init; { struct statfs fs; long totalblks, avail, free, used, reserved; if (statfs(file, &fs) < 0) { return; } totalblks = fs.f_blocks; free = fs.f_bfree; used = totalblks - free; avail = fs.f_bavail; reserved = free - avail; if (avail < 0) avail = 0; totalblks -= reserved; if(Init){ sendval(("%d:%d:%s\n",id, 0, mnt->mnt_dir)); } else{ sendval(("%d:%d\n", id, round((double) used / (double) totalblks * 100.0))); } } #endif /* sun */ #define min(a, b) (((a) <= (b)) ? (a) : (b)) main(argc, argv) int argc; char **argv; { int GVMPollFreq = 0, DiskPollFreq = 0, UsersID = 0; int time1 = 0, time2 = 0, sleepTime = 0; if (argc < 4){ sendval(("%d:%d\n", PARSE_ERR_1, 0)); exit(-1); } *argv++; UsersID = atoi(*argv++); if ((GVMPollFreq = atoi(*argv++)) < 1){ sendval(("%d:%d\n", PARSE_ERR_2, 0)); exit(-1); } if ((DiskPollFreq = atoi(*argv)) < 1){ sendval(("%d:%d\n", PARSE_ERR_2, 0)); exit(-1); } InitGVMStats(); GetDiskStats(1); while (1){ /* for lack of a better loop for now? */ if (time1 < 1){ GetGVMStats(UsersID); time1 = GVMPollFreq; } if (time2 < 1){ GetDiskStats(0); time2 = DiskPollFreq; } sleepTime = min(time1, time2); sleep(sleepTime); time1 -= sleepTime; time2 -= sleepTime; } } #endif /* #ifdef AIX */ ----8<---- Files begin: config/sgi_52/system.h ----8<---- /* ********************************************************************** *\ * Copyright IBM Corporation 1988,1991 - All Rights Reserved * * For full copyright information see:'andrew/config/COPYRITE' * \* ********************************************************************** */ /* $Disclaimer: * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and that * both that copyright notice, this permission notice, and the following * disclaimer appear in supporting documentation, and that the names of * IBM, Carnegie Mellon University, and other copyright holders, not be * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. * * IBM, CARNEGIE MELLON UNIVERSITY, AND THE OTHER COPYRIGHT HOLDERS * DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT * SHALL IBM, CARNEGIE MELLON UNIVERSITY, OR ANY OTHER COPYRIGHT HOLDER * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. * $ */ #ifndef SYSTEM_H #define SYSTEM_H /* Get common definitions */ #include #define OPSYSNAME "IRIX" #define sys_sgi_52 1 #define SYS_NAME "sgi_52" #define SGI_52_ENV #define SGI_4D_ENV /* most of the stuff that applies to it applies to here */ /* Here follow the overrides for this system. */ #ifndef HAVE_SHARED_LIBRARIES #define HAVE_SHARED_LIBRARIES 1 #endif #ifndef LIBDL_ENV #define LIBDL_ENV 1 #endif #ifndef NO_SHARED_DIR #define NO_SHARED_DIR 1 #endif #undef SY_U54 #define SY_U54 1 /* IRIX-5 is most like SysVR4. */ #define BUILDANDREWINSTALL_ENV 1 #define USE_MLD_ENV 1 #define CLASS_CTRAMPOLINE_ENV 1 #ifndef In_Imake #include #undef SIGSET_TYPE #define SIGSET_TYPE sigset_t #include /* includes sys/types.h */ #include #define index strchr #define rindex strrchr #include #include #include #define DIRENT_TYPE struct dirent #define DIRENT_NAMELEN(d) (strlen((d)->d_name)) #define NEWPGRP() setpgrp() #include #include #define getdtablesize() _NFILE #define OSI_HAS_SYMLINKS 1 #define osi_readlink(PATH,BUF,SIZE) readlink((PATH),(BUF),(SIZE)) #define osi_ExclusiveLockNoBlock(fid) lockf((fid), F_TLOCK, 0) #define osi_UnLock(fid) lockf((fid), F_ULOCK, 0) #define osi_O_READLOCK O_RDWR #define osi_F_READLOCK "r+" #define osi_vfork() fork() #define osi_setjmp _setjmp #define osi_longjmp _longjmp /* Make a time standard. */ struct osi_Times {unsigned long int Secs; unsigned long int USecs;}; /* Set one of the above with a call to osi_GetTimes(&foo) */ #define osi_GetSecs() time((long int *) 0) #define osi_SetZone() tzset() #define osi_ZoneNames tzname #define osi_SecondsWest timezone #define osi_IsEverDaylight daylight #include #define HAS_SYSEXITS 1 #define NOMETAMAIL 1 #define POSIX_ENV 1 #ifndef IN_ATKOS_LIB #include #endif #endif /* !In_Imake */ /* Now follow the site-specific customizations. */ #include #endif /* SYSTEM_H */ ----8<---- Files begin: config/sgi_52/system.mcr ----8<---- /* Copyright IBM Corporation 1988,1989 - All Rights Reserved */ /* $Disclaimer: # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose is hereby granted without fee, # provided that the above copyright notice appear in all copies and that # both that copyright notice, this permission notice, and the following # disclaimer appear in supporting documentation, and that the names of # IBM, Carnegie Mellon University, and other copyright holders, not be # used in advertising or publicity pertaining to distribution of the software # without specific, written prior permission. # # IBM, CARNEGIE MELLON UNIVERSITY, AND THE OTHER COPYRIGHT HOLDERS # DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING # ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT # SHALL IBM, CARNEGIE MELLON UNIVERSITY, OR ANY OTHER COPYRIGHT HOLDER # BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY # DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE # OF THIS SOFTWARE. # $ */ /* For full copyright information see:'andrew/config/COPYRITE' */ /* The next two lines need to be kept in sync */ #define In_Imake 1 #include SYSTEM_H_FILE = sgi_52/system.h #undef In_Imake /* These next two lines help configure the embedded machine-dependent directories overhead/class/machdep, atk/console/stats, and atk/console/stats/common. */ SYS_IDENT = sgi_mips_52 SYS_OS_ARCH = sgi_mips_52 /* Get parent inclusions */ #include /* Now for the system-dependent information. */ XSRCDIR = /usr/src/X11R4/mit/ XBASEDIR = XUTILDIR = /usr/bin/X11 RANLIB = echo ranlib is not needed on this system CLASSLIB = -L$(BASEDIR)/lib -lclass /* MIPS' compiler seems to have the standard set of PCC bugs dealing with * void... * The -G 0 is to prevent dynamically loadable modules from having global * area sections. * The -Wl,D,8000000 switch is to move the data area down and * the -Wl,T,4000000 switch is to move the text area up so that * dynamically loaded routines are addressible within the 28 bit jump * offset limit of the MIPS architecture. */ #ifdef ReadObjects CC = cc -G 0 -cckr "-Wl,-D,8000000" "-Wl,-T,4000000" CCNOGO = cc -cckr "-Wl,-D,8000000" "-Wl,-T,4000000" #else /* Do mmap instead */ CC = cc -G 0 -cckr CCNOG0 = cc -cckr #endif #ifdef (GNU_ENV) PICFLAGS = -fpic #else PICFLAGS = #endif STD_DEFINES = -DSYSV /* -D_BSD_SIGNALS */ SYS_LIBRARIES = -lsun MMDFLIBS = -lmld SHLIBLDFLAGS = -shared MKSDPOOL = ${BASEDIR}/etc/mksdpool /* Set path to the standard libc.a and crt0.o files */ CLIB = /usr/lib/libc_s.a CRT0PATH = /usr/lib/crt1.o /usr/lib/crtn.o SUPLIBS = $(BASEDIR)/lib/libatkos.a /* Get site-specific inclusions */ #include SYS_CONFDIR = sgi_52 ---8<-- Files begin: overhead/class/machdep/sgi_mips_52/Imakefile ---8<--- /* ********************************************************************** *\ * Copyright IBM Corporation 1988,1991 - All Rights Reserved * * For full copyright information see:'andrew/config/COPYRITE' * \* ********************************************************************** */ /* $Disclaimer: * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and that * both that copyright notice, this permission notice, and the following * disclaimer appear in supporting documentation, and that the names of * IBM, Carnegie Mellon University, and other copyright holders, not be * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. * * IBM, CARNEGIE MELLON UNIVERSITY, AND THE OTHER COPYRIGHT HOLDERS * DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT * SHALL IBM, CARNEGIE MELLON UNIVERSITY, OR ANY OTHER COPYRIGHT HOLDER * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. * $ */ DependTarget() NormalObjectRule() STD_DEFINES = $(PICFLAG) all:: doload.o entry.o InstallCshScript(makedo.csh, $(DESTDIR)/bin/makedo) ---8<-- Files begin: overhead/class/machdep/sgi_mips_52/entry.c ---8<--- #ifdef __STDC__ #define ClassEntry(n) \ int (*ClassEntry ## n) (); #else #define ClassEntry(n) \ int(*ClassEntry/**/n) (); #endif #include <../common/entrydefs.h> ---8<-- Files begin: overhead/class/machdep/sgi_mips_52/makedo.csh ---8<--- #!/bin/csh -f ## ###################################################################### ## ## Copyright IBM Corporation 1988,1991 - All Rights Reserved ## ## For full copyright information see:'andrew/config/COPYRITE' ## ## ###################################################################### ## # $Disclaimer: # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose is hereby granted without fee, # provided that the above copyright notice appear in all copies and that # both that copyright notice, this permission notice, and the following # disclaimer appear in supporting documentation, and that the names of # IBM, Carnegie Mellon University, and other copyright holders, not be # used in advertising or publicity pertaining to distribution of the software # without specific, written prior permission. # # IBM, CARNEGIE MELLON UNIVERSITY, AND THE OTHER COPYRIGHT HOLDERS # DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING # ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT # SHALL IBM, CARNEGIE MELLON UNIVERSITY, OR ANY OTHER COPYRIGHT HOLDER # BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY # DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE # OF THIS SOFTWARE. # $ # Script to convert normal object files into a dynamically loadable module. if (! $?ANDREWDIR) setenv ANDREWDIR /usr/andrew if ("$*" == "") then echo "usage: makedo [-o outfile] [-b bindir] [-d libdir] [-e entrypoint] [-g] files..." echo " -b overrides /usr/andrew/bin for finding dofix, dotest" echo " -d overrides ${ANDREWDIR}/lib for finding libcx.a" echo " -e overrides the default entry point" echo " -g causes .dog file to be generated for debugger use" exit 1 endif set filelist set bindir="${ANDREWDIR}/bin" set libdir="${ANDREWDIR}/lib" foreach file ($*) if ($?outcoming) then set outfile=$file unset outcoming continue endif if ($?bincoming) then set bindir=$file unset bincoming continue endif if ($?libcoming) then set libdir=$file unset libcoming continue endif if ($?entrypointcoming) then set entrypoint=$file unset entrypointcoming continue endif switch ($file) case -o: set outcoming breaksw case -b: set bincoming breaksw case -d: set libcoming breaksw case -e: set entrypointcoming breaksw case -g: set gflag breaksw default: if (! $?outfile) set outfile=$file set filelist=($filelist $file) endsw end if ($?outcoming) then echo "makedo: missing argument to -o switch." exit 1 endif if ($?bincoming) then echo "makedo: missing argument to -b switch." exit 1 endif if ($?libcoming) then echo "makedo: missing argument to -d switch." exit 1 endif if ($?entrypointcoming) then echo "makedo: missing argument to -e switch." exit 1 endif if (! $?filelist) then echo "makedo: No object modules given." exit 1 endif if (! $?entrypoint) then set entrypoint=_${outfile:r}__GetClassInfo endif ld -shared -o ${outfile:r}.do \ $filelist -L${libdir} -lclass /usr/lib/crtn.o | egrep "ld:" exit(0) # errr.. okay.. for some reason ld exits with a 1 here... :-( ---8<--END overhead/class/machdep/sgi_mips_52/makedo.csh ---8<---