ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
i have always avoided message queues for some reason, as i preferred using shared memory or FIFO's for IPC. anyhow, i was bored today, and having a stevens craving so i decided to read about message queues in unpv2. so i read chapter 5 all about POSIX mq's, and then realized they were actually kinda cool and regretted always passing them by. so i go to modify an old program i wrote that used FIFO's and change it to use mq's, but... LINUX DOESN'T SUPPORT POSIX MESSAGE QUEUES!!??!! wtf is that about?? after googling for a bit i find that they are now supported in 2.6, but u also need to upgrade your glibc which sounds rather painful. i was pretty disappointed about that. it seems almost pointless to use them if you are going to be distributing an application, most people are still running 2.4, or possibly even older kernels, and almost certainly older glibc's that dont support them. pretty lame.... thoughts/experiences on/with this??
Linux does support "System V IPC message queue's" for quite some time. I actually used it on 2.4.x kernels, and I'm quite convinced 2.2.x also supports it. AFAIK System V syscalls are also quite portable. Do you really want the POSIX message queues?
See the man pages for "msgget", "msgctl", "msgsnd", "msgrcv" for more information.
Yes. As Hko said, Linux 2.4 and older supports System V msg qs. I have used them on my Red Hat 7.3 and 9. I think the best resource to read up on them is again Stevens, 'Unix Network Programming', (Maybe it is the first edition, the book with the green cover).
yep, that's the next chapter i'll have to check that out tomorrow then. but it does annoy me that linux skimps out on a number of POSIX features, especially process shared mutexes && cond variables. i grow to like freebsd more and more every day
i dont htink im qualified to really answer that question, but i can mention some of the differences. posix message queues have more features than sysV. posix ones u can be notified asynchronously, either by getting sent a signal or by a thread being spawned for each message. sysV u have to poll for messages. and for the mutex, iirc the difference is that sysV mutexes stick around in the kernel until they are explicitly deleted, u can't have anonymous ones. posix ones can be anonymous and shared in memory between processes. i guess it really isn't that big of deal, it just disappoints me when i read a whole bunch of stuff about how to use something, and i then i go to play with it and it's not supported. that's why i've been using bsd's recently b/c they are certainly a more mature OS. and thanks, i hope one day u find my site useful.