X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Message-ID: <4ABA7B1E.7080100@gmx.de> Date: Wed, 23 Sep 2009 21:46:38 +0200 From: =?ISO-8859-1?Q?Ren=E9_Liebscher?= User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Re: Cygwin 1.7 message queues - permission denied error still exists References: <20090921162314 DOT GJ20981 AT calimero DOT vinschen DOT de> In-Reply-To: <20090921162314.GJ20981@calimero.vinschen.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Corinna Vinschen schrieb: > On Sep 13 16:32, Christopher Faylor wrote: > >> I just modified the test case from the original report: >> >> >>>>> cut here<<< >>>>> >> >>> here was the test case which opens 2 queues un same process <<< >> >>>>> cut here<<< >>>>> >> It behaves the same on both linux and cygwin. >> >> Make sure that you've read: >> >> http://cygwin.com/faq/faq-nochunks.html#faq.programming.ipc >> >> And have cygserver running properly. >> > > Just FYI, running Cygserver is required only for XSI IPC. The POSIX > IPC functions are supposed to work without Cygserver. > > > Corinna > > Hi, there is another problem with the queues. The mentioned test case opens two different queues in the same process. But if you open the same queue in two different processes you get also a permission denied error. I add here some test case: --- file: receiver.c ----------------------- #include #include #include #include #include int main () { int i; const struct mq_attr attr = {.mq_flags = 0,.mq_maxmsg = 8,.mq_msgsize = 4,.mq_curmsgs = 0}; mqd_t mq = mq_open ("/demo", O_RDONLY | O_CREAT, 0644, &attr); if (mq == -1) { perror ("Receiver: mq_open"); exit (1); } for (i = 1; i < 20; i++) { int r; ssize_t msg_size = mq_receive (mq, (char*)&r, sizeof (r), NULL); assert (msg_size == sizeof (int)); if (msg_size == -1) { perror ("Receiver: mq_receive"); exit (1); } printf ("%d. received %d\n", i, r); } mq_close (mq); return 0; } ------------------------------------------ --- file: sender.c ---------------------- #include #include #include #include int main (){ int i; const struct mq_attr attr = {.mq_flags = 0,.mq_maxmsg = 8,.mq_msgsize = 4,.mq_curmsgs = 0}; mqd_t mq = mq_open ("/demo", O_WRONLY | O_CREAT, 0644, &attr); if (mq == -1) { perror ("Sender: mq_open"); exit (1); } for (i = 1; i < 20; i++) { mqd_t mq_result = mq_send (mq, (char *) &i, sizeof (i), 1); if (mq_result == -1) { perror ("Sender: mq_send"); exit (1); } printf ("Sent %d\n", i); } mq_close (mq); return 0; } ----------------------------------------- It just sends an integer from sender to receiver. Compiled on linux with: gcc -g -o receiver receiver.c -lrt gcc -g -o sender sender.c -lrt On Linux you can start them in any order in two terminal windows and get: --------------------------- # ./sender Sent 1 Sent 2 ... Sent 18 Sent 19 # --------------------------- and --------------------------- # ./receiver 1. received 1 2. received 2 ... 18. received 18 19. received 19 # --------------------------- However on cygwin it doesn't matter which of the processes you start first, the second one will get a permission denied. --------------------------- $ ./sender Sent 1 Sent 2 Sent 3 Sent 4 Sent 5 Sent 6 Sent 7 Sent 8 --- it waits here to get free places in queue (when receiver is running) --------------------------- But the receiver gets this: --------------------------- $ ./receiver Receiver: mq_open: Permission denied --------------------------- Kind regards René Liebscher BTW: Before someone asks for it: --------------------------- $ uname -r 1.7.0(0.212/5/3) $ uname -v 2009-09-11 01:25 --------------------------- -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple