DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T l

⟦5ef47dfcb⟧ TextFile

    Length: 695 (0x2b7)
    Types: TextFile
    Names: »la.c«

Derivation

└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
    └─⟦this⟧ »EUUGD18/General/Cent/la.c« 

TextFile

#include <nlist.h>

loadav(avenrun)         /* Function storing 1,5,15 minute load averages in */
double *avenrun;        /* avenrun; should be declared double avenrun[3];  */
{                       /* Returns -1 if error, 0 otherwise.               */
    static struct nlist nl[] = {
	{"_avenrun"},
	{0},
    };
    static kmem = -17;

    if (kmem < 0)          /* Open necessary files. */
    {
	if ((kmem = open("/dev/kmem",0)) == -1)
	    return(-1);                         /* Cannot open. */
	nlist("/vmunix", nl);
    }
    if (lseek(kmem,(long)nl[0].n_value, 0) == -1 || 
      read(kmem,avenrun,3 * sizeof(double)) == -1)
	return(-1);    /* sizeof avenrun is 24. */
    return(0);
}