delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2023/02/06/18:20:34

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BD1BF3858C20
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1675725585;
bh=RrYH/7xpC0NoZmB43v7etZS2JyRRW/1EUhsMK9u7oc4=;
h=Date:To:Cc:Subject:References:In-Reply-To:List-Id:
List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:
From:Reply-To:From;
b=tSE42i6oIEiBOyB/Jnw+eapQB7aqadx+cXnq85VZ1PiR2bxFYT++mFpDpzwjfGjav
51fHaExCpFBbtmCtkgtI070hUZaxOSdWbmTEsbP699jnH8MlMFaWxxuvwGiCX+ZcuX
FjQz0zAg4igWZUslsuI6fam7QPnSPOoF9eRwQe8U=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 656E43858D1E
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-Spam-Language: en
X-Spam-Relay-Country:
X-Spam-DCC: B=; R=smtp1.atof.net 1102; Body=1 Fuz1=1 Fuz2=1
X-Spam-RBL:
X-Spam-PYZOR: Reported 0 times.
Date: Mon, 6 Feb 2023 18:19:16 -0500
To: Yeo Kai Wei <yeokaiwei AT hotmail DOT com>
Cc: cygwin AT cygwin DOT com
Subject: Re: [FEEDBACK] Issue with fd_set, FD_ZERO, FD_SET, FD_SETSIZE : Cygwin
Message-ID: <Y+GK9NP/bymoXcd7@xps13>
References: <PH0PR05MB991811F96A93962E56F6DCC0A4DA9 AT PH0PR05MB9918 DOT namprd05 DOT prod DOT outlook DOT com>
<Y+FjUILtLFxXFVL5 AT xps13>
<PH0PR05MB9918AF2713B83F72042577ACA4DA9 AT PH0PR05MB9918 DOT namprd05 DOT prod DOT outlook DOT com>
<Y+FqT9AbejDHsg7h AT xps13>
<SA1PR05MB99072D6C9EAFB28AFFDD6D72A4DA9 AT SA1PR05MB9907 DOT namprd05 DOT prod DOT outlook DOT com>
MIME-Version: 1.0
In-Reply-To: <SA1PR05MB99072D6C9EAFB28AFFDD6D72A4DA9@SA1PR05MB9907.namprd05.prod.outlook.com>
X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00, BODY_8BITS,
KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS,
TXREP autolearn=ham autolearn_force=no version=3.4.6
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: "gs-cygwin.com--- via Cygwin" <cygwin AT cygwin DOT com>
Reply-To: gs-cygwin DOT com AT gluelogic DOT com
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id 316NKAuo014339

On Tue, Feb 07, 2023 at 07:03:23AM +0800, Yeo Kai Wei wrote:
> 
> On 7/2/2023 4:59 am, gs-cygwin DOT com AT gluelogic DOT com wrote:
> > On Tue, Feb 07, 2023 at 04:33:53AM +0800, Yeo Kai Wei wrote:
> > > Hi All,
> > > 
> > > Thanks for the help.
> > > 
> > > I tried adding "#include <sys/select.h>".
> > > 
> > > However, this is the error message that was returned to me.
> > > 
> > > $ gcc -o selectStdIn selectStdIn.c
> > > selectStdIn.c:9:10: fatal error: sys/select.h: No such file or directory
> > >   #include <sys/select.h>
> > > 
> > > Thank you.
> > > 
> > > On 7/2/2023 4:30 am, gs-cygwin DOT com AT gluelogic DOT com wrote:
> > > > On Tue, Feb 07, 2023 at 04:25:22AM +0800, Yeo Kai Wei via Cygwin wrote:
> > > > > Hi,
> > > > > 
> > > > > I would like to report an issue with Cygwin 3.4.2 on Windows.
> > > > > 
> > > > > It doesn't seem to be able to work with  fd_set, FD_ZERO, FD_SET, FD_SETSIZE
> > > > > macros.
> > > > > 
> > > > > The code is in italics. The filename was selectStdIn.c. The terminal command
> > > > > used was "gcc -o selectStdIn selectStdIn.c"
> > > > > 
> > > > > Thank you.
> > > > > 
> > > > > /
> > > > > /
> > > > > 
> > > > > /CODE
> > > > > /
> > > > > 
> > > > > /#include <stdio.h>//
> > > > > //#include <stdlib.h>//
> > > > > //#include <sys/time.h>//
> > > > > //#include <unistd.h>//
> > > > > / /
> > > > > //void main()//
> > > > > //{//
> > > > > //    fd_set fds; //set of file descriptors//
> > > > > / /
> > > > > //    struct timeval tv;//
> > > > > / /
> > > > > //    int flag;//
> > > > > / /
> > > > > //    char byte;//
> > > > > / /
> > > > > //    FD_ZERO(&fds);//
> > > > > / /
> > > > > //    FD_SET(0, &fds);//
> > > > > / /
> > > > > //    tv.tv_sec = 5;//
> > > > > / /
> > > > > //    tv.tv_usec = 0;//
> > > > > / /
> > > > > //    flag = select(FD_SETSIZE, //
> > > > > //            &fds,//
> > > > > //            NULL,//
> > > > > //            NULL,//
> > > > > //            &tv);//
> > > > > / /
> > > > > //    if(-1 == flag)//
> > > > > //        perror("select error");//
> > > > > //    else if(flag)//
> > > > > //    {//
> > > > > //        read(0,&byte,1);//
> > > > > / /
> > > > > //        puts("data read");//
> > > > > //    }//
> > > > > / /
> > > > > //    if(flag)//
> > > > > //        printf("The byte value is %c\n", byte);//
> > > > > ////
> > > > > //}/
> > > > > 
> > > > > 
> > > > > TERMINAL COMMANDS
> > > > > 
> > > > > $ gcc -o selectStdIn selectStdIn.c
> > > > > selectStdIn.c: In function 'main':
> > > > > selectStdIn.c:8:2: error: unknown type name 'fd_set'; did you mean 'fpos_t'?
> > > > >     fd_set fds; //set of file descriptors
> > > > >     ^~~~~~
> > > > >     fpos_t
> > > > > selectStdIn.c:16:2: warning: implicit declaration of function 'FD_ZERO'
> > > > > [-Wimpli
> > > > > cit-function-declaration]
> > > > >     FD_ZERO(&fds);
> > > > >     ^~~~~~~
> > > > > selectStdIn.c:18:2: warning: implicit declaration of function 'FD_SET'
> > > > > [-Wimplic
> > > > > it-function-declaration]
> > > > >     FD_SET(0, &fds);
> > > > >     ^~~~~~
> > > > > selectStdIn.c:24:9: warning: implicit declaration of function 'select'; did
> > > > > you
> > > > > mean 'sleep'? [-Wimplicit-function-declaration]
> > > > >     flag = select(FD_SETSIZE,
> > > > >            ^~~~~~
> > > > >            sleep
> > > > > selectStdIn.c:24:16: error: 'FD_SETSIZE' undeclared (first use in this
> > > > > function)
> > > > >     flag = select(FD_SETSIZE,
> > > > >                   ^~~~~~~~~~
> > > > > selectStdIn.c:24:16: note: each undeclared identifier is reported only once
> > > > > for
> > > > > each function it appears in
> > > > $ man select
> > > > 
> > > > #include <sys/select.h>
> > Please post at bottom of messages on this mailing list.
> > 
> > You need to install the cygwin-devel package to get <sys/select.h>
> > 
> > Cheers, Glenn
> 
> Hi All,
> 
> I updated Cygwin to 3.4.5-1.x86_64.
> 
> $ uname -a
> CYGWIN_NT-10.0-19045 DESKTOP-P3E71RB 3.4.5-1.x86_64 2023-01-19 19:09 UTC
> x86_64 Cygwin
> 
> 
> However, the same problem occurs.
> 
> Cygwn-devel doesn't seem to work.
> 
> $ gcc -o selectStdIn selectStdIn.c
> selectStdIn.c:9:10: fatal error: sys/select.h: No such file or directory
>  #include <sys/select.h>
>           ^~~~~~~~~~~~~~
> compilation terminated.

https://www.cygwin.com/packages/x86_64/cygwin-devel/cygwin-devel-3.4.5-1

/usr/include/sys/select.h is included in the cygwin-devel package.

Did you install the cygwin-devel package?
Does /usr/include/sys/select.h exist in your cygwin environment?

Perhaps you accidentally have multiple cygwin installations on your
system and you installed cygwin-devel into a different location?

Since you did not have the cygwin-devel package installed on your
system, you are likely very new to developing on cygwin.  You also seem
to be very new to cygwin and installing cygwin packages.

You may want to spend more time reading the available documentation on
how to use cygwin and develop on cygwin, as you seem to be having
trouble with some very elementary steps.  https://www.cygwin.com/
The documentation is very good.  Please read through it.

(This is my way of saying I won't be responding further to this thread.)

Cheers, Glenn

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019