Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 09-06-2007, 08:42 AM   #1
LQ Newbie
Registered: Dec 2006
Posts: 17

Rep: Reputation: 0
Thumbs up Ioctl Fail In Some Systems Like Redhat 9, Kernel 2.4.20-8

I am having a program which gives details of pci slots like sata slot and usb slots.

But this program is not working for some systems like Redhat 9 having kernel 2.4.20-8

I am using ioctl SCSI_IOCTL_GET_PCI , which is not working in this system .

So what should I have to do for getting information of slots in this Redhat 9 pc.

Please give me any help if possible ...

Thanking you in advance ...

The Program is given below :


#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <scsi/sg.h>
#include <scsi/scsi.h>
#include <string.h>

#define SUCCESS 1
#define FAILURE -1

#define SG_X "/dev/sg%d"

#define SCSI_IOCTL_GET_PCI 0x5387

int scan_sg( int sg )
char buffer[20] = { '\0' };
int fd = -1;

snprintf(buffer, sizeof(buffer), SG_X, sg);

fd = open(buffer, O_RDWR | O_NONBLOCK);

if (fd < 0)
// printf(" Inside scan_sg fd open failed returning false \n" );
return FAILURE;

char slot_name[64] = { '\0' };
memset(slot_name, 0, sizeof(slot_name));

if (ioctl(fd, SCSI_IOCTL_GET_PCI, slot_name) >= 0)
printf("SLOT NAME :- %s\n", slot_name);//parent = n.findChildByBusInfo(guessBusInfo(hw::strip(slot_name)));


return SUCCESS;

int main()
int i;

for(i = 0 ; i <=10;i++)

return 0;

Old 09-07-2007, 06:27 AM   #2
Senior Member
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 62
The only help I can offer - upgrade from Redhat 9.

This distro has been unsupported for about 3.5 years, and has not had security updates since then. Debugging your code for such an old distro is a waste of time and effort, unless you have a particular reason to use RH9.

You will have better success with a modern distro, such as Fedora 7 (successor to Redhat Linux).



Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Regd ioctl handler hooks in the kernel sathishkumarr Linux - Networking 0 04-30-2007 03:15 AM
Fail to install NIC on Redhat 9 noelcantona Linux - Hardware 6 12-01-2004 06:55 PM
DISCUSSION: Custom kernel compilaton on RedHat/Fedora Systems Thetargos LinuxAnswers Discussion 2 08-28-2004 05:11 PM
All Redhat CDs fail md5!!! hypothraxer Fedora - Installation 3 08-28-2004 01:53 PM
doneshowconsole: Warning: the ioctl TIOCGDEV is not known by the kernel Consystor Linux - Hardware 3 08-05-2003 08:37 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:49 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration