2015-02-08 13:53:24 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* drivers/syslog/syslog_console.c
|
|
|
|
*
|
2021-03-31 14:00:42 +02:00
|
|
|
* 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
|
2015-02-08 13:53:24 +01:00
|
|
|
*
|
2021-03-31 14:00:42 +02:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2015-02-08 13:53:24 +01:00
|
|
|
*
|
2021-03-31 14:00:42 +02:00
|
|
|
* 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.
|
2015-02-08 13:53:24 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <debug.h>
|
|
|
|
|
|
|
|
#include <nuttx/arch.h>
|
|
|
|
#include <nuttx/fs/fs.h>
|
|
|
|
#include <nuttx/syslog/syslog.h>
|
|
|
|
|
2018-04-20 23:55:16 +02:00
|
|
|
#include "syslog.h"
|
|
|
|
|
2015-02-08 13:53:24 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Private Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
2017-06-28 21:17:17 +02:00
|
|
|
static ssize_t syslog_console_read(FAR struct file *filep, FAR char *buffer,
|
2015-02-08 13:53:24 +01:00
|
|
|
size_t buflen);
|
|
|
|
static ssize_t syslog_console_write(FAR struct file *filep,
|
|
|
|
FAR const char *buffer, size_t buflen);
|
2017-06-28 21:17:17 +02:00
|
|
|
static int syslog_console_ioctl(FAR struct file *filep, int cmd,
|
2015-02-08 13:53:24 +01:00
|
|
|
unsigned long arg);
|
|
|
|
|
|
|
|
/****************************************************************************
|
2016-02-22 01:08:58 +01:00
|
|
|
* Private Data
|
2015-02-08 13:53:24 +01:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
static const struct file_operations g_consoleops =
|
|
|
|
{
|
2019-05-22 02:57:54 +02:00
|
|
|
NULL, /* open */
|
|
|
|
NULL, /* close */
|
2015-02-08 13:53:24 +01:00
|
|
|
syslog_console_read, /* read */
|
|
|
|
syslog_console_write, /* write */
|
2019-05-22 02:57:54 +02:00
|
|
|
NULL, /* seek */
|
|
|
|
syslog_console_ioctl, /* ioctl */
|
|
|
|
NULL /* poll */
|
2015-02-08 13:53:24 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Private Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: syslog_console_ioctl
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
static int syslog_console_ioctl(FAR struct file *filep, int cmd,
|
|
|
|
unsigned long arg)
|
|
|
|
{
|
|
|
|
return -ENOTTY;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: syslog_console_read
|
|
|
|
****************************************************************************/
|
|
|
|
|
2017-06-28 21:17:17 +02:00
|
|
|
static ssize_t syslog_console_read(FAR struct file *filep, FAR char *buffer,
|
2015-02-08 13:53:24 +01:00
|
|
|
size_t buflen)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: syslog_console_write
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
static ssize_t syslog_console_write(FAR struct file *filep,
|
|
|
|
FAR const char *buffer, size_t buflen)
|
|
|
|
{
|
2017-09-30 13:34:15 +02:00
|
|
|
return syslog_write(buffer, buflen);
|
2015-02-08 13:53:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: syslog_console_init
|
2015-10-10 18:41:00 +02:00
|
|
|
****************************************************************************/
|
2015-02-08 13:53:24 +01:00
|
|
|
|
|
|
|
void syslog_console_init(void)
|
|
|
|
{
|
2020-01-02 17:49:34 +01:00
|
|
|
register_driver("/dev/console", &g_consoleops, 0666, NULL);
|
2015-02-08 13:53:24 +01:00
|
|
|
}
|