After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 656690 - posix.vapi refers to nonexistent stropts.h
posix.vapi refers to nonexistent stropts.h
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Bindings
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks: 656695
 
 
Reported: 2011-08-16 19:48 UTC by Michael Chudobiak
Modified: 2011-08-17 22:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch ioctl (474 bytes, patch)
2011-08-17 17:06 UTC, Luca Bruno
none Details | Review

Description Michael Chudobiak 2011-08-16 19:48:22 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
Comment 1 Luca Bruno 2011-08-16 19:53:17 UTC
(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?
Comment 2 Michael Chudobiak 2011-08-16 20:05:58 UTC
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);
Comment 3 Luca Bruno 2011-08-17 17:06:55 UTC
Created attachment 194065 [details] [review]
patch ioctl

Does the attached patch solve your problem?
Comment 4 Michael Chudobiak 2011-08-17 17:55:53 UTC
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
Comment 5 Luca Bruno 2011-08-17 22:46:05 UTC
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.