mq_open() problem
- From: Larry I Smith <larryXiXsmith@xxxxxxxxxxx>
- Date: Fri, 20 Jan 2006 00:30:13 GMT
SuSE Pro v9.3:
Linux 2.6.11.4-21.10-default #1 i686 i686 i386 GNU/Linux
I've been tasked with porting a large s/w suite from
Win32 to linux.
We're using Named Queues to replace the Windows
Message Queue functionality. This allows the
existing Windows message loop/case code to remain
unchanged. (the apps have to compile on windows or linux).
The programs comprising the suite (30 or so) can be
launched individually, in any order, or they can
be launched by a Master Controller program (at system
startup). Once launched the apps put their names & PID's into
a well know Named Memory block created via shm_open(),
on Windows they put their msg queue handle in the block.
They can then communicate via named queues where the queue
names are built using a string+PID (e.g. "ABCO_12345").
EX: app1 creates its queue in its main() using its PID as
part of the name (via mq_open() with the CREATE flag),
then puts its PID into the Named Memory.
app1 can talk to app2 by fetching app2's PID from the
Named Memory, creating app2's queue name using that
PID, then calling mq_open() without the CREATE flag.
All of this works quite well EXCEPT when the Master Controller
program launches the apps (via fork/exec).
The Master Controller program creates its named queue before
exec'ing the other apps. After being exec'd, each app creates
it own named queue at the top of its main()...
mq_open() fails with errno 12 (out of memory) after 9 (nine)
named queues have been created (i.e. after 8 apps have been
fork/exec'd). Error 12 is not one of the errors documented in the
mq_open() man page.
'cat /proc/sys/fs/mqueue/queues_max' show 256 as the named queue
limit. I edited /etc/sysctl.conf to increase this number, but
it had no effect.
'/usr/include/bits/posix1_lim.h' contains the lines:
/* Maximum number of message queues open for a process. */
#define _POSIX_MQ_OPEN_MAX 8
Since the apps are started via fork/exec, I wouldn't think
the above limit would apply.
'getconf' shows:
MQ_OPEN_MAX
GNU_LIBC_VERSION glibc 2.3.4
GNU_LIBPTHREAD_VERSION NPTL 2.3.4
Note that MQ_OPEN_MAX is blank in the 'getconf' output.
Any ideas?
This is a major problem for us.
Thanks & regards,
Larry
.
- Prev by Date: Re: Detecting process creation/deletion
- Next by Date: Re: Linux/unix Shell
- Previous by thread: Linux/unix Shell
- Next by thread: Serial communication, detecting parity bits
- Index(es):
Relevant Pages
|