This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

The IOCTL system call !


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
 
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]