Modify

Opened 6 years ago

Closed 6 years ago

#6054 closed Bugs (fixed)

Reading Shared Memory from x86 to x64 and vice versa on OSX

Reported by: tibdewal.rahulkumar@… Owned by: igaztanaga
Milestone: To Be Determined Component: interprocess
Version: Boost 1.47.0 Severity: Showstopper
Keywords: Cc:

Description

If I create a SM from 64 bit application and open it on 32 bit application it fails.

for 64 bit

shared_memory_object( create_only, "test" , read_write) ;

for 32 bit

shared_memory_object (open_only, "test", read_write);

file created by 64bit application is at path as below:

/private/tmp/boost_interprocess/AD21A54E000000000000000000000000/test where as file searched by 32 bit application is at path

/private/tmp/boost_interprocess/AD21A54E00000000/test Thus 32 bit applications cannot read the file.

I am using boost 1.47.0 on Mac OS X. Is it a bug? Do I have to do some settings use some Macros in order to fix it? Has any one encountered this problem before?

This Bug is present in tmp_dir_helpers.hpp file.

       inline void get_bootstamp(std::string &s, bool add = false)
        {
          ...
           std::size_t char_counter = 0;
           long  fields[2] = { result.tv_sec, result.tv_usec };
           for(std::size_t field = 0; field != 2; ++field){
              for(std::size_t i = 0; i != sizeof(long); ++i){
                 const char *ptr = (const char *)&fields[field];
                 bootstamp_str[char_counter++] = Characters[(ptr[i]&0xF0)>>4];
                 bootstamp_str[char_counter++] = Characters[(ptr[i]&0x0F)];
              }
           ...
        }

Where as it should have been some thing like this..

   '''long long''' fields[2] = { result.tv_sec, result.tv_usec };
               for(std::size_t field = 0; field != 2; ++field){
                  for(std::size_t i = 0; i != sizeof('''long long'''); ++i)

Attachments (1)

challenge8.bin (672 bytes) - added by bykedar@… 3 years ago.
bin file

Download all attachments as: .zip

Change History (2)

comment:1 Changed 6 years ago by igaztanaga

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in trunk. Time uses 32 bit integers on both 32 bit and 64 bit versions to avoid problems.

Changed 3 years ago by bykedar@…

bin file

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain igaztanaga.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.