Hi!!
This code works if I don't remove the message queue.
In A.c I create 3 processes that send a message in a message queue.
in B.c other 3 processes receive 1 message for each (the messages sent from A), change the value of "dato" and put again the message in the queue.
The processes in A.c receive the modified message and then I should remove the queue.
The answer is: How can I remove the queue after ALL the processes have received the message? I tried with 3 wait(0) but the queue is removed after the first process has received the message and I can't understand why
Code here:
Hi,
I am working closly with unix message queues i have encountered the following -
after creating the Q and start working with it (pushing & pulling) i receive the following stange parameters on the q's -
STIME=no_entry
Qnum=0
CBYTES=4140
when this happens, the Q is disabled (meaning i... (3 Replies)
I have a problem with running jobs out of cron on Solaris 8.
Initially when one of the users on the box (other than root) attempted to save the crontab after modification by using "crontab -e", the message "Crontab: cannot open the crontab file in the crontab directory" was given.
I then... (7 Replies)
hi all,
I'm working on this problem for 2 days. Can somebody tell me that how to delete all message queues from the system ?
Since "ipcs -q" gives the list of all existing message queue, then there must be a system call and data stucture where from I can fetch the data about all existing... (2 Replies)
I am sending and retriving the message to the queue
the problem is
after retrieving the message can i see what is there in my message queue.
(actually in my application i am encountring some garbage value)
so i want to retieve this garbage value and also want to know its size
how... (0 Replies)
hi all...
ive been trying this program where i spawn 4 threads... and i am trying to use message queue to send msgs from 3 of the threads to the parent thread... but it doent seem to be working... ive almost pulled out my hair tryin to fix the prob :confused:
another wierd thing... (1 Reply)
Hello,
i need to write a message queue "chat server", that should work only localy.
Can anyone please help me with some ideas and peshaps code. I'm studying the UNIX IPC mechanisms right now. So far, i understand how it works but i still cannot get an idea how to write a chat programm...
... (2 Replies)
Hii can anyone pls tell how to limit the max no of message in a posix message queue. I have made changes in proc/sys/fs/mqueue/msg_max
But still whenever i try to read the value of max. message in the queue using attr.mq_curmsgs (where struct mq_attr attr) its giving the default value as 10.... (0 Replies)
Hi all,
I need help about message queues, i have a server-client program that communicates each other via msg queue, firstly server opens its msg queue and waits for msg then client opens server msg queue and its own msg queue(for receiving msg from server,clients sends msg to server msg... (7 Replies)
Hello
How can I see the created message queues in the system? (4 Replies)
Discussion started by: xyzt
4 Replies
LEARN ABOUT FREEBSD
msgget
MSGGET(2) BSD System Calls Manual MSGGET(2)NAME
msgget -- get message queue
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
int
msgget(key_t key, int msgflg);
DESCRIPTION
The msgget() function returns the message queue identifier associated with key. A message queue identifier is a unique integer greater than
zero.
A message queue is created if either key is equal to IPC_PRIVATE, or key does not have a message queue identifier associated with it, and the
IPC_CREAT bit is set in msgflg.
If a new message queue is created, the data structure associated with it (the msqid_ds structure, see msgctl(2)) is initialized as follows:
o msg_perm.cuid and msg_perm.uid are set to the effective uid of the calling process.
o msg_perm.gid and msg_perm.cgid are set to the effective gid of the calling process.
o msg_perm.mode is set to the lower 9 bits of msgflg.
o msg_cbytes, msg_qnum, msg_lspid, msg_lrpid, msg_rtime, and msg_stime are set to 0.
o msg_qbytes is set to the system wide maximum value for the number of bytes in a queue (MSGMNB).
o msg_ctime is set to the current time.
RETURN VALUES
Upon successful completion a positive message queue identifier is returned. Otherwise, -1 is returned and the global variable errno is set
to indicate the error.
ERRORS
[EACCES] A message queue is already associated with key and the caller has no permission to access it.
[EEXIST] Both IPC_CREAT and IPC_EXCL are set in msgflg, and a message queue is already associated with key.
[ENOSPC] A new message queue could not be created because the system limit for the number of message queues has been reached.
[ENOENT] IPC_CREAT was not set in msgflg and no message queue associated with key was found.
SEE ALSO msgctl(2), msgrcv(2), msgsnd(2)HISTORY
Message queues appeared in the first release of AT&T System V UNIX.
BSD July 9, 2009 BSD