1833779 Members
1938 Online
110063 Solutions
New Discussion

2 selects in hpux 11.31?

 
C R S
Occasional Advisor

2 selects in hpux 11.31?

I'm a developer trying to build our software on hpux 11.31. we currently build and run on both 11.11 pa-risc and 11.23 ia64.

I'm trying to build the code on 11.31 and I'm getting errors which I've boiled down to selects during the compile.

here are parts of the manpage of select.

on 11.11 select(2)

#include

int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set
*errorfds, struct timeval *timeout);



11.31 select(2)

#include

int pselect(int nfds, fd_set *__restrict readfds,
fd_set *__restrict writefds, fd_set *__restrict errorfds,
const struct timespec *__restrict timeout,
const sigset_t *__restrict sigmask);

int select(int nfds, fd_set *__restrict readfds,
fd_set *__restrict writefds, fd_set *__restrict errorfds
struct timeval *__restrict timeout);

void FD_CLR(int fd, fd_set *fdset);

int FD_ISSET(int fd, fd_set *fdset);

void FD_SET(int fd, fd_set *fdset);

void FD_ZERO(fd_set *fdset);

For Backward Compatibility Only: (_XOPEN_SOURCE_EXTENDED not defined)

#include

int select(size_t nfds, int *readfds, int *writefds,
int *exceptds, const struct timeval *timeout);


In 11.31, there are 2 types of select statements. One for backwards comaptability???.... which is expecting in int as the 3rd argument which we aren't passing because in both 11.11 and 11.23, its using the other select.

any ideas why this is happening and what I can do?

also, what has changes between 11.11 11.23 and 11.31 that would cause this?

Thanks.

CRS
4 REPLIES 4
Steven Schweda
Honored Contributor

Re: 2 selects in hpux 11.31?

> [...] errors which I've boiled down [...]

What were the error messages _before_ you
boiled them down?

> which is expecting in int as the 3rd
> argument which we aren't passing because in
> both 11.11 and 11.23, its using the other
> select.

Huh?

> any ideas why this is happening [...]

Why _what_, exactly, is happening? You seem
to have boiled all the useful info out of
your problem report.

> [...] and what I can do?

Not sure yet.

Other than those fancy new "__restrict"
keywords, what's the difference between the
old declaration of select() and the new one?
C R S
Occasional Advisor

Re: 2 selects in hpux 11.31?

here is the particular compile line and the resulting warnings and error.

thanks for you time.

## Compiling unixipc.cpp to unixipc.o
aCC -AA -mt +Olit=all -Wc,on +DO11.31 +W829 +W849 -D_REENTRANT -DCMBUILD=\""-.----"\" -DOS_IS_UNIX -DOS_IS_HPUX -DOS_IS_HPUX11_31 -DOS_IS_HPUX11 -g -DCM_HAS_UNIXSOCK -DCM_HAS_RPC -DHAVE_PNG_LIBRARY=1 -DHAVE_ZLIB_LIBRARY=1 -DHAVE_BZIP2_LIBRARY=1 +Z \
-I../include \
-c unixipc.cpp -o unixipc.o
"unixipc.cpp", line 131: warning #2191-D: type qualifier is meaningless on
cast type
const CMUnixIPCRep* rep = static_cast( p_rep );
^

"unixipc.cpp", line 138: warning #2191-D: type qualifier is meaningless on
cast type
const CMUnixIPCRep* rep = static_cast( p_rep );
^

"unixipc.cpp", line 144: warning #2191-D: type qualifier is meaningless on
cast type
const CMUnixIPCRep* rep = static_cast( p_rep );
^

"unixipc.cpp", line 152: warning #2191-D: type qualifier is meaningless on
cast type
const CMUnixIPCRep* rep = static_cast( p_rep );
^

"unixipc.cpp", line 158: warning #2191-D: type qualifier is meaningless on
cast type
const CMUnixIPCRep* rep = static_cast( p_rep );
^

"unixipc.cpp", line 165: warning #2191-D: type qualifier is meaningless on
cast type
const CMUnixIPCRep* rep = static_cast( p_rep );
^

"unixipc.cpp", line 264: error #2167: argument of type "fd_set *" is
incompatible with parameter of type "int *"
int rc = ::select( rep->fd + 1, &r, NULL, NULL, &tv );
Dennis Handly
Acclaimed Contributor

Re: 2 selects in hpux 11.31?

>which is expecting in int* as the 3rd argument which we aren't passing because in both 11.11 and 11.23, it's using the other select.

Then you need to select the proper namespace so you don't get the wrong one. It seems you must define _XOPEN_SOURCE_EXTENDED.

>any ideas why this is happening and what I can do?

Because 11.31 is UNIX 2003 branded and had to change?

>what has change between 11.11 11.23 and 11.31 that would cause this?

The changes just look like syntactic sugar, required to meet the standard.

warning #2191-D: type qualifier is meaningless on cast type
const CMUnixIPCRep* rep = static_cast(p_rep);

You need to remove this const:
... = static_cast(p_rep);

error #2167: argument of type "fd_set *" is incompatible with parameter of type "int *"
int rc = ::select(rep->fd + 1, &r, NULL, NULL, &tv);

You need to change your -Ds so you get the other select(2). You can compile with -E -.i to see what you are getting.

Or you can use a hammer to change your argument from fd_set* to int*.

>Steven: what's the difference between the old declaration of select() and the new one?

int* vs fd_set*. Which is very clear now that we have the error message.

Re: 2 selects in hpux 11.31?

I've included
"#include " before any

"#include " in my source code.

This way, the right select definition is loaded before the wrong one preventing the wrong to be used. Now everyting is compiled.