From e1e4dcfdef243a26f2ed9c5393d8dd7a01dc519a Mon Sep 17 00:00:00 2001 From: chao an Date: Tue, 19 Sep 2023 15:33:24 +0800 Subject: [PATCH] libs/libc: currect usage of getpid/gettid in library Signed-off-by: chao an --- include/nuttx/sched_note.h | 8 ++++---- libs/libc/gdbstub/lib_gdbstub.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/nuttx/sched_note.h b/include/nuttx/sched_note.h index bd6601f5da634..a5cafdb2ad123 100644 --- a/include/nuttx/sched_note.h +++ b/include/nuttx/sched_note.h @@ -136,14 +136,14 @@ sched_note_bprintf_ip(tag, SCHED_NOTE_IP, event, \ fmt, ##__VA_ARGS__) # define sched_note_beginex(tag, str) \ - sched_note_printf_ip(tag, SCHED_NOTE_IP, "B|%d|%s", gettid(), str) + sched_note_printf_ip(tag, SCHED_NOTE_IP, "B|%d|%s", _SCHED_GETTID(), str) # define sched_note_endex(tag, str) \ - sched_note_printf_ip(tag, SCHED_NOTE_IP, "E|%d|%s", gettid(), str) + sched_note_printf_ip(tag, SCHED_NOTE_IP, "E|%d|%s", _SCHED_GETTID(), str) # define sched_note_mark(tag, str) \ - sched_note_printf_ip(tag, SCHED_NOTE_IP, "I|%d|%s", gettid(), str) + sched_note_printf_ip(tag, SCHED_NOTE_IP, "I|%d|%s", _SCHED_GETTID(), str) # define sched_note_counter(tag, name, value) \ sched_note_printf_ip(tag, SCHED_NOTE_IP, "C|%d|%s|%" PRId32, \ - gettid(), name, value) + _SCHED_GETTID(), name, value) # define sched_note_begin(tag) \ sched_note_string_ip(tag, SCHED_NOTE_IP, "B") # define sched_note_end(tag) \ diff --git a/libs/libc/gdbstub/lib_gdbstub.c b/libs/libc/gdbstub/lib_gdbstub.c index 4c9b3b0a6b88b..3d353c572c85e 100644 --- a/libs/libc/gdbstub/lib_gdbstub.c +++ b/libs/libc/gdbstub/lib_gdbstub.c @@ -860,7 +860,7 @@ static void gdb_get_registers(FAR struct gdb_state_s *state) int i; reg = (FAR uint8_t *)tcb->xcp.regs; - if (state->pid == getpid()) + if (state->pid == _SCHED_GETPID()) { if (up_interrupt_context()) {