Re: ioctl

2016-09-15 Thread Chagin Dmitry
On Thu, Sep 15, 2016 at 01:37:22PM +0200, Erik Cederstrand wrote:
> 
> > Den 15. sep. 2016 kl. 10.40 skrev Erik Cederstrand :
> > 
> > Hi folks,
> > 
> > I managed to get a 64-bit Oracle instantclient running under 64-bit Linux 
> > so I can connect to an Oracle database using the Oracle client "sqlplus".
> > 
> > Now, whenever I run sqlplus, I get this message in /var/log/messages:
> > 
> >   kernel: linux: pid 92000 (sqlplus): ioctl fd=3, cmd=0x1268 ('',104) is 
> > not implemented
> > 
> > 0x1268 is BLKSSZGET according to linux_ioctl.h.
> > 
> > The message is harmless as sqlplus seems to be working correctly, but I 
> > would like to get rid of it and learn new things along the way.
> > 
> > I think the message comes from this code: 
> > https://github.com/freebsd/freebsd/blob/master/sys/compat/linux/linux_ioctl.c#L3606
> > 
> > Apparently, the Linux compat code does not implement the ioctl() system 
> > call at all. Is this a deliberate choice?
> 
> Well, that was a pretty bad analysis. I found that the linux_ioctl_disk() 
> method handles disk ioctl's, but not BLKSSZGET, so here's a patch (I still 
> barely know what I'm doing):
> 
> --- sys/compat/linux/linux_ioctl.c.orig   2016-09-15 13:09:59.747254000 
> +0200
> +++ sys/compat/linux/linux_ioctl.c2016-09-15 13:15:59.382396000 +0200
> @@ -296,6 +296,15 @@
>   return (copyout(§orsize, (void *)args->arg,
>   sizeof(sectorsize)));
>   break;
> + case LINUX_BLKSSZGET:
> + error = fo_ioctl(fp, DIOCGSECTORSIZE,
> + (caddr_t)§orsize, td->td_ucred, td);
> + fdrop(fp, td);
> + if (error)
> + return (error);
> + return (copyout(§orsize, (void *)args->arg,
> + sizeof(sectorsize)));
> + break;
>   }
>   fdrop(fp, td);
>   return (ENOIOCTL);
>

looks ok to me, thanx 
___
freebsd-emulation@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-emulation
To unsubscribe, send any mail to "freebsd-emulation-unsubscr...@freebsd.org"


Re: ioctl

2016-09-15 Thread Erik Cederstrand

> Den 15. sep. 2016 kl. 10.40 skrev Erik Cederstrand :
> 
> Hi folks,
> 
> I managed to get a 64-bit Oracle instantclient running under 64-bit Linux so 
> I can connect to an Oracle database using the Oracle client "sqlplus".
> 
> Now, whenever I run sqlplus, I get this message in /var/log/messages:
> 
>   kernel: linux: pid 92000 (sqlplus): ioctl fd=3, cmd=0x1268 ('',104) is not 
> implemented
> 
> 0x1268 is BLKSSZGET according to linux_ioctl.h.
> 
> The message is harmless as sqlplus seems to be working correctly, but I would 
> like to get rid of it and learn new things along the way.
> 
> I think the message comes from this code: 
> https://github.com/freebsd/freebsd/blob/master/sys/compat/linux/linux_ioctl.c#L3606
> 
> Apparently, the Linux compat code does not implement the ioctl() system call 
> at all. Is this a deliberate choice?

Well, that was a pretty bad analysis. I found that the linux_ioctl_disk() 
method handles disk ioctl's, but not BLKSSZGET, so here's a patch (I still 
barely know what I'm doing):

--- sys/compat/linux/linux_ioctl.c.orig 2016-09-15 13:09:59.747254000 +0200
+++ sys/compat/linux/linux_ioctl.c  2016-09-15 13:15:59.382396000 +0200
@@ -296,6 +296,15 @@
return (copyout(§orsize, (void *)args->arg,
sizeof(sectorsize)));
break;
+   case LINUX_BLKSSZGET:
+   error = fo_ioctl(fp, DIOCGSECTORSIZE,
+   (caddr_t)§orsize, td->td_ucred, td);
+   fdrop(fp, td);
+   if (error)
+   return (error);
+   return (copyout(§orsize, (void *)args->arg,
+   sizeof(sectorsize)));
+   break;
}
fdrop(fp, td);
return (ENOIOCTL);

... and the messages are gone. Is this an acceptable approach?

Erik
___
freebsd-emulation@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-emulation
To unsubscribe, send any mail to "freebsd-emulation-unsubscr...@freebsd.org"