Obtain information stored in the system page.

#include <sys/procfs.h>

#define DCMD_PROC_SYSINFO   __DIOF(_DCMD_PROC, __PROC_SUBCMD_PROCFS + 0, procfs_sysinfo)

The arguments to devctl() are:

Argument Value
filedes A file descriptor for the process.
dev_data_ptr NULL, or an array of procfs_sysinfo structures
n_bytes 0, or the size of the array
dev_info_ptr A pointer to an integer where the required size can be stored

The argument is a pointer to a procfs_sysinfo structure that's filled in with the required information upon return. To get the whole system page, you have to make two calls: the first gets the size required:

devctl( fd, DCMD_PROC_SYSINFO, NULL, 0, &totalsize );

You then allocate a buffer of the required size and pass that buffer to the second call:

buffer = malloc( totalsize );
devctl( fd, DCMD_PROC_SYSINFO, buffer, totalsize, NULL );

The procfs_sysinfo structure is the same as the system page; for more information, see the System Page chapter of Building Embedded Systems.