This is the mail archive of the cygwin 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]
Other format: [Raw text]

Re: Question about select function


Dear forum users!

I have attached to the message an example of code that uses rpc and I think
it points to some bug in cygwin rpc library.

Add info:
1. 0x2A000001 is the first number in a range of numbers for rpc programs for
free use.
2. When probe executed with ANY parameter, it switches to svc_run.
3. When probe executed without any parameters, it switches to code taken
from "Power programming with RPC" by John Bloomer. (In rpcunix documentation
the equivalent code is given as an implementation for svc_run).

I checked this code under Fedora and it works, but under cygwin:

1. svc_unregister does'nt unregister old rpc program, so it is imposible to
run it twice.
2. select (...) fails.

P. S. sizeof ( svc_fdset ) == 8. In my last message I just wrote wrong.

Lev.

----- Original Message ----- 
From: "Lev Pliner" <pliner@sky.ru>
To: <cygwin@cygwin.com>
Sent: Friday, June 18, 2004 3:41 PM
Subject: Question about select function


> Dear forum members!
>
> I'm writing a multithreaded rpc program. The following is a part of my
> program that causes a error:
>
>   fd_set readfds;
>   int size = getdtablesize ( );
>
>   while ( 1 )
>   {
>     readfds = svc_fdset;
>
>     switch ( select ( size, &readfds, NULL, NULL, NULL ) )
>     {
>       case -1:
>         if ( errno == EINTR )
>           continue;
>         else ...
>       break;
>       case 0:
>         continue;
>       break;
>     };
>   };
>
> "select" call here causes the following error: "Bad file descriptor". This
> example was taken from "Power programming with RPC" by John Bloomer.
>
> I tried to understand what svc_fdset consits of:
> sizeof ( svc_fdset ) == 2
>
> Thus fd_set.fd_bits array has two elements:
> sprintf ( "%ld %ld\n", svc_fdset.fds_bits [ 0 ], svc_fdset.fds_bits [
1 ] )
> == "8 0"
>
> But somehow:
> for (i=0;i<64;i++) FD_SET (i, svc_fdset) == 1
>
> Could anyone tell me how to solve this problem?
>
> Lev.
>

Attachment: probe.c
Description: Binary data

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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