Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

io.c

Go to the documentation of this file.
00001 #ifndef _IO_C_
00002 #define _IO_C_
00003 
00004 /* -*- linux-c -*- */
00005 /** @file io.c
00006  * @brief I/O functions
00007  */
00008 /** @addtogroup io I/O
00009  * I/O functions
00010  * @{
00011  */
00012 
00013 /** Logs Data.
00014  * This function is compatible with printk.  In fact it currently
00015  * sends all output to vprintk, after sending "STP: ". This allows
00016  * us to easily detect SystemTap output in the log file. 
00017  *
00018  * @param fmt A variable number of args.
00019  * @bug Lines are limited in length by printk buffer. If there is
00020  * no newline in the format string, then other syslog output could
00021  * get appended to the SystemTap line.
00022  * @todo Either deprecate or redefine this as a way to log debug or 
00023  * status messages, separate from the normal program output.
00024  */
00025 void dlog (const char *fmt, ...)
00026 {
00027   va_list args;
00028   printk("STP: ");
00029   va_start(args, fmt);
00030   vprintk(fmt, args);
00031   va_end(args);
00032 }
00033 
00034 /** Prints to the trace buffer.
00035  * This function uses the same formatting as printk.  It currently
00036  * writes to the system log. 
00037  *
00038  * @param fmt A variable number of args.
00039  * @todo Needs replaced with something much faster that does not
00040  * use the system log.
00041  */
00042 
00043 void _stp_print (const char *fmt, ...)
00044 {
00045   va_list args;
00046   va_start(args, fmt);
00047   vprintk(fmt, args);
00048   va_end(args);
00049 }
00050 
00051 /** Prints to the trace buffer.
00052  * This function will write a string to the trace buffer.  It currently
00053  * writes to the system log. 
00054  *
00055  * @param str String.
00056  * @todo Needs replaced with something much faster that does not
00057  * use the system log.
00058  */
00059 
00060 void _stp_print_str (char *str)
00061 {
00062   printk ("%s", str);
00063 }
00064 
00065 /** @} */
00066 #endif /* _IO_C_ */