尝试使用POSIX消息队列创建消息队列时,权限被拒绝 [英] Permission denied when trying to create message queue using POSIX Message Queues
本文介绍了尝试使用POSIX消息队列创建消息队列时,权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我通过遵循 Linux编程接口来创建带有以下代码段的消息队列.
I am creating a message queue with the following snippet by following The Linux Programming Interface.
if((mq_open("/my_message_queue", O_CREAT, O_RDWR, NULL)) == -1) {
perror("mq creation failed");
}
运行此代码段时出现错误:权限被拒绝".我想检查一下以前是否创建了队列并且没有销毁它,所以我使用了ipcs.但是,ipcs不会显示任何活动的消息队列.以前(Ubuntu 18.04)我从未在开发环境中使用过POSIX IPC库.我必须做一些设置以允许我的用户进程创建消息队列吗?我使用API的方式不正确吗?
Running this snippet I get an error: "permission denied". I wanted to check and see if I had created the queue previously and not destroyed it, so I used ipcs. However, ipcs does not show any active message queues. I have never used the POSIX IPC libraries in my development environment before (Ubuntu 18.04). Is some set up I must do to allow my user process to create a message queue? Am I using the API incorrectly?
推荐答案
查看全文