]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4util/lib/src/kprintf.c
96ded23d70c1cf92fc6862e5ced1d6441c59397a
[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 Technische Universität Dresden
11  * This file is part of TUD:OS and distributed under the terms of the
12  * GNU Lesser General Public License 2.1.
13  * Please see the COPYING-LGPL-2.1 file for details.
14  */
15
16 #include <stdio.h>
17 #include <stdarg.h>
18
19 #include <l4/sys/kdebug.h>
20 #include <l4/util/kprintf.h>
21
22 /* This is in the BSS on purpose to not put more load on the stack,
23  * and we know that this is suited for threading this way
24  */
25 static char buffer[500];
26
27 int l4_kprintf(const char *fmt, ...)
28 {
29   va_list list;
30   int err;
31
32   va_start(list, fmt);
33   err = vsnprintf(buffer, sizeof(buffer), fmt, list);
34   buffer[sizeof(buffer) - 1] = 0;
35   va_end(list);
36
37   outstring(buffer);
38
39   return err;
40 }