From owner-freebsd-questions Tue Mar 10 14:06:28 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id OAA11501 for freebsd-questions-outgoing; Tue, 10 Mar 1998 14:06:28 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from luna.e-planet.com (luna.e-planet.com [192.203.7.4]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id OAA11277 for ; Tue, 10 Mar 1998 14:05:18 -0800 (PST) (envelope-from ARahimi@e-planet.com) Received: by LUNA.e-planet.com with Internet Mail Service (5.0.1458.49) id ; Tue, 10 Mar 1998 14:04:48 -0800 Message-ID: <0FDE707975DCD0119E75006097C2ED881C85F6@LUNA.e-planet.com> From: "Rahimi, Ali" To: freebsd-questions@FreeBSD.ORG Subject: Problem with SYSV IPC MSG. Date: Tue, 10 Mar 1998 14:04:46 -0800 X-Priority: 3 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.0.1458.49) Content-Type: text/plain Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > 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