GNOME Bugzilla – Bug 569184
vte generates unnecessary ioctl(I_FIND) kernel warnings
Last modified: 2009-10-24 05:29:58 UTC
vte should be adjusted to avoid the related ioctl(I_FIND) calls. Other information: In pty.c there are three STREAMS-based I_FIND ioctl() calls. STREAMS is not supported in Linux. The code assumes that the existence of the <stropts.h> header file indicates support for this functionality and hence calls it unconditionally. In a 32-bit userland on 64-bit machines this leads to irritating warnings that there is 32-bit compatible implementation of that ioctl(): ioctl32(gnome-terminal:4419): Unknown cmd fd(20) cmd(0000530b){t:'S';sz:0} arg(4eed91aa) on /dev/pts/1 Well, there is no 64-bit compatible version to start with, so this is slightly misleading to start with. I am not sure if a kernel message is also generated in the 64 bit case. But nevertheless, vte could at least have a check around these three ioctl()s to only call them if the fd it is dealing with is a stream. It looks as if <stropts.h> provides the isastream() function for that. Searching for the above kernel message comes back with quite a lot of hits, so I am not sure whether this has been reported yet. But I was not able to find a bug report.
*** Bug 562540 has been marked as a duplicate of this bug. ***
Just for reference, this code was added back in http://svn.gnome.org/viewvc/vte?view=revision&revision=392 ; it seems this is (or, at least, was) necessary for solaris.
Created attachment 137809 [details] [review] isastream patch The STREAMS ioctl numbers, as defined by glibc, conflict with Linux CD ioctls. The bug is caused by vte attempting to use the I_FIND ioctl, which the kernel interprets as CDROMSUBCHNL, instead. The attached patch fixed the problem by making sure that the ioctl is used only on actual STREAMS files.
My only comment is, how portable is isastream()?
Generally, if a system has <stropts.h>, it has isastream(). It is also standardized by SVID and POSIX. See: http://www.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap02.html#tag_02_01_05_09
In case someone might have problems reproducing this, fs/compat_ioctl.c in the Linux kernel limits these messages to only appear 50 times per boot. (also cc-ing Brian Cameron, perhaps he might want to comment on the patch)
Can you update the patch to add the autoconf magic for isastream()?
Ok, committed. My only question is, why does your Linux system advertise having stropts.h to begin with? Mine doesn't.
Thank you! I can only guess, but I presume that Debian ships <stropts.h> because glibc upstream does so, and that glibc upstream does so for compatibility with SVID. I find myself a bit surprised to learn from you that Fedora removed this header, especially considering the historical inclusion of STREAMS in the Red Hat kernel. Such a change must have broken a number of programs.