|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT/NEWLIB PATCH 4/6] syslog.c: Make it compile
* Use Unikraft mutex
* Replace __syslog_chk() with syslog()
Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
Makefile.uk | 1 +
musl-imported/src/syslog.c | 11 +++++++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/Makefile.uk b/Makefile.uk
index a4e9f6a..12e5e7e 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -113,6 +113,7 @@ LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/time.c|glue
LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/locale.c
LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/dev.c
LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/signal.c
+LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/musl-imported/src/syslog.c
LIBNEWLIBGLUE_SRCS-y +=
$(LIBNEWLIBC_BASE)/musl-imported/src/termios/tcsetattr.c
LIBNEWLIBGLUE_SRCS-y +=
$(LIBNEWLIBC_BASE)/musl-imported/src/termios/tcgetattr.c
diff --git a/musl-imported/src/syslog.c b/musl-imported/src/syslog.c
index be7cfb6..941a175 100644
--- a/musl-imported/src/syslog.c
+++ b/musl-imported/src/syslog.c
@@ -7,9 +7,13 @@
#include <string.h>
#include <stdarg.h>
#include <unistd.h>
-#include <libc.h>
+#include <uk/mutex.h>
-static mutex_t lock;
+
+#define LOCK(x) uk_mutex_lock(&(x))
+#define UNLOCK(x) uk_mutex_unlock(&(x))
+
+static struct uk_mutex lock = UK_MUTEX_INITIALIZER(lock);
static char log_ident[32];
static int log_opt;
static int log_facility = LOG_USER;
@@ -35,7 +39,7 @@ void closelog(void)
{
}
-void __syslog_chk(int priority, int flag, const char *message, ...)
+void syslog(int priority, const char *message, ...)
{
LOCK(lock);
@@ -70,4 +74,3 @@ void __syslog_chk(int priority, int flag, const char
*message, ...)
UNLOCK(lock);
}
-
--
2.20.1
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |