<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Can&#x27;t create Posix semaphore in the location where the Qt creates QSystemSemaphore]]></title><description><![CDATA[<p dir="auto">On Linux system QSystemSemaphore created in /tmp directory.<br />
I'd like to share the semaphore with C++ application.<br />
According to the Qt sources it uses Posix command sem_open().<br />
I did the same with my C++ and name: <strong>/tmp/qipc_systemsem_<em>somehashtag</em></strong> but i got fail on wrong name.<br />
In C++, using <strong>sem_open</strong>, i'm able to create only at default location, means <strong>/dev/shm/</strong>, and the system always add <strong>sem.</strong> prefix.<br />
How is it possible ? It uses same API (sem_open(...) ).<br />
How can i recreate the Qt semaphore on C++ ?</p>
]]></description><link>https://forum.qt.io/topic/64248/can-t-create-posix-semaphore-in-the-location-where-the-qt-creates-qsystemsemaphore</link><generator>RSS for Node</generator><lastBuildDate>Tue, 11 Aug 2026 14:00:12 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/64248.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 16 Feb 2016 13:55:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Can&#x27;t create Posix semaphore in the location where the Qt creates QSystemSemaphore on Wed, 17 Feb 2016 20:39:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alexsho">@<bdi>alexsho</bdi></a><br />
Unfortunately, I don't know what the problem might be. :|<br />
What about checking <code>semget</code>?<br />
<s>Do you have available resources?</s><br />
Have you tried without the <code>O_CREAT</code> flag?<br />
Can you verify you have permissions for the file?</p>
<p dir="auto">Kind regards.</p>
]]></description><link>https://forum.qt.io/post/313928</link><guid isPermaLink="true">https://forum.qt.io/post/313928</guid><dc:creator><![CDATA[kshegunov]]></dc:creator><pubDate>Wed, 17 Feb 2016 20:39:39 GMT</pubDate></item><item><title><![CDATA[Reply to Can&#x27;t create Posix semaphore in the location where the Qt creates QSystemSemaphore on Wed, 17 Feb 2016 16:08:28 GMT]]></title><description><![CDATA[<p dir="auto">Yes, i'm handling <strong>sem_open</strong> errors i similar way<br />
I'm trying to create the semaphore with O_CREAT only flag, which is mean that it first trys to open existing semaphore, and, if not available, it creates one.<br />
So From this point it should never get NULL.<br />
The name i set is, as i said, string <strong>/tmp/qipc_systemsem_somehashtag</strong>.<br />
I'm testing it when <strong>no</strong> semaphore with this name exists in both places.<br />
The errno i get is EINVAL (2) which means in my case - wrong name format.<br />
When i set the name without <strong>/tmp/</strong> i get semaphore created successfully but at <strong>/dev/shm/</strong>.<br />
I read some info regarding this problem - it looks like problem in Qt.<br />
Somehow it uses different (wrong) implementation of sem_open, not according the Posix standard.</p>
]]></description><link>https://forum.qt.io/post/313787</link><guid isPermaLink="true">https://forum.qt.io/post/313787</guid><dc:creator><![CDATA[alexsho]]></dc:creator><pubDate>Wed, 17 Feb 2016 16:08:28 GMT</pubDate></item><item><title><![CDATA[Reply to Can&#x27;t create Posix semaphore in the location where the Qt creates QSystemSemaphore on Tue, 16 Feb 2016 14:38:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alexsho">@<bdi>alexsho</bdi></a><br />
What flags are you passing in your C++ code, and which process is starting first? Are you handling the <code>sem_open</code> errors accordingly?</p>
<p dir="auto"><a href="http://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/kernel/qsystemsemaphore_posix.cpp#n74" target="_blank" rel="noopener noreferrer nofollow ugc">http://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/kernel/qsystemsemaphore_posix.cpp#n74</a><br />
<a href="http://man7.org/linux/man-pages/man3/sem_open.3.html" target="_blank" rel="noopener noreferrer nofollow ugc">http://man7.org/linux/man-pages/man3/sem_open.3.html</a></p>
<blockquote>
<p dir="auto">If both O_CREAT and O_EXCL are specified in oflag, then an error is returned if a semaphore with the given name already exists.</p>
</blockquote>
<p dir="auto">Kind regards.</p>
]]></description><link>https://forum.qt.io/post/313645</link><guid isPermaLink="true">https://forum.qt.io/post/313645</guid><dc:creator><![CDATA[kshegunov]]></dc:creator><pubDate>Tue, 16 Feb 2016 14:38:02 GMT</pubDate></item></channel></rss>