MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / write_to_fifo

Function write_to_fifo

modules/tm/t_fifo.c:386–421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

384
385
386static inline int write_to_fifo(char *fifo, int cnt )
387{
388 int fd_fifo;
389
390 /* open FIFO file stream */
391 if((fd_fifo = open(fifo,O_WRONLY | O_NONBLOCK)) == -1){
392 switch(errno){
393 case ENXIO:
394 LM_ERR("nobody listening on [%s] fifo for reading!\n",fifo);
395 break;
396 default:
397 LM_ERR("failed to open [%s] fifo : %s\n", fifo,
398 strerror(errno));
399 }
400 goto error;
401 }
402
403 /* write now (unbuffered straight-down write) */
404repeat:
405 if (writev(fd_fifo, (struct iovec*)(void*)lines_eol, 2*cnt)<0) {
406 if (errno!=EINTR) {
407 LM_ERR("writev failed: %s\n", strerror(errno));
408 close(fd_fifo);
409 goto error;
410 } else {
411 goto repeat;
412 }
413 }
414 close(fd_fifo);
415
416 LM_DBG("write completed\n");
417 return 1; /* OK */
418
419error:
420 return -1;
421}
422
423
424

Callers 1

t_write_reqFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected