make standard syslog and vsyslog POSIX compliant (also modify non-standard syslog functions for compatibility). This will break a lot of things until ALL usage of syslog is updated to use the modified interfaces
This commit is contained in:
parent
047deada84
commit
f8ed7323c0
|
@ -360,9 +360,10 @@ int syslog_initialize(void)
|
|||
* Description:
|
||||
* This is the low-level system logging interface. The debugging/syslogging
|
||||
* interfaces are syslog() and lowsyslog(). The difference is is that
|
||||
* the syslog() function writes to fd=1 (stdout) whereas lowsyslog() uses
|
||||
* a lower level interface that works from interrupt handlers. This
|
||||
* function is a a low-level interface used to implement lowsyslog().
|
||||
* the syslog() function writes to syslogging device (usually fd=1, stdout)
|
||||
* whereas lowsyslog() uses a lower level interface that works from
|
||||
* interrupt handlers. This function is a a low-level interface used to
|
||||
* implement lowsyslog().
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
|
|
@ -104,22 +104,22 @@
|
|||
|
||||
#ifdef CONFIG_DEBUG
|
||||
# define dbg(format, ...) \
|
||||
syslog(EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
|
||||
syslog(LOG_DEBUG, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
|
||||
|
||||
# ifdef CONFIG_ARCH_LOWPUTC
|
||||
# define lldbg(format, ...) \
|
||||
lowsyslog(EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
|
||||
lowsyslog(LOG_DEBUG, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
|
||||
# else
|
||||
# define lldbg(x...)
|
||||
# endif
|
||||
|
||||
# ifdef CONFIG_DEBUG_VERBOSE
|
||||
# define vdbg(format, ...) \
|
||||
syslog(EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
|
||||
syslog(LOG_DEBUG, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
|
||||
|
||||
# ifdef CONFIG_ARCH_LOWPUTC
|
||||
# define llvdbg(format, ...) \
|
||||
lowsyslog(EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
|
||||
lowsyslog(LOG_DEBUG, EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
|
||||
# else
|
||||
# define llvdbg(x...)
|
||||
# endif
|
||||
|
|
|
@ -128,12 +128,12 @@ int setlogmask(int mask);
|
|||
* following.
|
||||
*/
|
||||
|
||||
int syslog(FAR const char *format, ...);
|
||||
int vsyslog(const char *src, va_list ap);
|
||||
int syslog(int priority, FAR const char *format, ...);
|
||||
int vsyslog(int priority, FAR const char *src, va_list ap);
|
||||
|
||||
#ifdef CONFIG_ARCH_LOWPUTC /* Non-standard */
|
||||
int lowsyslog(FAR const char *format, ...);
|
||||
int lowvsyslog(FAR const char *src, va_list ap);
|
||||
int lowsyslog(int priority, FAR const char *format, ...);
|
||||
int lowvsyslog(int priority, FAR const char *src, va_list ap);
|
||||
#endif
|
||||
|
||||
/* Enable or disable syslog output */
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
"llabs","stdlib.h","defined(CONFIG_HAVE_LONG_LONG)","long long int","long long int"
|
||||
"lldbg","debug.h","!defined(CONFIG_CPP_HAVE_VARARGS) && defined(CONFIG_DEBUG) && defined(CONFIG_ARCH_LOWPUTC)","int","const char *","..."
|
||||
"llvdbg","debug.h","!defined(CONFIG_CPP_HAVE_VARARGS) && defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_VERBOSE) && defined(CONFIG_ARCH_LOWPUTC)","int","const char *","..."
|
||||
"lowsyslog","syslog.h","","int","FAR const char *","..."
|
||||
"lowsyslog","syslog.h","","int","int","FAR const char *","..."
|
||||
"match","nuttx/regex.h","","int","const char *","const char *"
|
||||
"memccpy","string.h","","FAR void","FAR void *","FAR const void *","int c","size_t"
|
||||
"memchr","string.h","","FAR void","FAR const void *","int c","size_t"
|
||||
|
@ -155,7 +155,7 @@
|
|||
"strtoll","stdlib.h","defined(CONFIG_HAVE_LONG_LONG)","long long","const char *nptr","char **endptr","int base"
|
||||
"strtoul","stdlib.h","","unsigned long","const char *","char **","int"
|
||||
"strtoull","stdlib.h","defined(CONFIG_HAVE_LONG_LONG)","unsigned long long","const char *","char **","int"
|
||||
"syslog","syslog.h","","int","FAR const char *","..."
|
||||
"syslog","syslog.h","","int","int","FAR const char *","..."
|
||||
"syslog_enable","syslog.h","defined(CONFIG_SYSLOG_ENABLE)","void","bool"
|
||||
"tcflush","termios.h","CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SERIAL_TERMIOS)","int","int","int"
|
||||
"tcgetattr","termios.h","CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SERIAL_TERMIOS)","int","int","FAR struct termios *"
|
||||
|
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
@ -95,7 +95,7 @@ int dbg(const char *format, ...)
|
|||
#endif
|
||||
{
|
||||
va_start(ap, format);
|
||||
ret = vsyslog(format, ap);
|
||||
ret = vsyslog(LOG_DEBUG, format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ int lldbg(const char *format, ...)
|
|||
#endif
|
||||
{
|
||||
va_start(ap, format);
|
||||
ret = lowvsyslog(format, ap);
|
||||
ret = lowvsyslog(LOG_DEBUG, format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ int vdbg(const char *format, ...)
|
|||
#endif
|
||||
{
|
||||
va_start(ap, format);
|
||||
ret = vsyslog(format, ap);
|
||||
ret = vsyslog(LOG_DEBUG, format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ int llvdbg(const char *format, ...)
|
|||
#endif
|
||||
{
|
||||
va_start(ap, format);
|
||||
ret = lowvsyslog(format, ap);
|
||||
ret = lowvsyslog(LOG_DEBUG, format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,22 +47,6 @@
|
|||
* Pre-processor definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Select the lowest level debug interface available */
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# ifdef CONFIG_ARCH_LOWPUTC
|
||||
# define message(format, ...) lowsyslog(format, ##__VA_ARGS__)
|
||||
# else
|
||||
# define message(format, ...) syslog(format, ##__VA_ARGS__)
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONFIG_ARCH_LOWPUTC
|
||||
# define message lowsyslog
|
||||
# else
|
||||
# define message syslog
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -75,58 +59,59 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
void lib_dumpbuffer(FAR const char *msg, FAR const uint8_t *buffer, unsigned int buflen)
|
||||
void lib_dumpbuffer(FAR const char *msg, FAR const uint8_t *buffer,
|
||||
unsigned int buflen)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int j;
|
||||
unsigned int k;
|
||||
|
||||
message("%s (%p):\n", msg, buffer);
|
||||
lowsyslog(LOG_INFO, "%s (%p):\n", msg, buffer);
|
||||
for (i = 0; i < buflen; i += 32)
|
||||
{
|
||||
message("%04x: ", i);
|
||||
lowsyslog(LOG_INFO, "%04x: ", i);
|
||||
for (j = 0; j < 32; j++)
|
||||
{
|
||||
k = i + j;
|
||||
|
||||
if (j == 16)
|
||||
{
|
||||
message(" ");
|
||||
lowsyslog(LOG_INFO, " ");
|
||||
}
|
||||
|
||||
if (k < buflen)
|
||||
{
|
||||
message("%02x", buffer[k]);
|
||||
lowsyslog(LOG_INFO, "%02x", buffer[k]);
|
||||
}
|
||||
else
|
||||
{
|
||||
message(" ");
|
||||
lowsyslog(LOG_INFO, " ");
|
||||
}
|
||||
}
|
||||
|
||||
message(" ");
|
||||
lowsyslog(LOG_INFO, " ");
|
||||
for (j = 0; j < 32; j++)
|
||||
{
|
||||
k = i + j;
|
||||
|
||||
if (j == 16)
|
||||
{
|
||||
message(" ");
|
||||
lowsyslog(LOG_INFO, " ");
|
||||
}
|
||||
|
||||
if (k < buflen)
|
||||
{
|
||||
if (buffer[k] >= 0x20 && buffer[k] < 0x7f)
|
||||
{
|
||||
message("%c", buffer[k]);
|
||||
lowsyslog(LOG_INFO, "%c", buffer[k]);
|
||||
}
|
||||
else
|
||||
{
|
||||
message(".");
|
||||
lowsyslog(LOG_INFO, ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
message("\n");
|
||||
lowsyslog(LOG_INFO, "\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
#if !defined(CONFIG_BUILD_PROTECTED) || defined(__KERNEL__)
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -90,7 +90,7 @@
|
|||
|
||||
#if defined(CONFIG_ARCH_LOWPUTC) || defined(CONFIG_SYSLOG)
|
||||
|
||||
int lowvsyslog(FAR const char *fmt, va_list ap)
|
||||
int lowvsyslog(int priority, FAR const char *fmt, va_list ap)
|
||||
{
|
||||
struct lib_outstream_s stream;
|
||||
|
||||
|
@ -108,7 +108,7 @@ int lowvsyslog(FAR const char *fmt, va_list ap)
|
|||
* Name: lowsyslog
|
||||
****************************************************************************/
|
||||
|
||||
int lowsyslog(FAR const char *fmt, ...)
|
||||
int lowsyslog(int priority, FAR const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int ret;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* libc/stdio/lib_printf.c
|
||||
*
|
||||
* Copyright (C) 2007-2008, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2008, 2011-2012, 2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -95,9 +95,9 @@ int printf(FAR const char *fmt, ...)
|
|||
#if CONFIG_NFILE_STREAMS > 0
|
||||
ret = vfprintf(stdout, fmt, ap);
|
||||
#elif CONFIG_NFILE_DESCRIPTORS > 0
|
||||
ret = vsyslog(fmt, ap);
|
||||
ret = vsyslog(LOG_INFO, fmt, ap);
|
||||
#elif defined(CONFIG_ARCH_LOWPUTC)
|
||||
ret = lowvsyslog(fmt, ap);
|
||||
ret = lowvsyslog(LOG_INFO, fmt, ap);
|
||||
#else
|
||||
# ifdef CONFIG_CPP_HAVE_WARNING
|
||||
# warning "printf has no data sink"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
* libc/stdio/lib_syslog.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2011-2014 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -91,7 +91,7 @@
|
|||
* Name: vsyslog
|
||||
****************************************************************************/
|
||||
|
||||
int vsyslog(FAR const char *fmt, va_list ap)
|
||||
int vsyslog(int priority, FAR const char *fmt, va_list ap)
|
||||
{
|
||||
#if defined(CONFIG_SYSLOG)
|
||||
|
||||
|
@ -135,7 +135,7 @@ int vsyslog(FAR const char *fmt, va_list ap)
|
|||
* Name: syslog
|
||||
****************************************************************************/
|
||||
|
||||
int syslog(FAR const char *fmt, ...)
|
||||
int syslog(int priority, FAR const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int ret;
|
||||
|
|
Loading…
Reference in New Issue