[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Sun, 11 Apr 2004 21:41:51 +0100 
Subject:Re: sys_async_io and pipes under linux 
From:Joe Wood 
Volume-ID: 

Roger,

Yes, I think (no a tty) is the cause of the problem. I was looking at
sys_socket_pair, and created a pair of sockets. I can even read and write
between them synchronously.

However, when you invoke async-io, the reader gets called (after a write?)
but sys_input_waiting returns a length of 0. More difficult, I passed the
other socket into a child... process (in C) and converted the file
descriptor into a FILE * (this works OK), but feof (appears) to return true!
Not what I want at this stage. Essentially the child process is just an echo
daemon at the moment.

I think, but have not tried, that the way forward is to create a single
socket, connect to that socket and create a new socket and drop the 'connect
to me' socket. Because Linux (unix?) does not appear to complete the
connection in a socketpair (at kernel level).

Confused... Well I am.

Joe


<Roger.Evans@itri.brighton.ac.uk> wrote in message
c5c86m$2n4n$1@soapbox.cs.bham.ac.uk">news:c5c86m$2n4n$1@soapbox.cs.bham.ac.uk...
> Joe,
>
> I think the answer is that pipe devices are not considered as tty-type
> devices, and so  async-io  doesn't work with them (at the unix level -
> poplog has no control over this). To achieve the effect of a pipe, you
> could use sys_socket_pair, which probably would respond correctly to the
> async-io stuff..
>
> Roger
>
> Joe Wood wrote:
>
> >Hi,
> >
> >The procedure sys_async_io, (see ref sysio) takes a devices and
 establishes
> >an asynchronious reader/writer routine. Ultimately this is a call to
 fcntl
> >(2) in the kernel.
> >
> >Now the following 2 fragments return successfully:
> >
> >    sysopen ( '/dev/tty', 0, false ) -> pin ;
> >    read -> sys_async_io ( pin, 0 ) ;
> >
> >and
> >
> >    sys_socket ( `U`, `D`, false ) -> pin ;
> >    read -> sys_async_io ( pin, 0 ) ;
> >
> >
> >But
> >    syspipe (false) -> pin -> pout ;             ;;; order may be wrong
> >here, but _that_ is not the problem
> >    read -> sys_async_io ( pin, 0 ) ;
> >
> >fails inside the kernel, ENOTTY. I know this is coming from the kernel
> >because I ran strace to see the system calls.
> >
> >Does anybody know the reason.
> >
> >Thanks
> >Joe
> >
> >
> >
> >
> >
>
>
>
>