This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Patch request to qt 5.9.4 (Re: [ANNOUNCEMENT] Qt 5.9.4)
>> From: Achim Gratz
>> To: cygwin
>> Cc:
>> Date: 2019/3/6, Wed 04:24
>> Subject: Re: Patch request to qt 5.9.4 (Re: [ANNOUNCEMENT] Qt 5.9.4)
>>
>> T atsuro MATSUOKA writes:
>>> I contacted with Enrico who tells me the patch that I have shown.
>>
>> Yes, but that monkeys around the real problem. What Yaakov is telling
>> you is that there are two options and we don't know yet which one we
>> have to deal with.
>>
>> If O_NONBLOCK is needed, but does not work correctly under Cygwin, then
>> that's a bug in Cygwin. For this case, Corinna asks you to create an
>> STC that demonstrates the bug so it can be triaged without having to
>> work with something as complex as the Qt terminal in Cygwin.
>>
>> If on the other hand O_NONBLOCK is in fact not needed and just shows
>> different behaviour on different systems without a bug in the
>> implementation being present, then upstream should remove that argument.
>>
>>
>> Regards,
>> Achim.
>
> Seeing ML archive that Enrico indicated,
>
> Re: select() and named pipes
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <errno.h>
> #include <sys/select.h>
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <fcntl.h>
> #include <unistd.h>
>
> #define FIFONAME "/tmp/pipe"
>
> int main(void)
> {
> int fd;
> int nsel;
> fd_set readfds;
> FD_ZERO(&readfds);
>
> if (mkfifo(FIFONAME, 0600) < 0) {
> perror("mkfifo");
> exit(1);
> }
>
> fd = open(FIFONAME, O_RDONLY | O_NONBLOCK);
>
> if (fd < 0) {
> perror("open");
> remove(FIFONAME);
> exit(2);
> }
>
> FD_SET(fd, &readfds);
> do {
> nsel = select(fd + 1, &readfds, 0, 0, 0);
> } while (nsel == -1 && (errno == EINTR || errno == EAGAIN));
>
> if (nsel == -1) {
> perror("select");
> exit(3);
> }
>
> if (FD_ISSET(fd, &readfds)) {
> char buf[100];
> int status;
> int count = 0;
> printf("%d: ", ++count);
> while ((status = read(fd, buf, sizeof(buf) - 1))) {
> if (status > 0) {
> buf[status] = '\0';
> printf("%s", buf);
> } else if (errno == EAGAIN) {
> printf("\n%d: ", ++count);
> } else {
> perror("read");
> break;
> }
> }
> }
>
> close(fd);
> remove(FIFONAME);
> return 0;
> }
>
>
>
> As you wrote this is a issue of Cygwin issue.
> But As long as O_NONBLOCK does not work on Cygwin, Enrico's workaround can
> be attached for qt.
Apart from Qt maintainer accepts Enrico's patch, I will raise O_NONBLOCK issue by another post.
Tatsuro
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple