Skip to content

Commit 71fa807

Browse files
committed
libc/semaphore: Update semaphore initialization condition
- Update include condition to prevent unnecessary inclusion of debugging features in non-kernel builds. - save_semaphore_history is in os/kernel, So it's only available in kernel not in libc. Signed-off-by: seokhun-eom <seokhun.eom@samsung.com>
1 parent 74eb039 commit 71fa807

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/libc/semaphore/sem_init.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
#include <semaphore.h>
6262
#include <errno.h>
6363

64-
#ifdef CONFIG_SEMAPHORE_HISTORY
64+
#if defined(CONFIG_SEMAPHORE_HISTORY) && defined(__KERNEL__)
6565
#include <tinyara/debug/sysdbg.h>
6666
#endif
6767
#if defined(CONFIG_BINMGR_RECOVERY) && defined(__KERNEL__)
@@ -110,7 +110,7 @@ int sem_init(FAR sem_t *sem, int pshared, unsigned int value)
110110
/* Initialize the semaphore count */
111111

112112
sem->semcount = (int16_t)value;
113-
#ifdef CONFIG_SEMAPHORE_HISTORY
113+
#if defined(CONFIG_SEMAPHORE_HISTORY) && defined(__KERNEL__)
114114
save_semaphore_history(sem, (void *)NULL, SEM_INIT);
115115
#endif
116116

0 commit comments

Comments
 (0)