[Development] QSharedMemory POSIX implementation

Bubke Marco Marco.Bubke at digia.com
Wed Jul 9 18:56:48 CEST 2014


We have the same problem here in Designer. The 4 MB restriction of System V shared memory makes it really useless for cross platform use.
Maybe we could use a mmap version for Mac? Best would be a switchable version. ;-)

Best, Marco
________________________________________
From: development-bounces+marco.bubke=digia.com at qt-project.org [development-bounces+marco.bubke=digia.com at qt-project.org] on behalf of Calogero Mauceri [mauceri at actgate.com]
Sent: Wednesday, July 09, 2014 5:32 PM
To: development at qt-project.org
Subject: Re: [Development] QSharedMemory POSIX implementation

On 7/9/2014 5:22 PM, Thiago Macieira wrote:
> On Wednesday 09 July 2014 16:17:38 Calogero Mauceri wrote:
>> Hi all,
>>
>> I find QSharedMemory very useful, and I'm extensively using it for cross
>> platform IPC.
>>
>> I noticed in the code (qsharedmemory_unix.cpp) there are two
>> implementations for that class, one using System V IPC and the other
>> using POSIX IPC (mmap). On both Linux and Mac versions of Qt, the System
>> V primitives are used and there is no way to compile Qt using the POSIX
>> implementation (-posix-ipc option is not available in configure).
>>
>> Is there any reason why the System V implementation is preferred? I'd
>> like to switch to the POSIX one to overcome limits in some platforms
>> where the maximum shared memory allowed is only 4MB.
> Warning: here there be dragons.
>
> That code path has probably not been compiled in years. Just patch your Qt to
> enable it.
>
> Note that POSIX memory sharing like that runs a huge risk. Never accept shared
> memory segments from untrusted applications, since they can crash you: all you
> need to do is use a file-backed segment of memory (as opposed to anonymous
> mmap) and then shrink the file. Linux is getting an extension to prevent that,
> called memory sealing, but I'm guessing Linux isn't your problem OS.
>

Thanks Thiago for your quick reply.

I did not know the POSIX implementation was not supported.

My main problems are on Mac systems, the default shared memory settings
there are very restrictive. I'll need to modify them somehow from my
application.

Thanks,
     Calogero

--
Calogero Mauceri
Software Engineer

Applied Coherent Technology Corporation (ACT)
www.actgate.com


_______________________________________________
Development mailing list
Development at qt-project.org
http://lists.qt-project.org/mailman/listinfo/development



More information about the Development mailing list