This IOCTL command returns a mode sense page from the device. The desired page is selected by specifying the page_code in the mode_sense_page structure. See the appropriate device manual to determine the supported mode pages and content.

The data structures are
struct mode_sense_page {
        unchar page_code;
        char data[MAX_MDSNS_LEN];

struct mode_sense {
        unchar page_code;
        unchar subpage_code;
        unchar reserved[6];
        unchar cmd_code;
        char data[MAX_MDSNS_LEN];
The IOCTLs are identical, except that if a specific subpage is desired, mode_sense must be used and subpage_code must be assigned by the user application. Under the current implementation, cmd_code is not assigned by the user and must be left with a value 0.
An example of the SIOC_MODE_SENSE_PAGE command is
#include <sys/IBM_tape.h>
struct mode_sense_page mode_page;
/* get medium changer mode */
mode_page.page_code = 0x20;
if (!ioctl (fd, SIOC_MODE_SENSE_PAGE, &mode_page)) {
   printf ("The SIOC_MODE_SENSE_PAGE ioctl succeeded\n");
   if ([2] == 0x02)
      printf ("The library is in Random mode.\n");
   else if ([2] == 0x05)
      printf ("The library is in Automatic (Sequential) mode.\n");
else {
   perror ("The SIOC_MODE_SENSE_PAGE ioctl failed");