Obsolete
/
libipc-old
Archived
3
0
Fork 0

print context

pollfd
Karchnu 2020-07-02 21:33:59 +02:00
parent b6f32819e5
commit 0f46858e78
2 changed files with 21 additions and 17 deletions

View File

@ -356,8 +356,7 @@ struct ipc_error ipc_ctx_new_alloc (struct ipc_ctx *ctx);
struct ipc_error service_path (char *path, const char *sname); struct ipc_error service_path (char *path, const char *sname);
struct ipc_error handle_writing_message (struct ipc_event *event, struct ipc_ctx *ctx, uint32_t index); struct ipc_error handle_writing_message (struct ipc_event *event, struct ipc_ctx *ctx, uint32_t index);
void ipc_connection_print (struct ipc_connection_info *cinfo); void ipc_ctx_print (struct ipc_ctx *ctx);
void ipc_connections_print (struct ipc_ctx *cinfos);
// Last parameter is the index for the server fd in the context structure. // Last parameter is the index for the server fd in the context structure.
struct ipc_error ipc_accept_add (struct ipc_event *event, struct ipc_ctx *ctx, uint32_t index); struct ipc_error ipc_accept_add (struct ipc_event *event, struct ipc_ctx *ctx, uint32_t index);
@ -376,7 +375,7 @@ struct ipcd {
}; };
struct ipc_error struct ipc_error
ipc_wait_event_ipcd (struct ipc_ctx *cinfos ipc_wait_event_ipcd (struct ipc_ctx *ctx
, struct ipc_connection_info *cinfo // cinfo is NULL for clients , struct ipc_connection_info *cinfo // cinfo is NULL for clients
, struct ipc_event *event, struct ipc_switchings *switchdb, int *timer); , struct ipc_event *event, struct ipc_switchings *switchdb, int *timer);

View File

@ -1,20 +1,25 @@
#include "ipc.h" #include "ipc.h"
void ipc_connection_print (struct ipc_connection_info *cinfo) void ipc_ctx_print (struct ipc_ctx *ctx)
{ {
T_R_NOTHING ((cinfo == NULL)); printf ("Context contains:\n");
for (size_t i = 0; i < ctx->size; i++) {
printf ("- fd %d\t", ctx->pollfd[i].fd);
#if 0 switch (ctx->cinfos[i].type) {
LOG_DEBUG ("fd %d: index %d, version %d, type %c, path %s" case IPC_CONNECTION_TYPE_IPC: {
, cinfo->fd , cinfo->index, cinfo->version, cinfo->type printf ("- ipc\n");
, (cinfo->spath == NULL) ? "-" : cinfo->spath); break;
#endif }
case IPC_CONNECTION_TYPE_EXTERNAL: {
printf ("- external\n");
break;
}
case IPC_CONNECTION_TYPE_SERVER: {
printf ("- external\n");
break;
}
} }
void ipc_connections_print (struct ipc_ctx *cinfos)
{
for (size_t i = 0; i < cinfos->size; i++) {
ipc_connection_print (&cinfos->cinfos[i]);
} }
} }