1 /* util.h ....... error message utilities.
2 * C. Scott Ananian <cananian@alumni.princeton.edu>
4 * $Id: util.h,v 1.6 2005/03/10 01:18:20 quozl Exp $
10 /* log_string is an identifier for this pptp process, passed from
11 command line using --log-string=X, and included with every log message.
12 Useful for people with multiple pptp sessions open at a time */
13 extern char * log_string
;
15 /* log_level sets the logging verbosity. Values range from 0 (errors only)
16 to 1 (errors and warnings) to 2 (high verbosity, for debugging) */
19 void _log(const char *func
, const char *file
, int line
, const char *format
, ...)
20 __attribute__ ((format (printf
, 4, 5)));
21 void _warn(const char *func
, const char *file
, int line
, const char *format
, ...)
22 __attribute__ ((format (printf
, 4, 5)));
23 void _fatal(const char *func
, const char *file
, int line
, const char *format
, ...)
24 __attribute__ ((format (printf
, 4, 5))) __attribute__ ((noreturn
));
26 #define log(format, args...) \
27 _log(__FUNCTION__,__FILE__,__LINE__, format , ## args)
28 #define warn(format, args...) \
29 _warn(__FUNCTION__,__FILE__,__LINE__, format , ## args)
30 #define fatal(format, args...) \
31 _fatal(__FUNCTION__,__FILE__,__LINE__, format , ## args)
33 int file2fd(const char *path
, const char *mode
, int fd
);
35 /* signal to pipe delivery implementation */
37 /* create a signal pipe, returns 0 for success, -1 with errno for failure */
40 /* generic handler for signals, writes signal number to pipe */
41 void sigpipe_handler(int signum
);
43 /* assign a signal number to the pipe */
44 void sigpipe_assign(int signum
);
46 /* return the signal pipe read file descriptor for select(2) */
49 /* read and return the pending signal from the pipe */
54 #endif /* INC_UTIL_H */