繁体   English   中英

boost :: interprocess :: message_queue权限被拒绝

[英]boost::interprocess::message_queue permission denied

因此,我使用boost 1.47编写以下代码:

try
{
  m_messageQueue = boost::shared_ptr<boost::interprocess::message_queue>(
           new boost::interprocess::message_queue (
             boost::interprocess::open_or_create
             ,name.c_str()             //name
             ,numElements              //max message number
             ,sizeof(Message)          //max message size
             ));
}
catch(boost::interprocess::interprocess_exception &e)
{
  cerr << e.what();
}

其中name =“ test_queue”,numElements = 100和sizeof(Message)= 256。

输出为:权限被拒绝

如果我以root用户身份运行,它将通过。 我无法弄清楚它试图写到哪里会有权限错误。 看一下增强代码,难道它不应该位于任何用户都有权创建和写入的/ tmp / boost_interprocess中吗? 另外,我注意到https://svn.boost.org/trac/boost/ticket/4250 ,但是现在应该对此进行修复。

任何帮助,将不胜感激。

我使用的是Centos 5.5。 对我而言,需要将运行队列的用户的umask设置为022。在.bashrc中进行设置后,所有工作均已按预期进行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM