Skip to content

Commit 5b67cce

Browse files
committed
sockets_mgm: rework to bind on each process
1 parent c03799f commit 5b67cce

8 files changed

Lines changed: 507 additions & 475 deletions

File tree

ipc.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,25 @@ int ipc_send_rpc(int dst_proc, ipc_rpc_f *rpc, void *param)
237237
ipc_rpc_type, rpc, param);
238238
}
239239

240+
int ipc_send_rpc_all(ipc_rpc_f *rpc, void *param)
241+
{
242+
int p, count = 0;
243+
244+
for (p = 1; p < counted_max_processes; p++) {
245+
if (pt[p].flags & OSS_PROC_NO_IPC)
246+
continue;
247+
if (p == process_no) {
248+
/* run line the cmd for the proc itself */
249+
rpc(process_no, param);
250+
count++;
251+
} else {
252+
if (ipc_send_rpc(p, rpc, param) >= 0)
253+
count++;
254+
}
255+
}
256+
return count;
257+
}
258+
240259
int ipc_dispatch_rpc( ipc_rpc_f *rpc, void *param)
241260
{
242261
return __ipc_send_job(ipc_shared_pipe[1], -1, ipc_rpc_type, rpc, param);

ipc.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ int ipc_send_job(int dst_proc, ipc_handler_type type, void *payload);
7070
*/
7171
int ipc_send_rpc(int dst_proc, ipc_rpc_f *rpc, void *param);
7272

73+
/*
74+
* Push the execution of a function, remotely, on all the processes
75+
* that have IPC
76+
*
77+
* Return: number of processes the function was sent to
78+
*/
79+
int ipc_send_rpc_all(ipc_rpc_f *rpc, void *param);
80+
7381

7482
/*
7583
* Send a synchronous message to a specific "dst_proc" process

0 commit comments

Comments
 (0)