Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00033 #ifndef _FIFO_FNC_H_
00034 #define _FIFO_FNC_H_
00035
00036 #include <stdio.h>
00037 #include <stdarg.h>
00038 #include <errno.h>
00039
00040
00044 #define FIFO_REPLY_RETRIES 4
00045 #define FIFO_REPLY_WAIT 80000
00046
00047 FILE* mi_init_fifo_server(char *fifo_name, int mode, int uid, int gid,
00048 char* fifo_reply_dir);
00049
00050 void mi_fifo_server(FILE *fifostream);
00051
00052 int mi_read_line( char *b, int max, FILE *stream, int *read);
00053
00054 static inline int mi_fifo_reply( FILE *stream, char *reply_fmt, ... )
00055 {
00056 int r;
00057 va_list ap;
00058
00059 retry:
00060 va_start(ap, reply_fmt);
00061 r = vfprintf( stream, reply_fmt, ap);
00062 va_end(ap);
00063 if (r<=0) {
00064 if ((errno==EINTR)||(errno==EAGAIN)||(errno==EWOULDBLOCK)) {
00065 goto retry;
00066 }
00067 LM_ERR("fifo_error: write error: %s\n", strerror(errno));
00068 return -1;
00069 }
00070 return 0;
00071 }
00072
00073
00074 #endif
00075