Sponsored Content
Top Forums Programming Permission denied when creating message queue Post 302453261 by majid.merkava on Tuesday 14th of September 2010 03:47:05 PM
Old 09-14-2010
Permission denied when creating message queue

Hi guys.

i have wrote a simple program to test message queue attributes. here it is:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <mqueue.h>
#include <fcntl.h>   
#include <string.h>
#include <errno.h>
#include <sys/stat.h>

int main()
{
    struct mq_attr attr;
    mqd_t mqd;
    if ((mqd = mq_open("/tmp/queue.123", O_RDWR | O_CREAT, S_IRUSR | S_IWUSR, NULL)) == -1)
    {
        printf("damn it: %s\n", strerror(errno));
        exit(EXIT_FAILURE);
    }
    mq_getattr(mqd, &attr);
    printf("max message on queue: %ld\n", attr.mq_maxmsg);
    printf("max message size: %ld\n", attr.mq_msgsize);
    printf("current number of message on the queue: %ld\n", attr.mq_curmsgs);
    mq_close(mqd);
    mq_unlink("/tmp/queue.123");
    return EXIT_SUCCESS;
}

but when i run it always it prints:
Code:
damn it: Permission denied

I executed it under root user but again this error.
also permissions for /tmp directory is 777.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Permission denied

Hi, I can not execute a .env file $ . /Data/oracle/d03/mydbora/8.0.6/MYDB.env -bash: /Data/oracle/d03/mydbora/8.0.6/MYDB.env: Permission denied Even if : -rwxrwxrwx 1 oracle dba 2903 Mar 5 2007 /Data/oracle/d03/mydbora/8.0.6/MYDB.env Please help. Many thanks. (1 Reply)
Discussion started by: big123456
1 Replies

2. Programming

URGENT:::Can anybody help me in creating message queue appliction??

hello, I had to implement a message queue application....between 30 processes...... all 30 proceses are getting data from serial port.... And here is THE FLOW::::::::1 connector process...which is linked with message queue to all the 30 applications. Processes get the data from serial port and... (9 Replies)
Discussion started by: arunchaudhary19
9 Replies

3. Programming

How to limit max no of message in a posix message queue

Hii can anyone pls tell how to limit the max no of message in a posix message queue. I have made changes in proc/sys/fs/mqueue/msg_max But still whenever i try to read the value of max. message in the queue using attr.mq_curmsgs (where struct mq_attr attr) its giving the default value as 10.... (0 Replies)
Discussion started by: mohit3884
0 Replies

4. Solaris

Permission denied message for parent directory

Hi All, I have an issue that's eating my head for few days. I would appreciate if anyone could help me out in this to resolve this. In Solaris 8 container I am facing the below issue. As oracle user when I do ls -l in /dboracle mountpoint getting permission denied error messages. $ ls... (3 Replies)
Discussion started by: Sreerag446
3 Replies

5. Shell Programming and Scripting

Executing expect script giving message as bad interpreter: Permission denied

Hi Gurus, I am new to scripting and needs your help in expect script used for telnet. I wrote a simple script as #!/usr/bin/expect-5.43 -f spawn telnet localhost 2233 expect "password:" send "secret\r" send "i data.cnbc.com\r" send "exit\r" expect eof When I am trying to execute... (2 Replies)
Discussion started by: niks_yv
2 Replies

6. Red Hat

Permission denied

Hi guys im new to this db i have a small prob while installing websphereportal6.1i think i was installed succesfully but the error im getting is while starting server. check this out # ./serverStatus.sh -all Error loading: /usr/wps61/AppServer/java/jre/bin/classic/libjvm.so: cannot... (1 Reply)
Discussion started by: varma917989
1 Replies

7. UNIX for Dummies Questions & Answers

Permission Denied creating file under nfs mount

I have two servers, 82 and 70. My exports file on 82 reads / ...70(rw) on 70 I have a mountpoint called mnt_for_82 I execute on 70 mount -t nfs -o rw ...82:/ mnt_for_82 I go to server 70 and indeed can read and travers the mounted subdirectories. However, I try... (0 Replies)
Discussion started by: blaine.miller
0 Replies

8. Programming

creating a message queue using mq_open

Hi all, First of all thanks in advance for reading my post and for your heart for helping me. I am trying to create a message queue using mq_open(name,oflags,mode_t,attr) method. But that function call is returning with an error code EFAULT. By googling it I found that it happens when there is... (10 Replies)
Discussion started by: parusasi
10 Replies

9. 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

10. Ubuntu

Permission denied

Trying to get date into the txt file. It says Permission denied. echo $(date +%I:%M:%S_%D) >> /tmp/systemd_suspend_test_err.txt exec 2>> /tmp/systemd_suspend_test_err.txt if ; then # Do the thing you want before suspend here echo "we are suspending $(date +%I:%M:%S_%D)." elif ;... (5 Replies)
Discussion started by: drew77
5 Replies
MSG_GET_QUEUE(3)							 1							  MSG_GET_QUEUE(3)

msg_get_queue - Create or attach to a message queue

SYNOPSIS
resource msg_get_queue (int $key, [int $perms = 0666]) DESCRIPTION
msg_get_queue(3) returns an id that can be used to access the System V message queue with the given $key. The first call creates the mes- sage queue with the optional $perms. A second call to msg_get_queue(3) for the same $key will return a different message queue identifier, but both identifiers access the same underlying message queue. PARAMETERS
o $key - Message queue numeric ID o $perms - Queue permissions. Default to 0666. If the message queue already exists, the $perms will be ignored. RETURN VALUES
Returns a resource handle that can be used to access the System V message queue. SEE ALSO
msg_remove_queue(3), msg_receive(3), msg_send(3), msg_stat_queue(3), msg_set_queue(3). PHP Documentation Group MSG_GET_QUEUE(3)
All times are GMT -4. The time now is 10:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy