This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 5f7c98b  drivers/syslog: Remove emergstream implementation and caller
5f7c98b is described below

commit 5f7c98b6e1b6da9f4765572a63ac678d407c8095
Author: Xiang Xiao <[email protected]>
AuthorDate: Mon May 17 22:38:22 2021 +0800

    drivers/syslog: Remove emergstream implementation and caller
    
    since emergstream always call syslog_force, but syslog_force is designed
    for the interrupt context, and then doesn't mean any emergency thing.
    On the other hand, emergstream has other bad side effect:
    1.Can't output to file or dev channel
    2.Can't work well with the interrupt buffer
    
    Signed-off-by: Xiang Xiao <[email protected]>
---
 drivers/syslog/Make.defs            |  2 +-
 drivers/syslog/syslog_emergstream.c | 99 -------------------------------------
 drivers/syslog/vsyslog.c            | 16 +-----
 include/nuttx/streams.h             | 18 -------
 4 files changed, 3 insertions(+), 132 deletions(-)

diff --git a/drivers/syslog/Make.defs b/drivers/syslog/Make.defs
index 22e1e97..96e5d7d 100644
--- a/drivers/syslog/Make.defs
+++ b/drivers/syslog/Make.defs
@@ -21,7 +21,7 @@
 ############################################################################
 # Include SYSLOG Infrastructure
 
-CSRCS += vsyslog.c syslog_stream.c syslog_emergstream.c syslog_channel.c
+CSRCS += vsyslog.c syslog_stream.c syslog_channel.c
 CSRCS += syslog_putc.c syslog_write.c syslog_force.c syslog_flush.c
 
 ifeq ($(CONFIG_SYSLOG_INTBUFFER),y)
diff --git a/drivers/syslog/syslog_emergstream.c 
b/drivers/syslog/syslog_emergstream.c
deleted file mode 100644
index ae8a2e7..0000000
--- a/drivers/syslog/syslog_emergstream.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
- * drivers/syslog/syslog_emergstream.c
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.  The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <stdio.h>
-#include <unistd.h>
-#include <assert.h>
-#include <errno.h>
-
-#include <nuttx/syslog/syslog.h>
-#include <nuttx/streams.h>
-
-#include "syslog.h"
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: emergstream_putc
- ****************************************************************************/
-
-static void emergstream_putc(FAR struct lib_outstream_s *this, int ch)
-{
-  int ret;
-
-  /* Try writing until the write was successful or until an irrecoverable
-   * error occurs.
-   */
-
-  do
-    {
-      /* Write the character to the supported logging device.  On failure,
-       * syslog_force returns a negated errno value.
-       */
-
-      ret = syslog_force(ch);
-      if (ret >= 0)
-        {
-          this->nput++;
-          return;
-        }
-
-      /* The special return value -EINTR means that syslog_force() was
-       * awakened by a signal.  This is not a real error and must be
-       * ignored in this context.
-       */
-    }
-  while (ret == -EINTR);
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: emergstream
- *
- * Description:
- *   Initializes a stream for use with the configured emergency syslog
- *   interface.  Only accessible from with the OS SYSLOG logic.
- *
- * Input Parameters:
- *   stream - User allocated, uninitialized instance of struct
- *            lib_outstream_s to be initialized.
- *
- * Returned Value:
- *   None (User allocated instance initialized).
- *
- ****************************************************************************/
-
-void emergstream(FAR struct lib_outstream_s *stream)
-{
-  stream->put   = emergstream_putc;
-  stream->flush = lib_noflush;
-  stream->nput  = 0;
-}
diff --git a/drivers/syslog/vsyslog.c b/drivers/syslog/vsyslog.c
index 80c65b1..65243d4 100644
--- a/drivers/syslog/vsyslog.c
+++ b/drivers/syslog/vsyslog.c
@@ -116,22 +116,10 @@ int nx_vsyslog(int priority, FAR const IPTR char *fmt, 
FAR va_list *ap)
 #endif
 
   /* Wrap the low-level output in a stream object and let lib_vsprintf
-   * do the work.  NOTE that emergency priority output is handled
-   * differently.. it will use the SYSLOG emergency stream.
+   * do the work.
    */
 
-  if (priority == LOG_EMERG)
-    {
-      /* Use the SYSLOG emergency stream */
-
-      emergstream(&stream.public);
-    }
-  else
-    {
-      /* Use the normal SYSLOG stream */
-
-      syslogstream_create(&stream);
-    }
+  syslogstream_create(&stream);
 
 #if defined(CONFIG_SYSLOG_TIMESTAMP)
   /* Prepend the message with the current time, if available */
diff --git a/include/nuttx/streams.h b/include/nuttx/streams.h
index 0d179a7..8b63e8c 100644
--- a/include/nuttx/streams.h
+++ b/include/nuttx/streams.h
@@ -381,24 +381,6 @@ void syslogstream_destroy(FAR struct lib_syslogstream_s 
*stream);
 #endif
 
 /****************************************************************************
- * Name: emergstream
- *
- * Description:
- *   Initializes a stream for use with the configured emergency syslog
- *   interface.  Only accessible from with the OS SYSLOG logic.
- *
- * Input Parameters:
- *   stream - User allocated, uninitialized instance of struct
- *            lib_outstream_s to be initialized.
- *
- * Returned Value:
- *   None (User allocated instance initialized).
- *
- ****************************************************************************/
-
-void emergstream(FAR struct lib_outstream_s *stream);
-
-/****************************************************************************
  * Name: lib_noflush
  *
  * Description:

Reply via email to