Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Mar 1998 14:04:46 -0800
From:      "Rahimi, Ali" <ARahimi@e-planet.com>
To:        freebsd-questions@FreeBSD.ORG
Subject:   Problem with SYSV IPC MSG.
Message-ID:  <0FDE707975DCD0119E75006097C2ED881C85F6@LUNA.e-planet.com>

next in thread | raw e-mail | index | archive | help

> Hi. I have created the following two SYSV message queues:
> 
> 
> bitch:~/camera/apps/videoctrl> ipcs -q
> Message Queues:
> T     ID     KEY        MODE       OWNER    GROUP
> q  65536      23745 --rwarwarwa      ali     1001
> q  65537      23746 --rwarwarwa      ali     1001
> 
> using:
> 
> key_t kid = ftok(VIDEO_CMD_CHANNEL, 0);
> msgq = msgget(kid, IPC_CREAT|0777);
> 
> and by using ftok(...)+1.
> 
> I can reattach to both of these queues just fine. However, I can't
> read from these queues:
> 
> int err = msgrcv(msgq, &ipc_block, sizeof(ipc_block), 1, IPC_NOWAIT);
> 
> ipc_block is a small structure, and msgq is the same as what i got
> from
> msgget() (it's equal to 1 or 2, depending on what I attach to).
> However,
> I get a return value of -1 and errno=EINVAL from msgrcv(). So I tried
> using
> the ID reported by ipcs (that is, 65536 and 65537), and things work
> just
> fine. Anyone know what's up with that? The msgq returned from msgget()
> seems to be in general 65535 short of the msgid that works.
> 
>  Ali.
> 
> 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0FDE707975DCD0119E75006097C2ED881C85F6>