Commit Graph

247 Commits

Author SHA1 Message Date
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
Petro Karashchenko
09b3fb25ab drivers: remove unimplemented open/close/ioctl interfaces
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-04-15 16:56:25 +08:00
Petro Karashchenko
ea5ffac7d1 drivers/syslog: update description if Kconfig
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-04-11 23:36:39 +08:00
Xiang Xiao
9785d6606c openamp: Change the dependence from OPENAMP to RPTUN
since all rpmsg driver need the extension api exposed by rptun driver

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-05 10:05:41 +03:00
Jiuzhu Dong
840ba09b24 driver/syslog: Add microseconds after date time
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-03-31 23:57:15 +08:00
ligd
7619d2a6f9 syslog: fix syslog print twice when active assert
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-29 12:20:37 +08:00
ligd
b6e0614be6 syslog: use & instead of % when calculate offset
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-29 12:20:37 +08:00
ligd
61cb79d192 syslog_rpmsg: change head & tail NON-wrap
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-29 12:20:37 +08:00
Jiuzhu Dong
a8866132c2 ramlog: support setting threshold value of ramlog for poll waiters
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-03-28 22:48:56 +08:00
Petro Karashchenko
68902d8732 pid_t: unify usage of special task IDs
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-03-22 21:22:32 +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
8a880df37d syslog/ramlog: Fix error: argument to 'section' attribute is not valid
mach-o section specifier requires a segment and section separated by a comma

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-05 17:23:48 +02:00
Xiang Xiao
f1ed349dd9 sched/clock: Remove CLOCK_MONOTONIC option from Kconfig
here is the reason:
1.clock_systime_timespec(core function) always exist regardless the setting
2.CLOCK_MONOTONIC is a foundamental clock type required by many places

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-23 01:21:26 +08:00
Petro Karashchenko
74a4394352 drivers/syslog/syslog_device: fix flushing data when end of line is detected
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-02-05 03:10:31 +08:00
Xiang Xiao
4c167b0729 Correct the code alignment
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-01 21:22:21 -03: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
Xiang Xiao
1e87d50d34 drivers/syslog: Refine Kconfig option
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-31 13:42:19 +01:00
Xiang Xiao
6a0dbba62b syslog: Include nuttx/syslog/syslog.h in include/nuttx/syslog/syslog_rpmsg.h
to avoid struct syslog_channel_s used before definition
and remove the unnecessary inclusion

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-31 13:41:56 +01:00
Fotis Panagiotopoulos
0c41611429 syslog: Fix in file channel initialization. 2022-01-13 19:16:10 +01:00
Petro Karashchenko
a743fed63d file_operations: get back C89 compatible initializer
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-01-11 02:14:00 +08:00
Jiuzhu Dong
f35c6d7ef1 syslog/rpmsg: using up_putc to force flush syslog_rpmsg buffer
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-12-17 11:43:08 -06:00
Petro Karashchenko
51a2db6ffc Kconfig: improve uniformity
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2021-12-14 07:32:48 -06:00
Xiang Xiao
69468b700d libc: Move syslog_stream from nuttx/streams.h to drivers/syslog/syslog.h
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-14 00:51:59 -06:00
ligd
9a86aa7f77 syslog_rpmsg: fix typo
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-12-13 11:08:28 -06:00
ligd
93426ca7cc syslog_rpmsg: update syslog_rpmsg to support non-overwrite
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-12-13 11:08:28 -06:00
ligd
5b369c5cec libs/lbc: remove CHAR_BIT = 16 support
For CEVA platform CHAR_BIT is 16, and will do lots of extra work
when use IPC.
We will not support this platform anymore, so remove all the b2c operations.

Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-12-13 11:08:28 -06:00
Xiang Xiao
3d6a5a2d0d syslog: Add [] around the prefix like others
make the output format consistent

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-11 10:08:32 -06:00
anjiahao
41c3b42468 change /dev/syslog & /dev/ramlog for unix standard
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2021-11-24 05:19:46 -06: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
1692aa7894 drivers/syslog: Ensure the buffer zero terminate
This patch fix the regression by:
commit 174b240325
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
Date:   Fri Sep 17 11:56:21 2021 +0800

    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-21 08:44:44 -03: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
Jiuzhu Dong
19cea67f3e syslog: reslove crash because vmov.i32 instruction is not ready when system boot
So avoid to use vmov.i32 instruction before FPU is ready.

Before modification:
3c03b35c <nx_vsyslog>:
3c03b35c:	f2c00010 	vmov.i32	d16, #0	; 0x00000000
3c03b360:	f2c02050 	vmov.i32	q9, #0	; 0x00000000
3c03b364:	e92d40f0 	push	{r4, r5, r6, r7, lr}
3c03b368:	e24dd08c 	sub	sp, sp, #140	; 0x8c
3c03b36c:	e28d301c 	add	r3, sp, #28
3c03b370:	e2505000 	subs	r5, r0, #0
3c03b374:	edcd0b0f 	vstr	d16, [sp, #60]	; 0x3c
3c03b378:	edcd0b01 	vstr	d16, [sp, #4]

After modification:
3c03b35c <nx_vsyslog>:
3c03b35c:       e92d40f0        push    {r4, r5, r6, r7, lr}
3c03b360:       e2505000        subs    r5, r0, #0
3c03b364:       e24dd08c        sub     sp, sp, #140    ; 0x8c
3c03b368:       e1a06001        mov     r6, r1
3c03b36c:       e1a07002        mov     r7, r2
3c03b370:       e28d000c        add     r0, sp, #12
3c03b374:       1a00003a        bne     3c03b464 <nx_vsyslog+0x108>

Change-Id: I643c19f5416c94a529764fdaa81f3088fcf95355
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-25 23:02:04 -07: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
0c3cb0cb66 syslog: optimize init logic for early buffer initialize
N/A

Change-Id: I3295803977fa51e8ed8dedf7f0966b9604f8204d
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-10 11:10:13 -07:00
Jiuzhu Dong
4bb48892d0 ramlog: init head and tail when buffer is empty on boot
N/A

Change-Id: I6963ef6256c3a93ac7a63115c303033ceafa321f
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-10 11:10:13 -07:00
Jiuzhu Dong
c8ce33c634 syslog/intbuf: output log when syslog interrupt buffer is full
N/A
instead of adding overrun memssage:"[truncated]\n" to the end.

Change-Id: Ie27cdf0ca902d9ba203619a95162f01222e371c5
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-10 11:08:59 -07:00
Gustavo Henrique Nihei
d12619c85f drivers/syslog: Avoid prepending process name when no TCB is available
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-07-08 21:13:36 -05:00
Nathan Hartman
ce20211357 Fix various typos in comments and documentation
Fix typos in these files:
    * Documentation/components/drivers/character/foc.rst
    * Documentation/guides/cpp_cmake.rst
    * Kconfig
    * arch/arm/src/imxrt/imxrt_lpspi.c
    * arch/arm/src/kinetis/kinetis_spi.c
    * arch/arm/src/kl/kl_spi.c
    * arch/arm/src/lpc31xx/lpc31_spi.c
    * arch/arm/src/nrf52/nrf52_radio.h
    * arch/arm/src/s32k1xx/s32k1xx_lpspi.c
    * arch/arm/src/stm32/Kconfig
    * arch/arm/src/stm32/stm32_adc.c
    * arch/arm/src/stm32/stm32_foc.c
    * arch/arm/src/stm32/stm32_foc.h
    * arch/arm/src/stm32/stm32_pwm.c
    * arch/arm/src/stm32/stm32_spi.c
    * arch/arm/src/stm32f0l0g0/stm32_spi.c
    * arch/arm/src/stm32f7/Kconfig
    * arch/arm/src/stm32f7/stm32_spi.c
    * arch/arm/src/stm32h7/Kconfig
    * arch/arm/src/stm32h7/stm32_allocateheap.c
    * arch/arm/src/stm32h7/stm32_fmc.c
    * arch/arm/src/stm32h7/stm32_fmc.h
    * arch/arm/src/stm32h7/stm32_pwm.c
    * arch/arm/src/stm32h7/stm32_qspi.c
    * arch/arm/src/stm32h7/stm32_spi.c
    * arch/arm/src/stm32l4/stm32l4_pwm.c
    * arch/arm/src/stm32l4/stm32l4_spi.c
    * arch/arm/src/stm32l5/Kconfig
    * arch/arm/src/stm32l5/stm32l5_spi.c
    * arch/renesas/src/rx65n/rx65n_dtc.c
    * arch/renesas/src/rx65n/rx65n_usbdev.c
    * arch/risc-v/src/rv32m1/rv32m1_serial.c
    * boards/arm/stm32/b-g431b-esc1/src/stm32_foc.c
    * boards/arm/stm32/nucleo-f103rb/src/stm32_foc_ihm07m1.c
    * boards/arm/stm32/nucleo-f302r8/src/stm32_foc_ihm07m1.c
    * boards/arm/stm32h7/nucleo-h743zi2/README.txt
    * boards/risc-v/rv32m1/rv32m1-vega/README.txt
    * boards/sim/sim/sim/scripts/Make.defs
    * drivers/1wire/1wire.c
    * drivers/1wire/1wire_internal.h
    * drivers/lcd/Kconfig
    * drivers/syslog/ramlog.c
    * fs/fat/Kconfig
    * libs/libc/debug/Kconfig
    * libs/libc/machine/Kconfig
    * libs/libc/stdio/lib_libvsprintf.c
    * libs/libc/stdlib/lib_div.c
    * libs/libc/stdlib/lib_ldiv.c
    * libs/libc/stdlib/lib_lldiv.c
    * libs/libdsp/lib_observer.c
2021-07-04 11:23:26 -05: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
7fa69e4173 syslog/ramlog: get ramlog size by ioctl
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
Jiuzhu Dong
a75b712e77 syslog: fix crash when print localtime by syslog
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-02 04:57:11 -05:00
ligd
5de150160f syslog: add CPU id to system when open CONFIG_SMP
Change-Id: Ie8aaf44583ff4146b79b1392d1410b31806a81e8
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-02 08:45:43 +09:00
Fotis Panagiotopoulos
b16de69e56 syslog: Added channel close callback. 2021-06-18 00:47:09 -05:00
Xiang Xiao
80157b8782 syslog/ramlog: Remove the duplication of \n->\r\n conversion
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I5497f3ab40a55c5c08ba893e1186b93915cef03a
2021-06-17 06:22:28 -07:00
Fotis Panagiotopoulos
b73dc0f166 syslog: Added separator in file logs. 2021-06-09 10:09:04 -05:00
Xiang Xiao
5b2a17b892 Include assert.h in necessary place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-08 13:06:08 -07:00
Fotis Panagiotopoulos
37ec290a11 Syslog file rotations number is configurable. 2021-06-08 04:12:48 -05:00