SMCIOC_UNLOAD_MEDIUM
This IOCTL command moves a tape from the drive and returns it to a specific slot. Or, it moves a tape to the first empty slot in the magazine if the slot address is specified as zero. If the IOCTL is issued to the /dev/rmt special file, the tape is automatically rewound and unloaded from the drive first.
An example of the SMCIOC_UNLOAD_MEDIUM command
is
#include <sys/Atape.h>
/* unload cartridge to slot 3 */
if (ioctl (tapefd, SMCIOC_UNLOAD_MEDIUM,3)<0)
{
printf ("IOCTL failure. errno=%d\n",errno)
exit(1):
}
/* unload cartridge to first empty slot in magazine */
if (ioctl (tapefd, SMCIOC_UNLOAD_MEDIUM,0)<0)
{
printf ("IOCTL failure. errno=%d\n",errno)
exit(1):
}