COHERENT manpages
This page displays the COHERENT manpage for freemem [Device that indicates amount of memory that is free].
List of available manpages
Index
freemem -- Device Device that indicates amount of memory that is free /dev/freemem /dev/freemem is the device from which you can read the system's free memory at any given moment. It has major device 0, the same as /dev/null and /dev/cmos; and minor number 12. This non-portable device node is used exclusively for tracking the amount of free memory in the system. Its driver recognizes the system calls open(), close(), read(), and ioctl(), but not write(). Example The following program prints the amount of free memory in your system. #include <fcntl.h> #include <sys/null.h> #include <stdlib.h> main() { FREEMEM freemem; int fm_fd; fm_fd = open("/dev/freemem", O_RDONLY); if (fm_fd >= 0) { ioctl (fm_fd, NLFREE, &freemem); close (fm_fd); printf ("Available memory: %d kilobytes\n", freemem.avail_mem); printf ("Free memory: %d kilobytes\n", freemem.free_mem); } else printf("Cannot open /dev/freemem\n"); } See Also device drivers, hmon, ioctl(), null