I have some project which uses libdbus for IPC. The goal is to use systemd’s sd-bus instead of libdbus. There is documentation for sd-bus (here, here and etc), but that documentation doesn’t cover all aspects of D-Bus specification implementation. I spent a lot looking for at least any detailed ex…
Tag: ipc
Running bash using posix instead of fork/execv
I have a CLI, one of the commands is entering into Linux bash shell. This is the code which does it using fork & execv: I want to replace the fork/execv and to use posix_spawn instead: But it doesn’t work. Any help? Answer Let’s look at what the code in the original fork/exec does: close all f…
How would a Python script running on Linux call a routine in a Python script running under Wine?
I have a Python (3) script running on Linux, referred to as the main script, which has to call a routine from a proprietary DLL. So far, I have solved this with Wine using the following construct: The script dll_call.py is executed by a Windows Python (3) interpreter installed under Wine. It dumps the return …
Sending an arrow key with fprintf
I’m testing out pipes and have hit a little road block. I want to be able to simulate pressing the right arrow key through a file pointer opened by popen. The file pointer opens a display program on a different terminal, much like a projector. I would like to send a signal to advance the next image (the…
What is a good Inter-Process Communication method between C and PHP in Linux
I actually don’t know whether I am asking a proper question. Let me describe my problem first. End user <-1-> web server (by PHP) <-2-> an internal process (by C or C++) <-3-> an external hardware The 1 should be something like ajax request. The 2 should be something like inter-process…
Proper implementation of an inter process communication (IPC)
Is the following a proper implementation of an inter-process communication? It seems to be working but I’m wondering if there could be a race condition leading to hanging. One constraint is that both processes need to be started independently and in any order. Answer Some stress tests showed no problem …
Fastest technique to pass messages between processes on Linux?
What is the fastest technology to send messages between C++ application processes, on Linux? I am vaguely aware that the following techniques are on the table: TCP UDP Sockets Pipes Named pipes Memory-mapped files are there any more ways and what is the fastest? Answer I would suggest looking at this also: Ho…
Waiting on multiple semaphores without busy-waiting (C/C++ Linux)
If I have more than one semaphore, how can I have a process block until at least one of the semaphores is free? I know I can do this with a busy-wait loop such as: But is there a way to do this without a busy-loop? Perhaps there’s some IPC technique other than semaphores that I should be using? Thanks
How to send integer with pipe between two processes!
I am trying to send an integer with pipe in a POSIX system but write() function is working for sending string or character data. Is there any way to send integer with a pipe? Regards Answer The safe way is to use snprintf and strtol. But if you know both processes were created using the same version of compil…