From: davidav AT msil DOT sps DOT mot DOT com (David Avrahamov) Subject: The IOCTL system call ! 21 May 1998 07:06:47 -0700 Message-ID: <35629781.AF9824FC.cygnus.gnu-win32@msil.sps.mot.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------6E1F0E94C42C95831CCE2287" To: gnu-win32 AT cygnus DOT com Cc: davidav --------------6E1F0E94C42C95831CCE2287 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi everybody, I have been using the CYGNUS development environment lately on WinNT 4.0 . It seems to be working great except for the following thing. The ioctl system call doesn't work for me. Here is a simple code which uses ioctl and runs perfectly on SUN-OS: #include #ifdef SUN #include #else #include #endif #include #include main() { int os_status=0; int fd=0; unsigned long i=0; char str[200]; printf("print something !\n"); while(1){ os_status = ioctl (fd, FIONREAD, &i); if (os_status == -1){ printf("i=%d os_status=%d\n",i,os_status); printf("errno = %d\n",errno); exit (1); } if (i){ scanf("%s",str); if (!strcmp(str,":q")) exit(0); printf("You wrote: %s\n",str); } } } This code uses ioctl in order to verify whether there is an input before actualy trying to read. This avoids the program from blocking. I have already tried the update version of cygwinb19.dll (new-cygwinb19.dll.gz) but I am getting a memory access violation even when I try to compile. I am really looking forward for your suggestions. Thank you very much, -- David Avrahamov Phone number: 952-2176 Software department Motorola Semiconductor Israel --------------6E1F0E94C42C95831CCE2287 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit
Hi everybody,

I have been using the CYGNUS development environment lately on WinNT 4.0 .
It seems to be working great except for the following thing.
The ioctl system call doesn't work for me.
Here is a simple code which uses ioctl and runs perfectly on SUN-OS:

#include <stdio.h>
#ifdef SUN
#include <sys/filio.h>
#else
#include <asm/socket.h>
#endif
#include <errno.h>
#include <termio.h>

main()
{
    int os_status=0;
    int fd=0;
    unsigned long i=0;
    char str[200];

    printf("print something !\n");
    while(1){
        os_status = ioctl (fd, FIONREAD, &i);
        if (os_status == -1){
            printf("i=%d  os_status=%d\n",i,os_status);
            printf("errno = %d\n",errno);
            exit (1);
        }
        if (i){
            scanf("%s",str);
            if (!strcmp(str,":q"))
                exit(0);
            printf("You wrote: %s\n",str);
        }
    }
}

This code uses ioctl in order to verify whether there is an input before 
actualy trying to read. This avoids the program from blocking.

I have already tried the update version of cygwinb19.dll
(new-cygwinb19.dll.gz) but I am getting a memory access violation even 
when I try to compile.

I am really looking forward for your suggestions.
Thank you very much,


-- 
David Avrahamov      
Phone number: 952-2176
Software department
Motorola Semiconductor Israel
  --------------6E1F0E94C42C95831CCE2287-- - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".