Is it possible to call remote function in another daemon?

Hi,
Is it possible to call a remote function in another daemon? Here is the setup:
I have two daemons daemon A with function "s" and daemon B with function "k". I need a way function "s" from daemon A to call a function "k" from daemon B and pass some arguments. When the request is processed function "k" returns the output to function "s". Is this possible?
Regards
Peter

IT is possible - it is called RPC - remote procedure call.

Linux and Solaris support doors for this. What OS?

Thank you for the reply!
I need it for Centos. Are there examples and manuals?

Regards

edit: it seems that doors for Linux is not maintained anymore. Is there another solution?

RPC is one possibility.

Perhaps for your case, a simple IPC between your two deamons could do it. In function s, daemon A requests deamon B to execute the function k by sending a message with the needed argument. Daemon B receives the message, executes function k and sends the returned value(s) back to daemon A. And this point, A can then resume.

Are the two daemons located on the same machine? If so, is there some plan to run them possibly on separate machines?

Cheers, Lo�c

Loic has a good idea -
message queues, shared memory, sockets: all work well on the same box.

Download Advanced Linux Programming

Download chapter 5 or get a copy of Stevens 'Advanced Programming in the UNIX Envrionment'

1 Like

yes IPC is possible solution but I don't an idea how to implement remote call of function using IPC.

I found a solution wit Corba and DBus. The problem is that Corba has no new version since arround 2004. Corba is faster than DBus.
Any idea why Corba is no longer supported?

Regards

For the same reason rampant.org/doors has not been touched for a long time. No userland interest in keeping ti going.

Yes but it seems that this is a valuable technology.

RPC was designed for remote calls between foreign systems, so it has huge complexity, which can be easily avoided for your case of two processes on the same system. I would not think twice to use plain old socket, or pipe, or messaging between them

Yes I can use for example XML for example to pass structured messages between two daemons but I wan't more easy way - directly to call a function in another daemon.

Any other ideas?

If it is only between two daemons then pipes should be easy. Open two pipes, one for calling functions and another one for return values.

This should be easy if only two daemons are communicating, otherwise you may have to implement some kind of sync between daemons or go with sockets.

Yes but the problem is that I learn C since several weeks and I don't have idea how to implement this. Can you show me example if your idea in C?

Regards

migurus & kumaran -

My reading shws that the the accepted definition of RPC is 'calling a procedure in another process'
R. Teer 2004 Solaris System Programming p 951.

Stevens has a similar definition - I don't have my copy here.

The original question was not about IPC per se. It was 'how to call a function in another daemon'. Using IPC lets you do that but it is not the main function for IPC. IPC is all about sharing data across processes. A side effect is the ability to call a function in another process.

Exposing a function entry point in a separate process is different from that. It is the whole idea behind UNIX code: Do only one thing, and do it very well.

Can you show us example how to call a remote function using a IPC. Just the code how call function. I know where to find simple IPC implementation.

Regards