SIOC_LOG_SENSE_PAGE

This IOCTL command returns a log sense page from the device. The page is selected by specifying the page_code in the log_sense_page structure. Optionally, a specific parm pointer, also known as a parm code, and the number of parameter bytes can be specified with the command.

To obtain the entire log page, the len and parm_pointer fields are set to zero. To obtain the entire log page that starts at a specific parameter code, set the parm_pointer field to the wanted code and the len field to zero. To obtain a specific number of parameter bytes, set the parm_pointer field to the wanted code. Then, set the len field to the number of parameter bytes plus the size of the log page header (4 bytes). The first 4 bytes of returned data are always the log page header.

See the appropriate device manual to determine the supported log pages and content.

The data structure is
struct log_sense_page
  {
      char page_code;
      unsigned short len;
      unsigned short parm_pointer;
      char data[LOGSENSEPAGE];
  };
An example of the SIOC_LOG_SENSE_PAGE command is
#include <sys/Atape.h>

struct log_sense_page log_page;
int temp;

/* get log page 0, list of log pages */
log_page.page_code = 0x00;
log_page.len = 0;
log_page.parm_pointer = 0;

if (!ioctl (fd, SIOC_LOG_SENSE_PAGE, &log_page))
{
    printf ("The SIOC_LOG_SENSE_PAGE ioctl succeeded\n");
    dump_bytes(log_page.data, LOGSENSEPAGE);
}
else
{
    perror ("The SIOC_LOG_SENSE_PAGE ioctl failed");
    sioc_request_sense();
}


/* get 3590 fraction of volume traversed */
log_page.page_code = 0x38;
log_page.len = 0;
log_page.parm_pointer = 0x000F;

if (!ioctl (fd, SIOC_LOG_SENSE_PAGE, &log_page))
{
    temp = log_page.data[(sizeof(log_page_header) + 4)];
    printf ("The SIOC_LOG_SENSE_PAGE ioctl succeeded\n");
    printf ("Fractional Part of Volume Traversed %x\n",temp);
}
else
{
    perror ("The SIOC_LOG_SENSE_PAGE ioctl failed");
    sioc_request_sense();
}