Commit Graph

53 Commits

Author SHA1 Message Date
Bowen Wang 71fe4acef4 MacOs: fix the sim compile warning in MacOS
CC:  clk/clk_fixed_rate.c clk/clk_divider.c:177:14: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
      return abs(rate - now) < abs(rate - best);
             ^
clk/clk_divider.c:177:14: note: remove the call to 'abs' since unsigned values cannot be negative
      return abs(rate - now) < abs(rate - best);
             ^~~
clk/clk_divider.c:177:32: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
      return abs(rate - now) < abs(rate - best);
                               ^
clk/clk_divider.c:177:32: note: remove the call to 'abs' since unsigned values cannot be negative
      return abs(rate - now) < abs(rate - best);
                               ^~~
CC:  mm_heap/mm_initialize.c 2 warnings generated.
clk/clk.c:1324:11: warning: variable 'irqflags' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
      if (clk->parents == NULL)
          ^~~~~~~~~~~~~~~~~~~~
clk/clk.c:1341:19: note: uninitialized use occurs here
  clk_list_unlock(irqflags);
                  ^~~~~~~~
clk/clk.c:1324:7: note: remove the 'if' if its condition is always false
      if (clk->parents == NULL)
      ^~~~~~~~~~~~~~~~~~~~~~~~~
clk/clk.c:1255:22: note: initialize the variable 'irqflags' to silence this warning
  irqstate_t irqflags;
                     ^
                      = 0
CC:  clk/clk_mux.c clk/clk_multiplier.c:110:14: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
      return abs(rate - new) < abs(rate - best);
             ^
clk/clk_multiplier.c:110:14: note: remove the call to 'abs' since unsigned values cannot be negative
      return abs(rate - new) < abs(rate - best);
             ^~~
clk/clk_multiplier.c:110:32: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
      return abs(rate - new) < abs(rate - best);
                               ^
clk/clk_multiplier.c:110:32: note: remove the call to 'abs' since unsigned values cannot be negative
      return abs(rate - new) < abs(rate - best);
                               ^~~
clk/clk_mux.c:47:14: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
      return abs(now - rate) < abs(best - rate);
             ^
clk/clk_mux.c:47:14: note: remove the call to 'abs' since unsigned values cannot be negative
      return abs(now - rate) < abs(best - rate);
             ^~~
clk/clk_mux.c:47:32: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
      return abs(now - rate) < abs(best - rate);
                               ^
clk/clk_mux.c:47:32: note: remove the call to 'abs' since unsigned values cannot be negative
      return abs(now - rate) < abs(best - rate);
                               ^~~
AS:  sim/sim_fork_x86.S 2 warnings generated.
1 warning2 warnings generated.
 generated.
iperf.c:325:14: warning: format specifies type 'uintmax_t' (aka 'unsigned long long') but the argument has type 'unsigned long' [-Wformat]
             now_len -last_len,
             ^~~~~~~~~~~~~~~~~
iperf.c:340:14: warning: format specifies type 'uintmax_t' (aka 'unsigned long long') but the argument has type 'uintmax_t' (aka 'unsigned long') [-Wformat]
             now_len,
             ^~~~~~~
CC:  misc/rpmsgblk_server.c 2 warnings generated.
:28: warning: format specifies type 'uintmax_t' (aka 'unsigned long long') but the argument has type 'uintmax_t' (aka 'unsigned long') [-Wformat]
                           (uintmax_t)skip);
                           ^~~~~~~~~~~~~~~
nsh_dbgcmds.c:473:20: warning: format specifies type 'uintmax_t' (aka 'unsigned long long') but the argument has type 'uintmax_t' (aka 'unsigned long') [-Wformat]
                   (uintmax_t)position);
                   ^~~~~~~~~~~~~~~~~~~
CC:  nsh_main.c 2 warnings generated.

              return INTMAX_MIN;
              ~~~~~~ ^~~~~~~~~~
CC:  nsh_system.c  note: expanded from macro 'INTMAX_MIN'
                            ^~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:65:41: note: expanded from macro 'INT64_MIN'
                             ~~~~~~~~~~~^~~
inttypes/lib_strtoimax.c:103:37: warning: implicit conversion from 'long long' to 'intmax_t' (aka 'long') changes value from -9223372036854775808 to 0 [-Wconstant-conversion]
          return (accum == limit) ? INTMAX_MIN : -(intmax_t)accum;
          ~~~~~~                    ^~~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:136:29: note: expanded from macro 'INTMAX_MIN'
                            ^~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:65:41: note: expanded from macro 'INT64_MIN'
                             ~~~~~~~~~~~^~~
inttypes/lib_strtoimax.c:106:17: warning: result of comparison of constant 9223372036854775807 with expression of type 'uintmax_t' (aka 'unsigned long') is always false [-Wtautological-constant-out-of-range-compare]
      if (accum > INTMAX_MAX)
          ~~~~~ ^ ~~~~~~~~~~
inttypes/lib_strtoimax.c:109:18: warning: implicit conversion from 'long long' to 'intmax_t' (aka 'long') changes value from 9223372036854775807 to -1 [-Wconstant-conversion]
          return INTMAX_MAX;
          ~~~~~~ ^~~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:137:29: note: expanded from macro 'INTMAX_MAX'
                            ^~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:66:29: note: expanded from macro 'INT64_MAX'
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/vela/work/nuttx/include/arch/inttypes.h:35:23: note: expanded from macro 'INT64_C'
                      ^~~~~~~
<scratch space>:12:1: note: expanded from here
9223372036854775807ll
^~~~~~~~~~~~~~~~~~~~~
syslog/vsyslog.c:212:32: warning: format specifies type 'uintmax_t' (aka 'unsigned long long') but the argument has type 'uintmax_t' (aka 'unsigned long') [-Wformat]
                             , (uintmax_t)ts.tv_sec
                               ^~~~~~~~~~~~~~~~~~~~
CC:  iob/iob_free.c 4 warnings generated.
1 warning generated.
CC:  mqueue/mq_msgqalloc.c inttypes/lib_strtoumax.c:91:23: warning: implicit conversion from 'unsigned long long' to 'uintmax_t' (aka 'unsigned long') changes value from 18446744073709551615 to 4294967295 [-Wconstant-conversion]
              accum = UINTMAX_MAX;
                    ~ ^~~~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:140:29: note: expanded from macro 'UINTMAX_MAX'
                            ^~~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:67:29: note: expanded from macro 'UINT64_MAX'
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/vela/work/nuttx/include/arch/inttypes.h:36:23: note: expanded from macro 'UINT64_C'
                      ^~~~~~~~
<scratch space>:8:1: note: expanded from here
18446744073709551615ull
^~~~~~~~~~~~~~~~~~~~~~~
CC:  icmp/icmp_ioctl.c 1 warning generated.
time/lib_strftime.c:584:52: warning: format specifies type 'uintmax_t' (aka 'unsigned long long') but the argument has type 'uintmax_t' (aka 'unsigned long') [-Wformat]
               len = snprintf(dest, chleft, "%ju", (uintmax_t)mktime(&tmp));
                                             ~~~   ^~~~~~~~~~~~~~~~~~~~~~~
                                             %ju

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-22 08:55:57 +08:00
hujun5 e249dd2672 arch: support customized up_cpu_index() in AMP mode
Some app with same code runs on different cores in AMP mode,
need the physical core on which the function is called.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2024-10-10 02:38:40 +08:00
xuxingliang 7044b10c88 task: use get_task_name where possible
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-01 20:38:06 +08:00
Daniel Appiagyei 5bfda12634 c++ compatibility: rename reserved c++ keywords 'public' and 'this' 2023-09-16 19:45:02 +08:00
yinshengkai 6a0ffa5c52 syslog: replace lib_sprintf to lib_sprintf_internal
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-07-14 00:22:11 +03:00
yinshengkai 0052ff2bd8 syslog: replace %pV with lib_sprintf
%pV will increase the stack size

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-07-14 00:22:11 +03:00
Petro Karashchenko 2ca40e14e9 drivers/syslog: remove redundant 'int' cast
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-07-07 17:39:39 -03:00
chao an fb9b41221d semantic/parser: fix compile warning found by sparse
Reference:
https://linux.die.net/man/1/sparse

Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-30 23:00:00 +08:00
Xiang Xiao 20ea607bd0 stream: Rename syslogstream to syslograwstream
to prepare a new stream implementation of syslog

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-25 15:22:04 +08:00
chao an 4c8d244fae sched/getpid: replace syscall getpid/tid/ppid() to kernel version
NuttX kernel should not use the syscall functions, especially after
enabling CONFIG_SCHED_INSTRUMENTATION_SYSCALL, all system functions
will be traced to backend, which will impact system performance.

Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-02 10:33:01 +08:00
yinshengkai e9ed994fec syslog: merge multiple lib_sprintf into one
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-01-05 02:00:43 +08:00
yinshengkai 74b8776872 syslog: put variable initialization in the front
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-01-05 02:00:43 +08:00
yinshengkai 72b19200b5 syslog: replace the switch statement with an array of strings
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-01-05 02:00:43 +08:00
yinshengkai 275b2e70a4 syslog: fix extra line breaks in syslog when SYSLOG_COLOR_OUTPUT is enabled
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-01-02 21:22:46 +08:00
Xiang Xiao 5fd1379d3f syslog: Move syslog stream to libc like other stream implementation
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-25 01:46:31 +08:00
qinwei1 8021dfece6 sched/task/task_getpid: getpid should return process id not thread id
Summary:
   implement the right semantics:
1. getpid should return the main thread id
2. gettid should return the current thread id

Refer to:
 https://github.com/apache/incubator-nuttx/issues/2499
 https://github.com/apache/incubator-nuttx/pull/2518

Signed-off-by: qinwei1 <qinwei1@xiaomi.com>
2022-11-17 17:58:08 +08:00
Fotis Panagiotopoulos 34e7ce5817 Reset syslog color before printing messages. 2022-06-30 09:44:41 +08: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
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
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
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
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
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
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
Jiuzhu Dong e21fddbb34 syslog/emerg: fix bug about printing LOG_EMERG log from iob buffer
The patch is related to: commit 5f7c98b6e1

Author: Xiang Xiao <xiaoxiang@xiaomi.com>
Date:   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 <xiaoxiang@xiaomi.com>

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-06-02 10:25:19 -03:00
Xiang Xiao 5f7c98b6e1 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 <xiaoxiang@xiaomi.com>
2021-05-18 09:26:28 -03:00
Matias N cf8521e6de syslog: add option to prefix process name 2021-03-11 19:40:48 -03: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
Fotis Panagiotopoulos eabb2fbf38 Re-arranged syslog fields. 2021-01-18 05:37:55 -08:00
chao.an efe236ba84 drivers/syslog: Prepend Process ID to syslog message
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-16 18:38:18 -08:00
Fotis Panagiotopoulos cb78dadc4b Added color output to syslog. 2021-01-16 16:17:16 -08:00
Fotis Panagiotopoulos 946443e190 Added printing of log priority in syslog. 2021-01-16 08:56:24 -08:00
Fotis Panagiotopoulos c11413a258 Added formatted timestamps in syslog. 2021-01-14 07:55:22 -06:00
YAMAMOTO Takashi f8d6a85f90 drivers/syslog/vsyslog.c: Fix a printf format warning 2020-11-16 08:29:00 -08:00
Xiang Xiao 517974787f Rename clock_systime[r|spec] to clock_systime_[ticks|timespec]
follow up the new naming convention:
https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions
2020-05-10 14:35:50 -06:00
Xiang Xiao 0f940e06f5 drivers/syslog/vsyslog.c: nx_syslog's return value should include the timestamp length 2018-11-09 08:35:20 -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 de6b13b3ab Per OpenGroup.org, syslog -- and, hence, nonstandard vsyslog, and debug wrappers -- does not return a value. Rename _vsyslog to nx_vsyslog. Use internal nx_vsyslog in the few cases where a return value is required. 2018-03-04 08:07:07 -06:00
Jussi Kivilinna 9fc5f44ef6 syslog: CONFIG_CLOCK_MONOTONIC 2017-08-04 08:02:52 -06:00
Gregory Nutt 0fc068cc9c syslog: Avoid flushing syslog_stream buffer, if possible, until lib_vsprintf() completely parses the format. This assures that the flush will flush the entire output, even data that may potentially follow the linefeed. And, in that case, it cannot be interleaved with other devug output. Suggested by Jussi Kivilinna. 2017-05-12 06:58:33 -06:00
Gregory Nutt b5c1dd09f5 Syslog: Need inclusion of errno.h for fix building with CONFIG_SYSLOG_TIMESTMAP=y 2017-05-11 07:15:57 -06:00
Jussi Kivilinna ba933efd9e When syslog message has addition characters after last new-line. With buffering those now get lost as vsyslog does not flush output after lib_sprintf. Additional trailing characters could be ANSI escape sequence to reset state that message setups. For example, macro here uses colors and resets state after actual message (including '\n'):
With flushing added to vsyslog, then there is problem that next syslog line might come from other task before reset sequence, causing wrong line getting color. This could be avoided by not flushing on '\n' but only if IOB is full and/or at end of vsyslog. Would this make sense?
2017-05-11 07:11:35 -06:00
Gregory Nutt d3b9f5b37f Syslog buffering: Use IOBs to buffer data, not an on-stack buffer 2017-05-10 17:36:08 -06:00
Gregory Nutt d8a83f16be Syslog buffering: Various corrections from early debug 2017-05-10 16:13:21 -06:00
Gregory Nutt 20727d17c3 SYSLOG: Add option to buffer SYSLOG output to avoid interleaving. 2017-05-10 14:42:43 -06:00
Jussi Kivilinna e835803166 yslog: use monotonic clock for timestamp when available 2017-04-26 10:38:15 -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 2b445ddccc Remove lowsyslog(). The new syslog() includes all of the functionality of lowsyslog(). No longer any need for two interfaces. 2016-06-20 08:57:08 -06:00
Gregory Nutt fa365e85f5 Update some cmoments 2016-06-20 06:11:22 -06:00