2011-09-29 69 views
0

所以我有升压1.47以下代码:的boost ::进程间:: message_queue权限被拒绝

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(消息)= 256。

输出是: 权限被拒绝

如果我运行root用户,它会通过。我无法弄清楚它试图写入哪里会出现许可错误。查看boost代码,不应该只是在/ tmp/boost_interprocess中,任何用户都有权创建和写入该代码?此外,我注意到https://svn.boost.org/trac/boost/ticket/4250,但现在应该修复。

任何帮助,将不胜感激。

回答

0

我在Centos 5.5上。对我来说,需要为运行队列的用户设置umask为022. 在.bashrc中设置后,所有工作都按预期运行。