Boost logo

Boost Testing :

From: Boris Gubenko (Boris.Gubenko_at_[hidden])
Date: 2007-11-13 16:35:04


  I ran your program example on Tru64 and HP-UX: it succeeds on the former
  and fails on the latter. What fails on HP-UX is a call to shm_open()
  from interprocess/shared_memory_object.hpp:

   //Open file using POSIX API
   m_handle = shm_open(m_filename.c_str(), oflag, S_IRWXO | S_IRWXG | S_IRWXU);

  As you can see from the output on the two systems, on Tru64, the library
  is prepanding "/tmp/boost_interprocess/" to the filename while on HP-UX,
  the filename remains "/shm_name", so, it is not a surprise that shm_open()
  fails with EACCES.

  I'll search interpocess library sources later today to see how the
  filename is formed, but you, probably, know the answer right away :-)

  Thanks again for your help,
    Boris

Tru64
-----
bash-2.04$ ~/trace ~/x.out 2>&1 | grep shm
open ("/tmp/boost_interprocess//shm_name", O_RDWR|O_CREAT|O_EXCL, 777) = 5
unlink ("/tmp/boost_interprocess//shm_name") = 0
bash-2.04$

HP-UX
-----
bash-2.03$ tusc -s shm_open ~/x.out
shm_open("/shm_name", O_RDWR|O_CREAT|O_EXCL, 0777)
........................................................... ERR#13 EACCES
terminate called after throwing an instance of
'boost::interprocess::interprocess_exception'
  what(): Permission denied
  Received signal 6, SIGABRT, in kill(), [SIG_DFL], no siginfo
bash-2.03$

----- Original Message -----
From: "Ion Gaztañaga" <igaztanaga_at_[hidden]>
To: "Boost Testing List" <boost-testing_at_[hidden]>
Sent: Tuesday, November 13, 2007 12:14 PM
Subject: Re: [Boost-testing] [interprocess] HP-UX_ia64_gcc test failing
duetopermissions

Boris Gubenko escribió:
> Hi Ion,
>
> thank you for the willingness to help with Interprocess library on HP-UX.
>
> What kind of information do you need? Do you want me to walk through the
> code with the debugger to see which libc function fails, presumably with
> EACCES ? Do you have an example, a simple C program, showing how the
> Interprocess library calls shared memory functions or mmap, if this is
> what you suspect is failing on HP-UX?

Yes, I would need the call stack to the point where the exception is
being thrown. I suspect that either shm_open or mmap are failing so:

-> mmap is called in file boost/interprocess/mapped_region.hpp line 469.

-> shm_open in boost/interprocess/shared_memory_object.hpp line 327.

You will see error handling code there, so you can put a breakpoint when
shm_open/mmap returns an error. A simple example to test if shared
memory creation is failing is to test something like this:

#include <boost/interprocess/shared_memory_object.hpp>

using namespace boost::interprocess;

int main()

{
    const char *name = "/shm_name";
    shared_memory_object::remove(name);
    {
      shared_memory_object shm(create_only, name, read_write)
    }
    shared_memory_object::remove(name);
    return 0;
}

To execute a little more complicated example (including mmap use) try
shared_memory_mapping_test.cpp

Regards,

Ion
_______________________________________________
Boost-Testing mailing list
Boost-Testing_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-testing


Boost-testing list run by mbergal at meta-comm.com