To be honest, I did not look at errno after msgget() returned 0 (It was in the wee early hours and I had bigger fish..). I will try that and get back with the results. This will also tell me if the original key returns 0.
The interesting thing is we loaded a *way* earlier version of the code to test a completely different thing. I jut did a ipcs and got
where you can see msgqid == 0 and the system seems to be performing happily (at least this part of it). This would seem to enforce the observation / theory that once the msgqid becomes 0, it stays 0. No complaints from msgsnd() or msgrcv().
So - this may be a brainfart on my part. After all, I did have another bug throwing a SIGSEGV at the same time. And it was very late/early. If it is a brainfart, my apologies.
Again, this an unpatched Ubuntu 8
@achenlehas an interesting suggestion. I had not thought of setting errno to a value before making the call. The question then becomes: why not set it to (-1)? errno values are positive, at least on Linux. (I seem to remember them being negative numbers on BSD 4.1, but that was a *long* time ago...)
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)
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)
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)
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)
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)
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)
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)
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
LEARN ABOUT OPENSOLARIS
msgget
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)