mirror of
https://github.com/apache/nuttx.git
synced 2026-05-22 22:01:17 +08:00
driver/note: Fix compilation error when CONFIG_SYSLOG_TO_SCHED_NOTE=y
Add compilation condition for 'nx_vsyslog' syscall. Export 'sched_note_printf_ip' syscall when CONFIG_SYSLOG_TO_SCHED_NOTE=y Put the implementation of sched_note_printf_ip in libc/misc/lib_note.c Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
This commit is contained in:
+17
-27
@@ -1533,7 +1533,7 @@ void sched_note_event_ip(uint32_t tag, uintptr_t ip, uint8_t event,
|
||||
}
|
||||
|
||||
void sched_note_vprintf_ip(uint32_t tag, uintptr_t ip, FAR const char *fmt,
|
||||
uint32_t type, va_list va)
|
||||
uint32_t type, va_list *va)
|
||||
{
|
||||
FAR struct note_printf_s *note;
|
||||
FAR struct note_driver_s **driver;
|
||||
@@ -1549,7 +1549,7 @@ void sched_note_vprintf_ip(uint32_t tag, uintptr_t ip, FAR const char *fmt,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (note_vprintf(*driver, ip, fmt, va))
|
||||
if (note_vprintf(*driver, ip, fmt, *va))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -1601,7 +1601,7 @@ void sched_note_vprintf_ip(uint32_t tag, uintptr_t ip, FAR const char *fmt,
|
||||
{
|
||||
case NOTE_PRINTF_UINT32:
|
||||
{
|
||||
var->i = va_arg(va, int);
|
||||
var->i = va_arg(*va, int);
|
||||
if (next + sizeof(var->i) > length)
|
||||
{
|
||||
break;
|
||||
@@ -1617,14 +1617,14 @@ void sched_note_vprintf_ip(uint32_t tag, uintptr_t ip, FAR const char *fmt,
|
||||
break;
|
||||
}
|
||||
|
||||
var->ll = va_arg(va, long long);
|
||||
var->ll = va_arg(*va, long long);
|
||||
next += sizeof(var->ll);
|
||||
}
|
||||
break;
|
||||
case NOTE_PRINTF_STRING:
|
||||
{
|
||||
size_t len;
|
||||
var->s = va_arg(va, FAR const char *);
|
||||
var->s = va_arg(*va, FAR const char *);
|
||||
len = strlen(var->s) + 1;
|
||||
if (next + len > length)
|
||||
{
|
||||
@@ -1637,7 +1637,7 @@ void sched_note_vprintf_ip(uint32_t tag, uintptr_t ip, FAR const char *fmt,
|
||||
break;
|
||||
case NOTE_PRINTF_DOUBLE:
|
||||
{
|
||||
var->d = va_arg(va, double);
|
||||
var->d = va_arg(*va, double);
|
||||
if (next + sizeof(var->d) > length)
|
||||
{
|
||||
break;
|
||||
@@ -1675,7 +1675,7 @@ void sched_note_vprintf_ip(uint32_t tag, uintptr_t ip, FAR const char *fmt,
|
||||
break;
|
||||
}
|
||||
|
||||
var->im = va_arg(va, intmax_t);
|
||||
var->im = va_arg(*va, intmax_t);
|
||||
next += sizeof(var->im);
|
||||
}
|
||||
#ifdef CONFIG_HAVE_LONG_LONG
|
||||
@@ -1686,7 +1686,7 @@ void sched_note_vprintf_ip(uint32_t tag, uintptr_t ip, FAR const char *fmt,
|
||||
break;
|
||||
}
|
||||
|
||||
var->ll = va_arg(va, long long);
|
||||
var->ll = va_arg(*va, long long);
|
||||
next += sizeof(var->ll);
|
||||
}
|
||||
#endif
|
||||
@@ -1697,7 +1697,7 @@ void sched_note_vprintf_ip(uint32_t tag, uintptr_t ip, FAR const char *fmt,
|
||||
break;
|
||||
}
|
||||
|
||||
var->l = va_arg(va, long);
|
||||
var->l = va_arg(*va, long);
|
||||
next += sizeof(var->l);
|
||||
}
|
||||
else if (*(p - 2) == 'z')
|
||||
@@ -1707,7 +1707,7 @@ void sched_note_vprintf_ip(uint32_t tag, uintptr_t ip, FAR const char *fmt,
|
||||
break;
|
||||
}
|
||||
|
||||
var->sz = va_arg(va, size_t);
|
||||
var->sz = va_arg(*va, size_t);
|
||||
next += sizeof(var->sz);
|
||||
}
|
||||
else if (*(p - 2) == 't')
|
||||
@@ -1717,7 +1717,7 @@ void sched_note_vprintf_ip(uint32_t tag, uintptr_t ip, FAR const char *fmt,
|
||||
break;
|
||||
}
|
||||
|
||||
var->ptr = va_arg(va, ptrdiff_t);
|
||||
var->ptr = va_arg(*va, ptrdiff_t);
|
||||
next += sizeof(var->ptr);
|
||||
}
|
||||
else
|
||||
@@ -1727,7 +1727,7 @@ void sched_note_vprintf_ip(uint32_t tag, uintptr_t ip, FAR const char *fmt,
|
||||
break;
|
||||
}
|
||||
|
||||
var->i = va_arg(va, int);
|
||||
var->i = va_arg(*va, int);
|
||||
next += sizeof(var->i);
|
||||
}
|
||||
|
||||
@@ -1745,7 +1745,7 @@ void sched_note_vprintf_ip(uint32_t tag, uintptr_t ip, FAR const char *fmt,
|
||||
break;
|
||||
}
|
||||
|
||||
var->ld = va_arg(va, long double);
|
||||
var->ld = va_arg(*va, long double);
|
||||
next += sizeof(var->ld);
|
||||
}
|
||||
else
|
||||
@@ -1756,7 +1756,7 @@ void sched_note_vprintf_ip(uint32_t tag, uintptr_t ip, FAR const char *fmt,
|
||||
break;
|
||||
}
|
||||
|
||||
var->d = va_arg(va, double);
|
||||
var->d = va_arg(*va, double);
|
||||
next += sizeof(var->d);
|
||||
}
|
||||
#endif
|
||||
@@ -1765,13 +1765,13 @@ void sched_note_vprintf_ip(uint32_t tag, uintptr_t ip, FAR const char *fmt,
|
||||
}
|
||||
else if (c == '*')
|
||||
{
|
||||
var->i = va_arg(va, int);
|
||||
var->i = va_arg(*va, int);
|
||||
next += sizeof(var->i);
|
||||
}
|
||||
else if (c == 's')
|
||||
{
|
||||
size_t len;
|
||||
var->s = va_arg(va, FAR char *);
|
||||
var->s = va_arg(*va, FAR char *);
|
||||
len = strlen(var->s) + 1;
|
||||
if (next + len > length)
|
||||
{
|
||||
@@ -1789,7 +1789,7 @@ void sched_note_vprintf_ip(uint32_t tag, uintptr_t ip, FAR const char *fmt,
|
||||
break;
|
||||
}
|
||||
|
||||
var->p = va_arg(va, FAR void *);
|
||||
var->p = va_arg(*va, FAR void *);
|
||||
next += sizeof(var->p);
|
||||
infmt = false;
|
||||
}
|
||||
@@ -1808,16 +1808,6 @@ void sched_note_vprintf_ip(uint32_t tag, uintptr_t ip, FAR const char *fmt,
|
||||
note_add(*driver, note, length);
|
||||
}
|
||||
}
|
||||
|
||||
void sched_note_printf_ip(uint32_t tag, uintptr_t ip, FAR const char *fmt,
|
||||
uint32_t type, ...)
|
||||
{
|
||||
va_list va;
|
||||
va_start(va, type);
|
||||
sched_note_vprintf_ip(tag, ip, fmt, type, va);
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SCHED_INSTRUMENTATION_DUMP */
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_FILTER
|
||||
|
||||
@@ -185,7 +185,7 @@
|
||||
#define sched_note_event(tag, event, buf, len) \
|
||||
sched_note_event_ip(tag, SCHED_NOTE_IP, event, buf, len)
|
||||
#define sched_note_vprintf(tag, fmt, va) \
|
||||
sched_note_vprintf_ip(tag, SCHED_NOTE_IP, fmt, 0, va)
|
||||
sched_note_vprintf_ip(tag, SCHED_NOTE_IP, fmt, 0, &(va))
|
||||
|
||||
#ifdef CONFIG_DRIVERS_NOTE_STRIP_FORMAT
|
||||
# define sched_note_printf(tag, fmt, ...) \
|
||||
@@ -670,7 +670,7 @@ void sched_note_heap(uint8_t event, FAR void *heap, FAR void *mem,
|
||||
void sched_note_event_ip(uint32_t tag, uintptr_t ip, uint8_t event,
|
||||
FAR const void *buf, size_t len);
|
||||
void sched_note_vprintf_ip(uint32_t tag, uintptr_t ip, FAR const char *fmt,
|
||||
uint32_t type, va_list va) printf_like(3, 0);
|
||||
uint32_t type, va_list *va) printf_like(3, 0);
|
||||
void sched_note_printf_ip(uint32_t tag, uintptr_t ip, FAR const char *fmt,
|
||||
uint32_t type, ...) printf_like(3, 5);
|
||||
#else
|
||||
|
||||
@@ -402,3 +402,7 @@ SYSCALL_LOOKUP(settimeofday, 2)
|
||||
/* ANSI C signal handling */
|
||||
|
||||
SYSCALL_LOOKUP(signal, 2)
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_DUMP
|
||||
SYSCALL_LOOKUP(sched_note_vprintf_ip, 5)
|
||||
#endif
|
||||
|
||||
@@ -122,6 +122,10 @@ if(CONFIG_FDCHECK)
|
||||
list(APPEND SRCS lib_fdcheck.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_SCHED_INSTRUMENTATION_DUMP)
|
||||
list(APPEND SRCS lib_note.c)
|
||||
endif()
|
||||
|
||||
if(NOT CONFIG_LIBC_UNAME_DISABLE_TIMESTAMP)
|
||||
add_custom_target(
|
||||
always_rebuild_lib_utsname
|
||||
|
||||
@@ -80,6 +80,12 @@ ifeq ($(CONFIG_FDCHECK),y)
|
||||
CSRCS += lib_fdcheck.c
|
||||
endif
|
||||
|
||||
# Note support
|
||||
|
||||
ifeq ($(CONFIG_SCHED_INSTRUMENTATION_DUMP),y)
|
||||
CSRCS += lib_note.c
|
||||
endif
|
||||
|
||||
# To ensure uname information is newest,
|
||||
# add lib_utsname.o to phony target for force rebuild
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/****************************************************************************
|
||||
* libs/libc/misc/lib_note.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <nuttx/sched_note.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_DUMP
|
||||
|
||||
void sched_note_printf_ip(uint32_t tag, uintptr_t ip,
|
||||
FAR const char *fmt,
|
||||
uint32_t type, ...)
|
||||
{
|
||||
va_list va;
|
||||
va_start(va, type);
|
||||
sched_note_vprintf_ip(tag, ip, fmt, type, &va);
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SCHED_INSTRUMENTATION_DUMP */
|
||||
|
||||
+2
-1
@@ -84,7 +84,7 @@
|
||||
"nx_mkfifo","nuttx/fs/fs.h","defined(CONFIG_PIPES) && CONFIG_DEV_FIFO_SIZE > 0","int","FAR const char *","mode_t","size_t"
|
||||
"nx_pthread_create","nuttx/pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_trampoline_t","FAR pthread_t *","FAR const pthread_attr_t *","pthread_startroutine_t","pthread_addr_t"
|
||||
"nx_pthread_exit","nuttx/pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","noreturn","pthread_addr_t"
|
||||
"nx_vsyslog","nuttx/syslog/syslog.h","","int","int","FAR const IPTR char *","FAR va_list *"
|
||||
"nx_vsyslog","nuttx/syslog/syslog.h","!defined(CONFIG_SYSLOG_TO_SCHED_NOTE)","int","int","FAR const IPTR char *","FAR va_list *"
|
||||
"nxsched_get_stackinfo","nuttx/sched.h","","int","pid_t","FAR struct stackinfo_s *"
|
||||
"nxsem_tickwait","nuttx/semaphore.h","","int","FAR sem_t *","uint32_t"
|
||||
"nxsem_clockwait","nuttx/semaphore.h","","int","FAR sem_t *","clockid_t","FAR const struct timespec *"
|
||||
@@ -140,6 +140,7 @@
|
||||
"sched_getscheduler","sched.h","","int","pid_t"
|
||||
"sched_lock","sched.h","","void"
|
||||
"sched_lockcount","sched.h","","int"
|
||||
"sched_note_vprintf_ip","nuttx/sched_note.h","defined(CONFIG_SCHED_INSTRUMENTATION_DUMP)","void","uint32_t","uintptr_t","FAR const IPTR char *","uint32_t","FAR va_list *"
|
||||
"sched_rr_get_interval","sched.h","","int","pid_t","struct timespec *"
|
||||
"sched_setaffinity","sched.h","defined(CONFIG_SMP)","int","pid_t","size_t","FAR const cpu_set_t*"
|
||||
"sched_setparam","sched.h","","int","pid_t","const struct sched_param *"
|
||||
|
||||
|
Reference in New Issue
Block a user