l4re-base-25.08.0

This commit is contained in:
2025-09-12 15:55:45 +02:00
commit d959eaab98
37938 changed files with 9382688 additions and 0 deletions

3
src/l4/pkg/log/Control Normal file
View File

@@ -0,0 +1,3 @@
provides: log
requires: libc_minimal l4re
maintainer: adam@os.inf.tu-dresden.de

4
src/l4/pkg/log/Makefile Normal file
View File

@@ -0,0 +1,4 @@
PKGDIR ?= .
L4DIR ?= $(PKGDIR)/../..
include $(L4DIR)/mk/subdir.mk

View File

@@ -0,0 +1,8 @@
PKGDIR ?= ..
L4DIR ?= $(PKGDIR)/../..
# All haeder files found in this directory tree will be automatically
# installed in a way that they can be included with
# #include <l4/pkgname/yourfile.h> later.
# No need to list them in this Makefile.
include $(L4DIR)/mk/include.mk

View File

@@ -0,0 +1,24 @@
/*
* (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>
* economic rights: Technische Universität Dresden (Germany)
* This file is part of TUD:OS and distributed under the terms of the
* GNU Lesser General Public License 2.1.
* Please see the COPYING-LGPL-2.1 file for details.
*/
#pragma once
#include <l4/sys/compiler.h>
L4_BEGIN_DECLS
L4_CV void LOG_printf(const char *format, ...)
__attribute__((format(printf, 1, 2)));
L4_CV void LOG_vprintf(const char *format, __builtin_va_list list);
L4_CV void LOG_log(const char *function, const char *format, ...)
__attribute__((format(printf, 2, 3)));
L4_CV void LOG_logl(const char *file, int line, const char *function,
const char *format, ...)
__attribute__((format(printf, 4, 5)));
L4_CV void LOG_flush(void);
L4_END_DECLS

View File

@@ -0,0 +1,119 @@
/*
* (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
* Alexander Warg <warg@os.inf.tu-dresden.de>
* economic rights: Technische Universität Dresden (Germany)
* This file is part of TUD:OS and distributed under the terms of the
* GNU Lesser General Public License 2.1.
* Please see the COPYING-LGPL-2.1 file for details.
*/
#pragma once
#include <l4/log/log.h>
#include <l4/sys/kdebug.h>
#include <l4/sys/compiler.h>
#ifndef L4BID_RELEASE_MODE
/* format_check: just for the compiler to check the format & args */
L4_BEGIN_DECLS
L4_CV void LOG_format_check(const char*format,...)
__attribute__((format(printf,1,2)));
L4_END_DECLS
#define __LINE_STR__ L4_stringify(__LINE__)
#define LOG(a...) do { \
if(0)LOG_format_check(a); \
LOG_log(__func__, a); \
} while(0)
#define LOGl(a...) do { \
if(0)LOG_format_check(a); \
LOG_logl(__FILE__,__LINE__,__func__, a); \
} while(0)
#define LOG_Enter(a...) do { \
if(0)LOG_format_check("called " a); \
LOG_log(__func__, "called " a); \
} while(0)
#define LOGk(a...) do { \
if(0)LOG_format_check(a); \
LOG_logk(a); \
} while(0)
#define LOGd_Enter(doit, msg...) do { if(doit) LOG_Enter(msg); } while (0)
#define LOGd(doit, msg...) do { if(doit) LOG(msg); } while (0)
#define LOGdl(doit,msg...) do { if(doit) LOGl(msg); } while (0)
#define LOGdk(doit,msg...) do { if(doit) LOGk(msg); } while (0)
#define LOG_Error(msg...) LOGl("Error: " msg)
#define LOG_logk(format...) do { \
char buf[35]; \
LOG_snprintf(buf,sizeof(buf),format); \
LOG_outstring_fiasco_tbuf(buf); \
} while (0)
#else
#define LOG(a...)
#define LOGl(a...)
#define LOGL(a...)
#define LOGk(a...)
#define LOG_Enter(a...)
#define LOGd_Enter(doit, msg...)
#define LOGd(doit, msg...)
#define LOGdl(doit,msg...)
#define LOGdL(doit,msg...)
#define LOGdk(doit,msg...)
#define LOG_Error(msg...)
#endif
L4_BEGIN_DECLS
void _exit(int status) __attribute__ ((__noreturn__));
L4_END_DECLS
/* print message and enter kernel debugger */
#ifndef Panic
# ifdef L4BID_RELEASE_MODE
# define Panic(args...) do \
{ \
LOG(args); \
LOG_flush(); \
_exit(-1); \
} \
while (1)
# else
# define Panic(args...) do \
{ \
LOG(args); \
LOG_flush(); \
enter_kdebug("PANIC, 'g' for exit");\
_exit(-1); \
} \
while (1)
# endif
#endif
/* assertion */
#ifndef Assert
# define Assert(expr) do \
{ \
if (!(expr)) \
{ \
LOG_printf(#expr "\n"); \
Panic("Assertion failed"); \
} \
} \
while (0)
#endif
/* enter kernel debugger */
#ifndef Kdebug
# define Kdebug(args...) do \
{ \
LOG(args); \
LOG_flush(); \
enter_kdebug("KD"); \
} \
while (0)
#endif

View File

@@ -0,0 +1,9 @@
PKGDIR ?= ..
L4DIR ?= $(PKGDIR)/../..
# the default is to build the listed directories, provided that they
# contain a Makefile. If you need to change this, uncomment the following
# line and adapt it.
# TARGET = idl src lib server examples doc
include $(L4DIR)/mk/subdir.mk

View File

@@ -0,0 +1,7 @@
PKGDIR?= ../..
L4DIR ?= $(PKGDIR)/../..
TARGET = lib4log.a
SRC_C = log.c
include $(L4DIR)/mk/lib.mk

View File

@@ -0,0 +1,62 @@
/*
* (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
* Alexander Warg <warg@os.inf.tu-dresden.de>
* economic rights: Technische Universität Dresden (Germany)
* This file is part of TUD:OS and distributed under the terms of the
* GNU Lesser General Public License 2.1.
* Please see the COPYING-LGPL-2.1 file for details.
*/
#include <l4/log/log.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
L4_CV void LOG_flush(void)
{
fflush(NULL);
}
L4_CV void LOG_printf(const char *format, ...)
{
va_list list;
va_start(list, format);
vprintf(format, list);
va_end(list);
}
L4_CV void LOG_vprintf(const char *format, va_list list)
{
vprintf(format, list);
}
L4_CV void LOG_log(const char *function, const char *format, ...)
{
va_list list;
printf("%s(): ", function);
va_start(list, format);
vprintf(format, list);
va_end(list);
puts("");
}
L4_CV void LOG_logl(const char *file, int line, const char *function,
const char *format, ...)
{
va_list list;
const char *fileshort;
if ((fileshort = strstr(file, "pkg/")))
file = fileshort + 4;
printf("%s:%d:%s():\n", file, line, function);
va_start(list, format);
vprintf(format, list);
va_end(list);
puts("");
}