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 							 msgget(2)

NAME
msgget - get message queue SYNOPSIS
#include <sys/msg.h> int msgget(key_t key, int msgflg); DESCRIPTION
The msgget() argument returns the message queue identifier associated with key. A message queue identifier and associated message queue and data structure (see Intro(2)) are created for key if one of the following are true: o key is IPC_PRIVATE. o key does not already have a message queue identifier associated with it, and (msgflg&IPC_CREAT) is true. On creation, the data structure associated with the new message queue identifier is initialized as follows: o msg_perm.cuid, msg_perm.uid, msg_perm.cgid, and msg_perm.gid are set to the effective user ID and effective group ID, respec- tively, of the calling process. o The low-order 9 bits of msg_perm.mode are set to the low-order 9 bits of msgflg. o msg_qnum, msg_lspid, msg_lrpid, msg_stime, and msg_rtime are set to 0. o msg_ctime is set to the current time. o msg_qbytes is set to the system limit. See NOTES. RETURN VALUES
Upon successful completion, a non-negative integer representing a message queue identifier is returned. Otherwise, -1 is returned and errno is set to indicate the error. ERRORS
The msgget() function will fail if: EACCES A message queue identifier exists for key, but operation permission (see Intro(2)) as specified by the low-order 9 bits of msgflg would not be granted. EEXIST A message queue identifier exists for key but (msgflg&IPC_CREAT) and (msgflg&IPC_EXCL) are both true. ENOENT A message queue identifier does not exist for key and (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 identi- fiers system wide would be exceeded. See NOTES. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
rctladm(1M), Intro(2), msgctl(2), msgrcv(2), msgsnd(2), setrctl(2), ftok(3C), attributes(5), standards(5) NOTES
The system-defined limit used to initialize msg_qbytes is the minimum enforced value of the calling process's process.max-msg-qbytes resource control. The system-imposed limit on the number of message queue identifiers is maintained on a per-project basis using the project.max-msg-ids resource control. The zone.max-msg-ids resource control restricts the total amount of message queue identifiers that can be allocated by a zone. See rctladm(1M) and setrctl(2) for information about using resource controls. SunOS 5.11 14 Aug 2006 msgget(2)
All times are GMT -4. The time now is 09:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy