This is a discussion on ioctl() Calls from gcc Compiled Program within the AIX Operating System forums, part of the Unix Operating Systems category; --> I'm stumped. I had to make a small change to a program that handles tape library functions via ioctl(). ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I'm stumped. I had to make a small change to a program that handles tape library functions via ioctl(). It is a very simple program. The program was originally compiled with xlC. I _tried_ to compile it on another AIX system with gcc, because the LUM was messed up on the machine with xlC. The program compiled clean, but the ioctl() function failed with EINVAL. To get the program working, I got the LUM straightened out, recompiled the code, and the program works. Therefore, I know it is not a logic error. I would think it has to be an option I am not specifying to gcc, so I as asking if anyone else has seen this. FWIW, the code in question is below. /************************************************** **********************/ /* This function moves the tape from the drive to its slot. It accepts */ /* three arguments: the file descriptor for the media changer, the tape */ /* drive element number, and the slot number to move it to. */ /************************************************** **********************/ int MoveTape(int smc, int src, int dest) { struct move_medium move_medium; /**/ move_medium.robot = move_medium.invert = 0; move_medium.source = src; move_medium.destination = dest; printf("Moving tape from drive %u to slot %u...\n", src, dest); if (ioctl(smc, SMCIOC_MOVE_MEDIUM, &move_medium) < 0) { perror("Error replacing tape"); return(-1); } /* END IF (IOCTL(SMC, ... */ return(0); } /* END MOVETAPE() */ |