Technical data

openprom(7D) Devices SunOS 5.5
OPROMNXT, OPROMCHILD,OPROMGETPROP, and OPROMNXTPROP
These ioctls provide an interface to the raw config_ops opera-
tions in thePROM monitor. One can use them to traverse the
system device tree; see prtconf(1M).
OPROMGETVERSION This ioctl returns an arbitrary and platform-dependent
NULL-terminated string in oprom_array, representing the
underlying version of the firmware.
ERRORS EAGAIN There are too many opens of the /dev/openprom device.
EFAULT A bad address has been passed to an ioctl(2) routine.
EINVAL The size value was invalid, or (for OPROMSETOPT) the property does
not exist, or and invalid ioctl is being issued.
ENOMEM The kernel could not allocate space to copy the user’s structure.
EPERM Attempts have been made to write to a read-only entity, or read from a
write only entity.
ENXIO Attempting to open a non-existent device.
EXAMPLES The following example shows how the oprom_array is reused for the copied out data.
/
This program opens the openprom device and prints the platform
name (root node name property) and the prom version.
NOTE: /dev/openprom is readable only by user ’root’ or group ’sys’.
/
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/openpromio.h>
#define BUFSZ 4096 /Arbitrary buffer size /
#define MAXNAMESZ 32 /Maximum property name size /
#define MAXVALSZ (BUFSZ - MAXNAMESZ - sizeof (u_int))
typedef union {
char buf[BUFSZ];
struct openpromio opp;
} Oppbuf;
static char promdev = "/dev/openprom";
/
7D-236 modified 18 Aug 1995