Unix Technical Forum

ioctl() Calls from gcc Compiled Program

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(). ...


Go Back   Unix Technical Forum > Unix Operating Systems > AIX Operating System

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-04-2008, 10:29 PM
F. Michael Orr
 
Posts: n/a
Default ioctl() Calls from gcc Compiled Program

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() */

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:13 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com