Re: select() in 5.X

From: Ryan Sommers <ryans_at_gamersimpact.com>
Date: Sat, 27 Dec 2003 00:33:07 -0600
On Fri, 2003-12-26 at 16:39, Yaoping Ruan wrote:
> Not sure if somebody here has already noticed this problem before. I
> have a small program using select() . Though it works correctly on 4.x,
> some problem happens on 5.1. First of all, I notice that macros about
> FD_xx have been moved into sys/select.h. Then FD_ZERO() seems to be
> failed. My program looks like follow:
> 
> main( )
> { ...
> fd_set rfdset;
> 
> FD_ZERO(&rfdset);
> 
> ....
> }
> 

I'm unable to duplicate your results. Are you setting FD_SETSIZE
somewhere? Here are my results on 5.2-CURRENT (note sys/select.h hasn't
been changed for 11 months and that log didn't mention the macros):

Script started on Sat Dec 27 00:24:39 2003
ryans_at_lilshadow(~/src):gdb ./test
GNU gdb 5.2.1 (FreeBSD)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "i386-undermydesk-freebsd"...
(gdb) list 7
2#include <sys/select.h>
3
4void
5main()
6{
7int n = _howmany(FD_SETSIZE, _NFDBITS);
8fd_set tset;
9
10FD_ZERO(&tset);
11};
(gdb) break 8
Breakpoint 1 at 0x80484ce: file test.c, line 8.
(gdb) run
Starting program: /usr/home/ryans/src/test 

Breakpoint 1, main () at test.c:10
10FD_ZERO(&tset);
(gdb) print n
$1 = 32
(gdb) print tset
$2 = {__fds_bits = {134513140, 3217025816, 671419022, 134513327,
109760260, 671535104, 
    3217025800, 1, 671514200, 3217025816, 671419879, 671547392,
16777216, 671535616, 
    671514200, 671514200, 672308176, 3217025864, 671406660, 672307790,
1, 3217025848, 1, 
    1, 3217025948, 3217025940, 3217025900, 672308220, 3217025876,
3217025932, 671404993, 
    671535104}}
(gdb) next
11};
(gdb) print tset
$3 = {__fds_bits = {0 <repeats 32 times>}}
(gdb) quit
The program is running.  Exit anyway? (y or n) y
ryans_at_lilshadow(~/src):exit
exit

Script done on Sat Dec 27 00:25:10 2003


-- 
Ryan "leadZERO" Sommers
Gamer's Impact President
ryans_at_gamersimpact.com
ICQ: 1019590
AIM/MSN: leadZERO

-= http://www.gamersimpact.com =-
Received on Fri Dec 26 2003 - 21:33:12 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:35 UTC