Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

message queues and poll()

152 views
Skip to first unread message

Rob Y

unread,
Feb 16, 2009, 12:48:55 PM2/16/09
to
I just ran into a problem when we upgraded our development AIX box to
version 5.3. I was using the AIX-specific feature of the poll()
function to poll for a message queue along with my sockets, and it
stopped working. As soon ad I recompiled my server, poll() would
always return an 'invalid argument' error. The previous version of
the server (built on an older AIX box) continued to work, even on the
5.3 box.

Anyway, Googling 'aix poll message queue' turned up the answer.
Apparently you now need a -D_MSGQSUPPORT compile flag to get poll() to
support message queues. Rebuilt my server, and it works again.

Questions:
1. Why the change?
2. Is this feature likely to be deprecated in a future AIX release?

Personally, I think it's a really nice feature. My server talks to a
bunch of sockets on one side and to a transaction dispatcher on the
other side. The transaction dispatcher uses a message queue for
communications, through which it controls a whole set of processes.
Message queues seem to be a bit passe these days, but I don't know of
any other IPC mechanism that so precisely matches the functionality I
want. Anyway, messages can arrive on sockets or the message queue at
any time, and the AIX poll() extension makes this really easy to
handle.

On linux and other unixes, I've had to code this so that my server
blocks on a msgrcv(), and counts on SIGPOLL interrupts to trigger it
to poll for socket input. This works, but there's a small window
where a SIGPOLL can be missed and the server will just hang until the
next message arrives (assuming one does). To work around that, I have
an alarm signal go off every 2 seconds to make sure that I'm calling
poll() periodically. That seems really messy to me, whereas the AIX
poll() is elegant, no?

Thomas Braunbeck

unread,
Feb 16, 2009, 1:18:58 PM2/16/09
to
Rob Y schrieb:

>
> Anyway, Googling 'aix poll message queue' turned up the answer.
> Apparently you now need a -D_MSGQSUPPORT compile flag to get poll() to
> support message queues. Rebuilt my server, and it works again.
>

AIX 5.3 docu states:
In AIX 5.3 and later versions, if a program needs to use message queue
support, the program source code should be compiled with the
-D_MSGQSUPPORT compilation flag.

Same for the 6.1 docu. Seems this does not go away soon.
And why was this changes? I cannot tell (not from home).
Maybe a standard issue.

Rob Y

unread,
Feb 16, 2009, 1:39:55 PM2/16/09
to
On Feb 16, 1:18 pm, Thomas Braunbeck <Thomas.Braunb...@orange.fr>
wrote:

> AIX 5.3 docu states:
> In AIX 5.3 and later versions, if a program needs to use message queue
> support, the program source code should be compiled with the
> -D_MSGQSUPPORT compilation flag.
>

Yeah, that's what Google turned up. Interestingly 'man poll' on my
5.3 system doesn't mention the -D_MSGQSUPPORT flag even though it does
talk about polling for message queues.

Thomas Braunbeck

unread,
Feb 16, 2009, 10:34:30 PM2/16/09
to
Rob Y schrieb:

Could be the man page was not updated... or your system still has
the old, pre 5.3 man pages installed. I'll check at work on 5.3
and 6.1 systems.

0 new messages