02-07-2009
Also, I don't think your receiver program needs the IPC_CREAT flag. It may be making a brand-new queue overtop your old one.
10 More Discussions You Might Find Interesting
1. Programming
When I am using msgrcv to get a message from a queue, in case of msgsnd some error, the msgrcv thread will waiting forever.
Is there some way that I can specify a time out value for this queue ? just let msgrcv wait for some time, if no message comes during this time slot, msgrcv just return... (3 Replies)
Discussion started by: Yun Gang Chen
3 Replies
2. UNIX for Dummies Questions & Answers
Hi All,
Please guide me how to get rid :
msgrcv : Invalid argument.
I am using message queues: msgsnd and msgrcv,
I am able to send through msgsnd and receive through msgrcv, but at times i get the belo error.
msgrcv : Invalid argument. (1 Reply)
Discussion started by: answers
1 Replies
3. AIX
Hi All,
I have a piece of code like blow. It is working fine with AIX 5.3 SP3. When the same thing is getting executed in AIX 5. SP6 it is giving segmentation fault. If I put debug statements before and after, it works fine.
rc = msgrcv(mqid, &msg, size, HIGH_PRIORITY_FIRST , 0)
... (0 Replies)
Discussion started by: sandhya_chp
0 Replies
4. Programming
HI,
When i am configuring php in SUN Solaris. I am getting the below error.
configure: error: Your system seems to lack POSIX threads.
Do i need to install POSIX? If so can somebody let me know where can i download POSIX for Solaris 8?
Thanks, (2 Replies)
Discussion started by: Krrishv
2 Replies
5. UNIX for Advanced & Expert Users
Hi,
consider the code below:
#include <stdio.h>
.
.
struct myStruct
{
char *message ;
int id;
};
.
.
.
void *thread_function( void *ptr );
nt main()
{
pthread_t thread1, thread2 ,thread3 ;
struct myStruct nico1; (2 Replies)
Discussion started by: Behnaz
2 Replies
6. What is on Your Mind?
Hi everybody,
i couldn't think of any better place to ask this question.
Does LINUX totally confirm with ALL of the POSIX standards??. If not which areas does it diverge??
my apologies if this questions seems sooo stupid to some of you..
thanks (0 Replies)
Discussion started by: abhiram7
0 Replies
7. UNIX for Dummies Questions & Answers
Hi everybody,
this is the situation. there is a programm XYZ which opens a message queue with the key 47110815 and waits for a SIGUSR1. After receiving this signal it sends a message with type 100 and a number (as ASCII) in the message-body.
I have to write a prog which frist sends the... (1 Reply)
Discussion started by: daredevil82m
1 Replies
8. UNIX for Advanced & Expert Users
Hi ,
I am using UNIX network programming Vol1 (by R Stevens) book to learn about IPC.
I would be using HP-UX,Solaris and Linux at my work.
I have sections for POSIX and for System V in that book.
I am quite confused in indentifying those OSs as POSIX or SYstem V.
Can anyone please... (1 Reply)
Discussion started by: kumaran_5555
1 Replies
9. Programming
I want to create a program that creates 2 child process, and each of them creates 2 threads, and each thread prints its thread id. I0ve allread done that the outuput isn't the outuput i want.
When a run the following comand "$./a.out | sort -u | wc -l" I have the folowing output
2
$:
It should... (3 Replies)
Discussion started by: pharaoh
3 Replies
10. Programming
Hi, I am trying to send/receive data by message queue and expecting it to be blocked on send/read for other side (at least this is my understooding ) , I am connecting message between perl<->C , perl is working as expected , but in C msgsnd and msgrcv are not waiting (blocked) untill second side... (6 Replies)
Discussion started by: alexse
6 Replies
LEARN ABOUT ULTRIX
msgget
msgget(2) System Calls Manual msgget(2)
Name
msgget - get message queue
Syntax
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
int msgget (key, msgflg)
key_t key;
int msgflg;
Description
The system call returns the message queue identifier associated with key.
A message queue identifier and associated message queue and data structure are created for key if one of the following is true:
o The key is equal to IPC_PRIVATE
o The key does not already have a message queue identifier associated with it, and (msgflg & IPC_CREAT) is true. For further informa-
tion, see
Upon creation, the data structure associated with the new message queue identifier is initialized as follows:
o The msg_perm.cuid, msg_perm.uid, msg_perm.cgid and msg_perm.gid members are set equal to the effective user ID and effective group ID,
respectively, of the calling process.
o The low-order nine bits of msg_perm.mode are set equal to the low-order nine bits of msgflg.
o The msg_qnum, msg_lspid, msg_lrpid, msg_stime, and mgs_rtime members are set equal to 0.
o The msg_ctime is set equal to the current time.
o The msg_qbytes is set equal to the system limit.
Return Values
Upon successful completion, a non-negative integer, which is a message queue identifier, is returned. Otherwise, a value of -1 is
returned, and errno is set to indicate the error.
Diagnostics
The system call fails under the following conditions:
[EACCES] A message queue identifier exists for key but operations permission, as specified by the low-order nine bits of msgflg,
would not be granted. For further information, see
[ENOENT] A message queue identifier does not exist for key and the logical operation (msgflg & IPC_CREAT) is false.
[ENOSPC] A message queue identifier is to be created, but the system-imposed limit on the maximum number of allowed message queue
identifiers system wide would be exceeded.
[EEXIST] A message queue identifier exists for key but the logical operation ((msgflg & IPC_CREAT ) & (msgflg & IPC_EXCL )) is true.
See Also
msgctl(2), msgop(2), ftok(3)
msgget(2)