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" #ifndef SCSI_IOCTL_GET_PCI #define SCSI_IOCTL_GET_PCI 0x5387 #endif 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))); } printf("\n"); close(fd); return SUCCESS; } int main() { int i; for(i = 0 ; i <=10;i++) scan_sg(i); return 0; } ========================================================================= |
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). --Ian |
All times are GMT -5. The time now is 11:09 PM. |