Commit Graph

287 Commits

Author SHA1 Message Date
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
Xiang Xiao b0a0ba3ad7 fs: Move mmap callback before truncate in [file|mountpt]_operations
since mmap may exist in block_operations, but truncate may not,
moving mmap beforee truncate could make three struct more compatible

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-04 17:43:59 +02:00
Xiang Xiao 779a610ca3 Remove the unnecessary NULL fields in global instance definition of file_operations
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-04 00:32:13 +02:00
Jukka Laitinen f33dc4df3f Change FIOC_MMAP into file operation call
- Add mmap into file_operations and remove it from ioctl definitions.
- Add mm_map structure definitions to support future unmapping
- Modify all drivers to initialize the operations struct accordingly

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-02 11:23:20 -03:00
Jukka Laitinen 41e9df2f3e Add ftruncate into file operation calls
- Add truncate into file_operations
- Move truncate to be common for mountpt_operations and file_operations
- Modify all drivers to initialize the operations struct accordingly

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-02 11:23:20 -03: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 055f1f33eb libc/stream: Rename [lib_stream_](put|get) to [lib_stream_](putc|getc)
to make the naming style consistent with each other

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-05 14:27:55 +01:00
田昕 1d8d6e5ed2 drivers/syslog:support stream as syslog backend.
Signed-off-by: 田昕 <tianxin7@xiaomi.com>
2022-11-28 20:19:00 +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 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
yinshengkai 95d9abcf58 tools: replace DEFINE script to Makefile variable
In the past, predefined macros were generated by define.sh scripts
Now they are generated by concatenating environment variables

In this way, when executing makefile, no shell command will be executed,
it will improve the speed of executing makfile

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-11-03 19:59:55 +08:00
anjiahao d7b4e91dda Call nxsem_destroy or nxmutex_destry in the error path
1.Don't check the return value of nxsem_init or nxmutex_init
2.Fix some style issue

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-30 13:56:52 +01:00
anjiahao e1ca516488 use SEM_INITIALIZER inside of NXSEM_INITIALIZER
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-10-22 14:50:48 +08:00
anjiahao 5724c6b2e4 sem:remove sem default protocl
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-10-22 14:50:48 +08:00
Xiang Xiao dca5a3483f drivers: Destroy mutex and sem in the error path
also correct the order to ensure the memory free is last step

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-17 15:59:46 +09:00
anjiahao d1d46335df Replace nxsem API when used as a lock with nxmutex API
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-17 15:59:46 +09:00
Xiang Xiao bdeaea3742 Remove the unnessary empty line after label
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-30 17:54:56 +02:00
wangbowen6 344c8be049 poll: add poll_notify() api and call it in all drivers
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-09-26 12:06:32 +08:00
Xiang Xiao 130b196876 Refine how to specify iob and ramlog data section
1.Remove the default value(.bss)
2.Remove !ARCH_SIM dependence

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-08-25 14:05:17 +02:00
Xiang Xiao ba9486de4a iob: Remove iob_user_e enum and related code
since it is impossible to track producer and consumer
correctly if TCP/IP stack pass IOB directly to netdev

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-08-15 08:41:20 +03:00
Xiang Xiao 64f0267993 syslog: Move syslog_rpmsg_server_init to syslog_initialize
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-08-11 02:08:42 +03:00
ligd 8a3683fb9f rptun: add ns_match callback to resolve rptun deadlock
thread A: accept -> net_lock -> socket_rpmsg_accept
          -> rpmsg_register_callabck -> rptun_lock
thread B: ns_bind -> rpmsg_socket_ns_bind -> get_tx_payload_buffer
          -> rptun_wait_tx -> usrsock_rpmsg_ept_cb -> usrsockdev_write
          -> net_lock -> deadlock

fix:
add ns_match callback

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-27 20:36:51 +08: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
Jiuzhu Dong e7b8af7a35 driver/ramlog: set CONFIG_SYSLOG_DEVPATH to /dev/kmsg when enbale ramglog
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-21 23:40:56 +08:00
Jiuzhu Dong af62e6cbfa driver/syslog: support syslog rpmsg server chardev
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-21 23:40:56 +08:00
Jiuzhu Dong eedb774d68 driver/syslog: remove TRANSFER_DONE and sem wait when buffer is full
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-21 23:40:56 +08:00
Jiuzhu Dong 059114557f driver/syslog: support syslog output when buffer remaining space over 75%
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-21 23:40:56 +08:00
Jiuzhu Dong 664fcb2698 driver/syslog: support syslog rpmsg character buffer
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-21 23:40:56 +08:00
ligd 5c33db4220 syslog_rpmsg: head must bigger then tail when syslog_rpmsg_init
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-21 23:40:56 +08: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
Nathan Hartman 849f760b77 Fix various typos 2022-07-08 02:15:54 +08:00
Fotis Panagiotopoulos 34e7ce5817 Reset syslog color before printing messages. 2022-06-30 09:44:41 +08:00
Xiang Xiao 22548d71eb drivers/syslog: reuse rmutex_t for the recursive check
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-06-16 19:01:49 +03:00
Petro Karashchenko e42e3aa642 drivers/syslog: fix deadlock by reverting part of the changes from b88a8cf39f
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-06-14 00:11:28 +08:00
Fotis Panagiotopoulos 73d5a27702 Fix in default syslog date format. 2022-06-05 22:23:32 +08:00
Fotis Panagiotopoulos c0df7317ac Fix in syslog file separator. 2022-06-04 14:30:15 +08:00
anjiahao b88a8cf39f use rmutex inside of all repeated implementation
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-05-30 19:43:48 +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
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