This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: POLLRDNORM in poll()
- From: Jonathan Wakely <cow at compsoc dot man dot ac dot uk>
- To: Shashi Verma <shashi_k_verma at yahoo dot co dot in>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Tue, 22 Oct 2002 11:44:32 +0100
- Subject: Re: POLLRDNORM in poll()
- References: <20021022075435.94601.qmail@web8204.mail.in.yahoo.com>
On Tue, Oct 22, 2002 at 08:54:35AM +0100, Shashi Verma wrote:
> Hello everyone,
>
> -------------------------
> First of all, I would like to apologize if this is not
> the correct forum to address this question, since I am
> a relatively new user of gcc. If it is the case, I
> would request someone to kindly provide me the details
> of the appropriate forum
> -------------------------
>
> I am working on Redhat 7.1, kernel 2.4.2-2, gcc
> version 2.96, libstdc++ version 2.96-81
This isn't the right place at all. Your question seems to be about using
poll() under GNU/Linux using GCC 2.96 - nothing whatsoever to do with the
version 3 of the GNU C++ Standard Library - which is what this list is for.
GCC 2.96 is a RedHat-specific version of the compiler and is not supported
by the GCC team, support requests should be directed to RedHat (see the
output of "gcc --help" for details). Also, poll() is a C function, not part
of the C++ Standard Library. This question would probably be better suited
to a Linux programming forum, as it seems to be a problem with the Glibc
version of poll() under Linux.
> Now, I wasn't able to use the POLLRDNORM option when
> using the poll() function for I/O multiplexing. I had
> included <sys/poll.h>
> Upon enquiring in the man page, I found that
> POLLRDNORM is defined in <asm/poll.h>
> I included that too, but unfortunately, I got a
> redefinition for the pollfd struct.
>
> A dirty way out is to take the definition for
> POLLRDNORM alone and put it in my code- but thats bad.
>
> Any solutions- or is this an unfortunate bug?
Having said the above, I think that under Linux you need to define
_XOPEN_SOURCE and include <features.h> for the POLLRDNORM, POLLWRNORM etc
bitmasks. With this macro defined including <sys/poll.h> (or more portably,
<poll.h>) will declare the poll() function, the pollfd struct and all the
bitmasks.
e.g.
#define _XOPEN_SOURCE
#include <features.h>
#include <poll.h>
int main()
{
struct pollfd s;
s.fd = 0;
s.events = POLLOUT|POLLWRNORM;
return poll(&s, 1, 500);
}
If this isn't the right solution, don't blame me, as I said, this isn't
the right list for this question! :)
HTH
Jon
--
"In times like these, it helps to recall that there have always been
times like these."
- Paul Harvey