2016-12-20 23:36:00 +01:00
|
|
|
#include "../../core/process.h"
|
|
|
|
#include <string.h> /* memset */
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2016-12-22 21:48:35 +01:00
|
|
|
int main()
|
|
|
|
{
|
|
|
|
int ret;
|
2018-10-03 22:02:37 +02:00
|
|
|
struct ipc_process_array tab_proc;
|
|
|
|
memset(&tab_proc, 0, sizeof(struct ipc_process_array));
|
2016-12-20 23:36:00 +01:00
|
|
|
|
2018-10-04 00:30:47 +02:00
|
|
|
struct ipc_client process_tab[5];
|
|
|
|
memset(&process_tab, 0, sizeof(struct ipc_client) * 5);
|
2016-12-20 23:36:00 +01:00
|
|
|
|
2016-12-22 21:48:35 +01:00
|
|
|
int i;
|
|
|
|
for (i = 0; i < 5; i++) {
|
|
|
|
process_tab[i].proc_fd = i;
|
2018-10-03 22:02:37 +02:00
|
|
|
ret = ipc_process_add(&tab_proc, &process_tab[i]);
|
2016-12-22 21:48:35 +01:00
|
|
|
if (ret == -1) {
|
|
|
|
printf("erreur realloc\n");
|
|
|
|
}
|
|
|
|
}
|
2016-12-20 23:36:00 +01:00
|
|
|
|
2018-10-03 22:02:37 +02:00
|
|
|
ipc_process_array_print(&tab_proc);
|
2016-12-20 23:36:00 +01:00
|
|
|
|
2018-10-03 22:02:37 +02:00
|
|
|
ret = ipc_process_del(&tab_proc, &process_tab[2]);
|
2016-12-22 21:48:35 +01:00
|
|
|
if(ret < 0) {
|
|
|
|
printf("erreur %d\n", ret );
|
|
|
|
}
|
2018-10-03 22:02:37 +02:00
|
|
|
ipc_process_array_print(&tab_proc);
|
2016-12-20 23:36:00 +01:00
|
|
|
|
2018-10-03 22:02:37 +02:00
|
|
|
ipc_process_array_free (&tab_proc);
|
2016-12-22 21:48:35 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|