Path: utzoo!mnetor!uunet!mcvax!prlb2!kulcs!dannyb From: dannyb@kulcs.uucp (Danny Backx) Newsgroups: comp.unix.questions Subject: Re: Determining system memory Message-ID: <108@icarus.kulcs.uucp> Date: 4 Apr 88 13:42:30 GMT References: <248@lxn.UUCP> Reply-To: dannyb@kulcs.UUCP (Danny Backx) Organization: Katholieke Universiteit Leuven, Dept. Computer Science Lines: 29 In article <248@lxn.UUCP> chris@lxn.UUCP (Christopher D. Orr) writes: >I have been trying to find a nice, clean way to determine system >memory under SYS V 2.2. I have come up with two solutions to this >problem. However, there must be a cleaner/faster way :-). How about opening /dev/mem and seeking to the end ? The manual entry for lseek(2) says the return value is the position you got at. So, if you seek to the end (offset 0 relative to the EOF), the return value of lseek should be the amount of memory your system has. I don't know if this works on /dev/mem. It works on ordinary files. If your program works, this should, too. The system call you should issue is : long lseek(), pos ; pos = lseek(M, 0L, 2); Don't forget the declaration of lseek() !!! Danny -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Danny Backx | mail: Katholieke Universiteit Leuven Tel: +32 16 200656 x 3537 | Dept. Computer Science E-mail: dannyb@kulcs.UUCP | Celestijnenlaan 200 A ... mcvax!prlb2!kulcs!dannyb | B-3030 Leuven dannyb@blekul60.BITNET | Belgium