chao an
85c39e96d6
global/variables: add g_ prefix to some global variables
...
Signed-off-by: chao an <anchao@lixiang.com>
2024-09-02 18:23:57 +08:00
yinshengkai
ce98f186c0
syslog: add syslog channel filtering function
...
support to control the opening or closing of the specified channel through the syslogmask command at runtime
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-07-13 01:04:07 +08:00
Xiang Xiao
efd1b838e6
syslog: Add sc_write_force callback
...
It is used to write the log message to the channel immediately
when the log message is generated in the interrupt context, which
is faster than the normal force callback.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-23 09:55:19 -03:00
Tiago Medicci Serrano
71c8265e2d
drivers/syslog: add mutex to syslog_default_write
...
This commit reverts 19f269e54b
and
substitutes the semaphore to a mutex, used as a locking mechanism
to avoid syslog messages being messed.
Considering SMP, threads running on different CPUs could call
syslog_default_write simultaneously. It then calls `up_nputs` that,
in most of the implementations, calls `up_putc` multiple times to
write to the serial. So, calling it at the same would cause syslog
messages to interfere with each other.
`up_nputs` and `up_putc` are low-level functions that could be used
during initialization and by the interrupt handler. Hence, it isn't
advisable to implement any locking mechanism on them. On the other
hand, syslog can also be used from the interrupt: if the interrupt
buffer is selected (`CONFIG_SYSLOG_INTBUFFER=y`), the syslog
messages will be flushed when we aren't serving an interrupt.
On the contrary, if it isn't set, it would call the registered
`sc_force` callback, which calls `syslog_default_putc` instead of
the lock-protected `syslog_default_write`.
2023-06-02 10:17:54 +08:00
Xiang Xiao
af2b491420
driver/segger: Move SYSLOG_RTT config from drivers/syslog to drivers/segger
...
and remove include/nuttx/syslog/syslog_rtt.h
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-27 23:10:39 +01:00
Xiang Xiao
d04ed9587b
drivers/syslog: Call up_nputs in syslog_default_write
...
since the buffer may not be terminated by null
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-07-21 21:26:10 +03:00
Xiang Xiao
19f269e54b
syslog: Remove the lock from syslog_default_write
...
to avoid the problem when is called from interrupt/signal handler
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-07-17 17:31:19 +03:00
Xiang Xiao
8254ad9159
drivers/syslog: Call up_puts instead up_putc one by one
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-07-17 17:31:19 +03:00
Nathan Hartman
1867bc2210
Fix compiler warnings (-Wunused-parameter) in various functions
...
Fixes the -Wunused-parameter warning in:
* group/group_signal.c: group_signal()
* irq/irq_unexpectedisr.c: irq_unexpected_isr()
* task/task_spawn.c: nxtask_spawn_proxy()
* timer/timer_getoverrun.c: timer_getoverrun()
* misc/dev_null.c: devnull_read(), devnull_write(), devnull_poll()
* misc/dev_zero.c: devzero_read(), devzero_write(), devzero_poll()
* syslog/syslog_channel.c: syslog_default_write()
* syslog/syslog_device.c: syslog_dev_flush()
* grp/lib_initgroups.c: initgroups()
* misc/lib_mknod.c: mknod()
* misc/lib_glob.c: ignore_err()
* pthread/pthread_barrierinit.c: pthread_barrier_init()
* pthread/pthread_atfork.c: pthread_atfork()
* semaphore/sem_init.c: nxsem_init()
* stream/lib_nullinstream.c: nullinstream_getc()
* stream/lib_nulloutstream.c: nulloutstream_putc()
* stream/lib_libnoflush.c: lib_noflush()
* stream/lib_libsnoflush.c: lib_snoflush()
* string/lib_strerror.c: strerror()
* time/lib_gettimeofday.c: gettimeofday()
* time/lib_settimeofday.c: settimeofday()
* unistd/lib_pathconf.c: fpathconf(), pathconf()
* unistd/lib_getrusage.c: getrusage()
* unistd/lib_setrlimit.c: setrlimit()
* unistd/lib_getrlimit.c: getrlimit()
* unistd/lib_setpriority.c: setpriority()
2022-07-12 11:42:34 +08:00
gaojiawei
335fc3dde2
syslog: Fixed a potential buffer overflow issue
...
The `CONFIG_SYSLOG_MAX_CHANNELS` is user-specified, however, if the user
defines more channels than what `CONFIG_SYSLOG_MAX_CHANNELS` was defined as,
a potential buffer overflow occurred. Although the compiler does warn us about
that, we should explicitly tell the user this is an error.
Signed-off-by: gaojiawei <gaojiawei@xiaomi.com>
2022-05-18 01:36:16 +08:00
Xiang Xiao
8391ad2721
syslog: Change g_syslog_default_sem to static function variable
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-20 12:37:09 +02:00
chao.an
40f63453f4
syslog/channel: minor fix to avoid unreachabled return
...
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-03-19 11:13:44 +02:00
chao.an
4e08b1df93
drviers/syslog: correct the return value of default channel write
...
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-03-14 08:59:34 +02:00
Xiang Xiao
01b791d773
drivers/syslog: Implement RTT based log channel
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-01 11:26:46 +01:00
ligd
ff0cd0baac
Revert "drivers/syslog: Call up_puts in syslog_default_write instad up_putc"
...
This reverts commit 174b240325
.
Revert "drivers/syslog: Ensure the buffer zero terminate"
This reverts commit 1692aa7894
.
2021-11-01 06:54:05 -05:00
Xiang Xiao
174b240325
drivers/syslog: Call up_puts in syslog_default_write instad up_putc
...
since some drivers(e.g. semihosting) have more fast implementation.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-09-18 07:33:44 -03:00
David Sidrane
3e4b3ada5e
syslog:syslog_channel:Fix compiler warnings
...
syslog_channel.c:98:8: error: unknown type name 'sem_t'
syslog/syslog_channel.c:99:14: error: 'g_syslog_default_sem'
defined but not used
2021-07-14 17:38:30 -07:00
Jiuzhu Dong
817259ec2d
syslog/ramlog_channel: fix log confusion when multi task writing together
...
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-03 11:24:21 -05:00
Jiuzhu Dong
b30bf4ff06
syslog/default_channel: fix log confusion when multi task writing together
...
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-03 11:24:21 -05:00
Fotis Panagiotopoulos
b16de69e56
syslog: Added channel close callback.
2021-06-18 00:47:09 -05:00
Jiuzhu Dong
ed6b257fa4
syslog: support ramlog, up_putc, rpmsg_syslog coexist
...
N/A
Change-Id: Ia58c7e195da7ad48f3018a131a78b2f01f94e741
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-06-02 08:45:20 -05:00
Fotis Panagiotopoulos
1dee243e29
syslog: Added multi device support in syslog_device.
2021-04-06 07:32:23 -05:00
Fotis Panagiotopoulos
f13adbe4bb
Added support for multiple syslog channels.
2021-03-23 21:35:22 -07:00
Alin Jerpelea
e5b6305f4a
drivers: Author Gregory Nutt: update licenses to Apache
...
Gregory Nutt has submitted the SGA and we can migrate the licenses
to Apache.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-03-04 18:32:27 -08:00
Xiang Xiao
972033a61f
syslog: Check sc_flush in't NULL before invocation
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-27 13:48:56 +08:00
Xiang Xiao
e9773addfa
syslog/rpmsg: Fix warning: ‘syslog_rpmsg_write’ defined but not used
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-27 13:48:56 +08:00
Xiang Xiao
1d339eb80c
syslog: Make g_default_channel as static
2020-02-24 08:47:27 -06:00
Xiang Xiao
46e22d7fd9
syslog/rpmsg: Don't overwrite up_putc
...
Hook into syslog subsystem like ramlog approach
2020-02-24 08:47:13 -06:00
Juha Niskanen
ebc6f51641
Fix some typos
2019-09-17 10:46:23 -06:00
Xiang Xiao
f579c43754
drivers/syslog: Ensure interrupt log doesn't interlace in normal log. Don't call syslog_putc in syslog_default_write because syslog_putc will try to empty the interrupt buffer every time.
2018-11-09 08:46:32 -06:00
Xiang Xiao
1ee6083de3
Squashed commit of the following:
...
drivers/syslog: Channel configuration. Decouple SYSLOG_SERIAL_CONSOLE and ARCH_LOWPUTC. Since some hardware can output log to the special debug channel not serial.
drivers/syslog/vsyslog.c: Support pre-pending a prefix string to log output if enabled. This very useful to identify which cpu send out the log in AMP SoC.
drivers/syslog/vsyslog.c: Make timestamp output same as linux kernel. It's very useful if NuttX syslog retarget to Linux syslog.
2018-08-26 06:49:35 -06:00
Gregory Nutt
20727d17c3
SYSLOG: Add option to buffer SYSLOG output to avoid interleaving.
2017-05-10 14:42:43 -06:00
Gregory Nutt
8a9bd9af9d
SYSLOG: Some rather complex conditional compilation missed a case.
2016-06-21 15:08:09 -06:00
Gregory Nutt
e6a1d53869
Extend SYSLOG logic so that we can send SYSLOG output to a file. Not verified on initial commit.
2016-06-21 12:54:47 -06:00
Gregory Nutt
8f0c2cdd13
SYSLOG: Change configuration selections to assure that one and only one SYSLOG device can be selected. Also add a check to assure that it is appropriate to use up_putc as the low-level syslog device. Adds CONFIG_SYSLOG_CONSOLE and CONFIG_SYSLOG_SERIAL_CONSOLE.
2016-06-21 09:59:09 -06:00
Gregory Nutt
cf1375daf7
Break syslog_channel.c up into syslog_channel.c, syslog_putc.c, syslog_force.c and syslog_flush.c to limited what is brought into the link. Separate syslog_emergstream.c from syslog_stream.c. Didn't help in the case I was looking at.
2016-06-20 17:10:52 -06:00
Gregory Nutt
505ca542e8
Remove some last traces of lowvsyslog that were missed; Add a SYSLOG emergency channel for handling assertion output more cleanly
2016-06-20 16:11:50 -06:00
Gregory Nutt
f4c47636e7
SYSLOG: Debug output from the IDLE task should be forced like interrupt level output
2016-06-20 07:35:38 -06:00
Gregory Nutt
a43cdbff0b
Add missing file header
2016-06-19 09:48:42 -06:00
Gregory Nutt
fedf00033c
Make default interupt buffer smaller
2016-06-19 07:03:10 -06:00
Gregory Nutt
ea9565e137
SYSLOG: Flesh out interrupt buffer logic
2016-06-18 14:54:25 -06:00
Gregory Nutt
c44a011394
Add some basic SYSLOG channel selection logic
2016-06-18 12:54:55 -06:00