Re: [gtk-list] a question about ioctrl



--------
On Fri, 17 Sep 1999 10:06:26 MDT, Jiang XU <jiang.xu@echostar.com>  said:
> I have a linux question , I wonder whether I can find answer here.

Quite off topicm but,, ;)
 
>     fd=open("/dev/hda7",O_RDWR);
>     ioctl(fd,HDIO_GET_IDENTITY,diskinfo);
> 
> It can successfully open the hd, which means I get fd, but it turns
> wrong when calling ioctl(..).
> I print out the error message, it said :"Invalid Arguments".

I'm not a Unix person, but most likely you need to pass &diskinfo
(to pass the *address* of the structure so the Kernel can write to
it) rather than 'diskinfo'.

Another possibility is you declared 'struct *something diskinfo;'
(in which case passing just 'diskinfo' is correct) but failed
to malloc() the needed space.

In any case, this is almost certainly a bug caused by confusing
a pointer with the memory referenced by the pointer.

				Valdis Kletnieks
				Computer Systems Senior Engineer
				Virginia Tech



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]