| 62 | int ipc_shared_fd_read; |
| 63 | |
| 64 | int init_ipc(void) |
| 65 | { |
| 66 | int optval; |
| 67 | |
| 68 | /* create the pipe for dispatching the timer jobs */ |
| 69 | if (pipe(ipc_shared_pipe) != 0) { |
| 70 | LM_ERR("failed to create ipc pipe (%s)!\n", strerror(errno)); |
| 71 | return -1; |
| 72 | } |
| 73 | |
| 74 | /* make reading fd non-blocking */ |
| 75 | optval = fcntl(ipc_shared_pipe[0], F_GETFL); |
| 76 | if (optval == -1) { |
| 77 | LM_ERR("fcntl failed: (%d) %s\n", errno, strerror(errno)); |
| 78 | return -1; |
| 79 | } |
| 80 | |
| 81 | if (fcntl(ipc_shared_pipe[0], F_SETFL, optval|O_NONBLOCK) == -1) { |
| 82 | LM_ERR("set non-blocking failed: (%d) %s\n", errno, strerror(errno)); |
| 83 | return -1; |
| 84 | } |
| 85 | |
| 86 | ipc_shared_fd_read = ipc_shared_pipe[0]; |
| 87 | |
| 88 | /* self-register the IPC type for RPC */ |
| 89 | ipc_rpc_type = ipc_register_handler( NULL, "RPC"); |
| 90 | if (ipc_bad_handler_type(ipc_rpc_type)) { |
| 91 | LM_ERR("failed to self register RPC type\n"); |
| 92 | return -1; |
| 93 | } |
| 94 | |
| 95 | /* we are all set */ |
| 96 | return 0; |
| 97 | } |
| 98 | |
| 99 | |
| 100 | int create_ipc_pipes( int proc_no ) |
nothing calls this directly
no test coverage detected