GNOME Bugzilla – Bug 656690
posix.vapi refers to nonexistent stropts.h
Last modified: 2011-08-17 22:46:05 UTC
posix.vapi refers stropts.h, which isn't included in many distros (like Fedora 15). If I try to compile the git-master version of moserial, which uses posix.vapi, I get this error: src/SerialConnection.c:31:21: fatal error: stropts.h: No such file or directory It works OK if I: [root@xena moserial]# touch /usr/include/stropts.h Is there a fix for this? - Mike
(In reply to comment #0) > posix.vapi refers stropts.h, which isn't included in many distros (like Fedora > 15). > > If I try to compile the git-master version of moserial, which uses posix.vapi, > I get this error: > > src/SerialConnection.c:31:21: fatal error: stropts.h: No such file or directory > > It works OK if I: > [root@xena moserial]# touch /usr/include/stropts.h > > Is there a fix for this? > Yes, some stropts.h headers in the vapi are broken (like for ioctl). What symbols are you using from posix vapi?
Well, I'm using lots of posix symbols here: http://git.gnome.org/browse/moserial/tree/src/SerialConnection.vala Here are the ioctl-specific lines: Posix.ioctl(m_fd, Linux.Termios.TIOCMSET, out mcs); and more completely: [mjc@xena moserial]$ grep Posix src/SerialConnection.vala using Posix; private Posix.termios newtio; private Posix.termios restoretio; flags=Posix.O_RDWR; flags=Posix.O_RDONLY; flags=Posix.O_WRONLY; m_fd = Posix.open(settings.device, flags | Posix.O_NONBLOCK); Posix.tcflush(m_fd, Posix.TCIOFLUSH); ~Posix.File.FileStatus.NDELAY); tcsetattr(m_fd, Posix.TCSANOW, newtio); size_t x = Posix.write(m_fd, b, 1); size_t x = Posix.write(m_fd, bytes, size); Posix.tcdrain(m_fd); tcsetattr(m_fd, Posix.TCSANOW, newtio); Posix.close(m_fd); int bytesRead=(int)Posix.read(m_fd, m_buf, 1000); baudRate=Posix.B300; baudRate=Posix.B600; baudRate=Posix.B1200; baudRate=Posix.B2400; baudRate=Posix.B4800; baudRate=Posix.B9600; baudRate=Posix.B19200; baudRate=Posix.B38400; baudRate=Posix.B57600; baudRate=Posix.B115200; baudRate=Posix.B230400; Posix.cfsetospeed(newtio, baudRate); Posix.cfsetispeed(newtio, baudRate); newtio.c_cflag = (newtio.c_cflag & ~Posix.CSIZE) | Posix.CS5; newtio.c_cflag = (newtio.c_cflag & ~Posix.CSIZE) | Posix.CS6; newtio.c_cflag = (newtio.c_cflag & ~Posix.CSIZE) | Posix.CS7; newtio.c_cflag = (newtio.c_cflag & ~Posix.CSIZE) | Posix.CS8; newtio.c_cflag |= Posix.CLOCAL | Posix.CREAD; newtio.c_cflag &= ~(Posix.PARENB | Posix.PARODD); newtio.c_cflag |= Posix.PARENB; newtio.c_cflag |= (Posix.PARENB | Posix.PARODD); newtio.c_cflag |= Posix.CSTOPB; newtio.c_cflag &= ~Posix.CSTOPB; newtio.c_iflag = Posix.IGNBRK; newtio.c_iflag |= Posix.IXON | Posix.IXOFF; newtio.c_iflag &= ~(Posix.IXON | Posix.IXOFF | Posix.IXANY); newtio.c_cc[Posix.VTIME]=1; newtio.c_cc[Posix.VMIN]=1; Posix.InputMode.INLCR | Posix.InputMode.ICRNL | Posix.IXANY | Posix.IXON | Posix.IXOFF | Posix.INPCK | Posix.ISTRIP); newtio.c_lflag &= ~(Posix.ECHONL|Posix.NOFLSH); Posix.ioctl(m_fd, Linux.Termios.TIOCMGET, out mcs); Posix.ioctl(m_fd, Linux.Termios.TIOCMSET, out mcs);
Created attachment 194065 [details] [review] patch ioctl Does the attached patch solve your problem?
Yes, it does, tested using the latest 0.12-branch vala. (0.13 seems to introduce other new twists that I haven't mastered yet.) - Mike
commit 7e6bb98270d22e71c3da004fe8dda0e7d15bd425 Author: Luca Bruno <lucabru@src.gnome.org> Date: Wed Aug 17 19:08:14 2011 +0200 posix: Set ioctl() cheader to be sys/ioctl.h Fixes bug 656690. This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.