Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Sep 2016 13:37:22 +0200
From:      Erik Cederstrand <erik+lists@cederstrand.dk>
To:        freebsd-emulation@freebsd.org
Subject:   Re: ioctl
Message-ID:  <24CD6063-ED64-4509-8714-16EC21D67AB9@cederstrand.dk>
In-Reply-To: <1B155F49-2C87-49A0-B08A-17849C86CC48@cederstrand.dk>
References:  <1B155F49-2C87-49A0-B08A-17849C86CC48@cederstrand.dk>

next in thread | previous in thread | raw e-mail | index | archive | help

> Den 15. sep. 2016 kl. 10.40 skrev Erik Cederstrand =
<erik@cederstrand.dk>:
>=20
> Hi folks,
>=20
> 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".
>=20
> Now, whenever I run sqlplus, I get this message in /var/log/messages:
>=20
>   kernel: linux: pid 92000 (sqlplus): ioctl fd=3D3, cmd=3D0x1268 =
('',104) is not implemented
>=20
> 0x1268 is BLKSSZGET according to linux_ioctl.h.
>=20
> 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.
>=20
> I think the message comes from this code: =
https://github.com/freebsd/freebsd/blob/master/sys/compat/linux/linux_ioct=
l.c#L3606
>=20
> 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(&sectorsize, (void *)args->arg,
 		    sizeof(sectorsize)));
 		break;
+	case LINUX_BLKSSZGET:
+		error =3D fo_ioctl(fp, DIOCGSECTORSIZE,
+		    (caddr_t)&sectorsize, td->td_ucred, td);
+		fdrop(fp, td);
+		if (error)
+			return (error);
+		return (copyout(&sectorsize, (void *)args->arg,
+		    sizeof(sectorsize)));
+		break;
 	}
 	fdrop(fp, td);
 	return (ENOIOCTL);

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

Erik=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?24CD6063-ED64-4509-8714-16EC21D67AB9>