Sponsored Content
Top Forums Programming Msgget(2) returns 0 - a workaround fix Post 302907430 by mr_bandit on Friday 27th of June 2014 06:54:54 PM
Old 06-27-2014
Quote:
Originally Posted by jim mcnamara
Less forcefully than Don steated it, but I think is idea of success return code is the entire problem here, plus using msgid as a message and NOT as message queue id. Which it is. They are not the same thing. Period.
I am not trying to flame, but *please* point out *one* place I used msgq_id as a message. You keep saying the same thing but will not give one example of where I did so.

In the meantime, I am going to see my family for a week, so I will check for a reply when I get back.
 

9 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. Shell Programming and Scripting

find & sed -i work fine. Now need -i workaround for old OS.

I have a script that does a search and replace on a tree using find, xargs and sed that looks something like this. find . -type f -print0 | xargs -0 sed -i 's/fromthis/tothis/g' Now this works fine on new versions on Linux but I need to make the script work on an old RAQ550 that has an older... (3 Replies)
Discussion started by: simonb
3 Replies

3. Programming

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... (2 Replies)
Discussion started by: Ashwini
2 Replies

4. UNIX for Dummies Questions & Answers

Workaround for macros in sftp command

Hi, I've some existing scripts wherein am using ftp + .netrc. I've defined my macros in .netrc file. I want to switch to sftp now but it seems it doesn't support macros and .netrc and it gives "command invalid" error. Is there any other alternative? Note: I don't want help for... (1 Reply)
Discussion started by: ps51517
1 Replies

5. Windows & DOS: Issues & Discussions

Samba trouble shoot / workaround ?

Hello, I've setup a ubuntu 10.04 server running samba 3.4.7 as domain controler / file server at a customer site, that works great most of the time but I face a random problem. Of course I'm never on the site when the problem occurs, so I cannot investigate in real time. What happens is that... (2 Replies)
Discussion started by: Manu.b
2 Replies

6. Shell Programming and Scripting

Calculation returns no value

#/bin/sh ..... #convert memory to MB let "mmsize_a= ($mmsize)/256" let "mminuse_a= ($mminuse)/256" let "mmfree_a= ($mmsize_a -$mminuse_a)" let "mmfreepercent= (($mmfree_a)/($mmsize_a))*100" # #format output echo "\n\n######################" >>$sndFile echo "\n$sysName Total Memory usage"... (3 Replies)
Discussion started by: Daniel Gate
3 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. UNIX for Advanced & Expert Users

stuck in CLOSE_WAIT Solaris 10 - Patch and workaround

Solaris 10 Sparc: When you got a connection locking a tcp/port, and the status is CLOSE_WAIT (for ever :wall:), you just use the tcpdrop, to close the connection. This is a OS bug. I wrote the bug id bellow: BUG-ID 6468753 connections stuck in CLOSE_WAIT The patch that's correct the bug:... (0 Replies)
Discussion started by: thiagofborn
0 Replies

9. AIX

AIO workaround AIX 5.3 to AIX 7.1

Hello Folks, Facing a problem starting Apache Services on AIX 7.1 This is the error i'm getting /oraapp/prodora/iAS/Apache/Apache/bin/apachectl start: httpd started Syntax error on line 17 of /oraapp/prodora/iAS/Apache/modplsql/cfg/plsql_pls.conf: Cannot load... (0 Replies)
Discussion started by: filosophizer
0 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 06:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy