Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: notesnews 0.1 (unido 12/05/84); site unido.UUCP Path: utzoo!watmath!clyde!bonnie!akgua!mcnc!decvax!genrad!mit-eddie!think!harvard!seismo!mcvax!unido!ab From: ab@unido.UUCP Newsgroups: net.unix Subject: what is going on here ??? Message-ID: Date: Thu, 30-May-85 13:30:00 EDT Article-I.D.: unido.nf11400002 Posted: Thu May 30 13:30:00 1985 Date-Received: Mon, 24-Jun-85 04:27:20 EDT Sender: notes@unido.UUCP Lines: 43 Nf-ID: #N:unido:11400002:000:947 Nf-From: unido!ab May 30 15:30:00 1985 If you are running 4.2, look at the following short program and guess what it will do. Then compile and run it and find out what it really does. Try to explain its behavior!! (- Is it a bug in 4.2 ??? :-) ) Andreas -- Andreas Bormann ab@unido.UUCP University of Dortmund N 51 29' 05" E 07 24' 42" West Germany --- CUT HERE ---------- CUT HERE ---------- CUT HERE ---------- CUT HERE ---- #include #define NAMELIST "/vmunix" struct nlist avenrun[] = { { "_avenrun" }, { "" } }; main() { register int kmem; double avg[3]; if((kmem = open ("/dev/kmem", 0) < 0)) { printf("Cannot open kmem\n"); exit(1); } nlist(NAMELIST, avenrun); if(avenrun[0].n_type == 0) { printf("Cannot find avenrun\n"); exit(1); } lseek(kmem, (long) avenrun[0].n_value, 0); read(kmem, (char *) avg, 3 * sizeof (double)); printf("Load average: %f %f %f\n", avg[0], avg[1], avg[2]); exit(0); }