source: mainline/uspace/lib/c/include/io/klog.h@ cd1e3fc0

Last change on this file since cd1e3fc0 was d7f7a4a, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 3 years ago

Replace some license headers with SPDX identifier

Headers are replaced using tools/transorm-copyright.sh only
when it can be matched verbatim with the license header used
throughout most of the codebase.

  • Property mode set to 100644
File size: 684 bytes
Line 
1/*
2 * SPDX-FileCopyrightText: 2013 Martin Sucha
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7/** @addtogroup libc
8 * @{
9 */
10/** @file
11 */
12
13#ifndef _LIBC_IO_KLOG_H_
14#define _LIBC_IO_KLOG_H_
15
16#include <stddef.h>
17#include <stdarg.h>
18#include <io/verify.h>
19#include <stdio.h>
20#include <stdlib.h>
21#include <str.h>
22#include <abi/log.h>
23
24extern errno_t klog_write(log_level_t, const void *, size_t);
25extern errno_t klog_read(void *, size_t, size_t *);
26
27#define KLOG_PRINTF(lvl, fmt, ...) ({ \
28 char *_s; \
29 errno_t _rc = ENOMEM; \
30 if (asprintf(&_s, fmt, ##__VA_ARGS__) >= 0) { \
31 _rc = klog_write((lvl), _s, str_size(_s)); \
32 free(_s); \
33 }; \
34 (_rc != EOK); \
35})
36
37#endif
38
39/** @}
40 */
Note: See TracBrowser for help on using the repository browser.