]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4util/lib/src/kprintf.c
16d4a7e7706c445457264da5bc27c5d6a0a56da5
[l4.git] / l4 / pkg / l4util / lib / src / kprintf.c
1 /*!
2  * \file   l4util/lib/src/kprintf.c
3  * \brief  simple(!) -- non threaded -- printf using kernel debugger output
4  *
5  * \date   04/05/2007
6  * \author Adam Lackorzynski <adam@os.inf.tu-dresden.de>
7  *
8  */
9 /*
10  * (c) 2007-2009 Author(s)
11  *     economic rights: Technische Universität Dresden (Germany)
12  * This file is part of TUD:OS and distributed under the terms of the
13  * GNU Lesser General Public License 2.1.
14  * Please see the COPYING-LGPL-2.1 file for details.
15  */
16
17 #include <stdio.h>
18 #include <stdarg.h>
19
20 #include <l4/sys/kdebug.h>
21 #include <l4/util/kprintf.h>
22
23 /* This is in the BSS on purpose to not put more load on the stack,
24  * and we know that this is suited for threading this way
25  */
26 static char buffer[500];
27
28 int l4_kprintf(const char *fmt, ...)
29 {
30   va_list list;
31   int err;
32
33   va_start(list, fmt);
34   err = vsnprintf(buffer, sizeof(buffer), fmt, list);
35   buffer[sizeof(buffer) - 1] = 0;
36   va_end(list);
37
38   outstring(buffer);
39
40   return err;
41 }