Sponsored Content
Full Discussion: Problem with msgget()
Top Forums Programming Problem with msgget() Post 302088611 by Ashwini on Wednesday 13th of September 2006 01:38:44 PM
Old 09-13-2006
Problem with msgget()

Hi,

I am having problem with msgget() function.

Here is the problem that I am having on Unix :



I have two processes sender and receiver. Sender generates queue (msgget()) with some key e.g. 938, for output.

Receiver reads from the same queue. i.e. receiver also tries to get queue id calling msgget() function and using same key, 938 that sender used.



But the qid that sender is receiving from msgget() function is 16777219 and receiver is getting different qid. Ideally it should get the same qid i.e. 16777219.



I tried to remove this queue using



ipcrm -q <qid>



And I tried to bring up sender with key as 338. But still it is building qid as such huge number and receiver is getting different qid.


Now I am able to read from this queue.

But still not sure whether this qid is correct or not



Please let me know how do I resove this.

Thanks,
Ashwini

Last edited by Ashwini; 09-14-2006 at 10:54 AM..
 

10 More Discussions You Might Find Interesting

1. Programming

about msgget troble

hi,all i have in trouble about msgget. i create a queue and the program like blow: openMsg( pid_t key ) { .... int msgid; .... msgid=msgget(key,IPC_CREAT|IPC_EXCL|0666) if( msgid<=0 ){ fprintf( stdout,"%s,%d",strerror(errno),errno ); return -1; ... (9 Replies)
Discussion started by: subrain
9 Replies

2. UNIX for Advanced & Expert Users

SSH Problem auth problem

Hi, Just recently we seem to be getting the following error message relating to SSH when we run the UNIX script in background mode: warning: You have no controlling tty. Cannot read confirmation.^M warning: Authentication failed.^M Disconnected; key exchange or algorithm negotiation... (1 Reply)
Discussion started by: budrito
1 Replies

3. Shell Programming and Scripting

problem with dd command or maybe AFS problem

Hi, folks. Sorry for bothering, but maybe someone could help me please. The problem is the following: there is some script that copies files from local file system to AFS. The copying is performed with dd command. The script copies data into some AFS volumes. The problem appeared with one... (0 Replies)
Discussion started by: Anta
0 Replies

4. AIX

user login problem & Files listing problem.

1) when user login to the server the session got colosed. How will resolve? 2) While firing the command ls -l we are not able to see the any files in the director. but over all view the file system using the command df -g it is showing 91% used. what will be the problem? Thanks in advance. (1 Reply)
Discussion started by: pernasivam
1 Replies

5. UNIX for Dummies Questions & Answers

DHCP problem and eth1 problem

At work I am trying to get this one Linux machine (let's call it ctesgm07) to behave like another Linux machine that we have (let's call it test007). test007 returns the following version info: cat /etc/debian_version: lenny/sid uname -a: Linux test007 2.6.27-7-generic #1 SMP Tue Nov 4... (0 Replies)
Discussion started by: sllinux
0 Replies

6. IP Networking

Problem with forwarding emails (SPF problem)

Hi, This is rather a question from a "user" than from a sys admin, but I think this forum is apropriate for the question. I have an adress with automatic email forwarding and for some senders (two hietherto), emails are bouncing. This has really created a lot of problems those two time so I... (0 Replies)
Discussion started by: carwe
0 Replies

7. Programming

msgget message queue always get permission denied

I want to use msgget() to obtain a message queue between two processes, here is my code: the first one create the mq, the second one open it and add a message to it. But when I execute the second one, I get permission denied. I've already desperately tried everything I can think of to solve this... (2 Replies)
Discussion started by: tefino
2 Replies

8. Programming

Msgget(2) returns 0 - a workaround fix

Greetings: I am posting this because my searches for this problem only came up with two posts and no helpful suggestions. I have a "solution" (read work-around hack) and have not tried yet to find a root cause, and may never because I am busy doing other things (read working to pay the bills). ... (10 Replies)
Discussion started by: mr_bandit
10 Replies

9. UNIX for Dummies Questions & Answers

sed Or Grep Problem OR Terminal Problem?

I don't know if you guys get this problem sometimes at Terminal but I had been having this problem since yesterday :( Maybe I overdid the Terminal. Even the codes that used to work doesn't work anymore. Here is what 's happening: * I wanted to remove lines containing digits so I used this... (25 Replies)
Discussion started by: Nexeu
25 Replies

10. IP Networking

Router problem or ISP problem ?

Hi everyone, I am experiencing discontinuity of Internet service, this started 1 month ago. Everything worked very well for 1 year of intensive use, but now, I have problems reaching my gateway. The gateway is not my router but a node belonging to my ISP and I share the same public IP with... (3 Replies)
Discussion started by: remic
3 Replies
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)
All times are GMT -4. The time now is 10:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy