Changeset 66be0288 in mainline for uspace/lib/c/include/io/klog.h
- Timestamp:
- 2014-01-17T17:02:59Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 476f62c, facc34d
- Parents:
- 2e80321 (diff), 61b5b73d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/io/klog.h
r2e80321 r66be0288 1 1 /* 2 * Copyright (c) 20 06 Jakub Vana2 * Copyright (c) 2013 Martin Sucha 3 3 * All rights reserved. 4 4 * … … 39 39 #include <stdarg.h> 40 40 #include <io/verify.h> 41 #include <stdio.h> 42 #include <stdlib.h> 43 #include <str.h> 44 #include <abi/log.h> 41 45 42 extern size_t klog_write(const void *, size_t); 43 extern void klog_update(void); 44 extern void klog_command(const void *, size_t); 45 extern int klog_printf(const char *, ...) 46 PRINTF_ATTRIBUTE(1, 2); 47 extern int klog_vprintf(const char *, va_list); 46 extern size_t klog_write(log_level_t, const void *, size_t); 47 extern int klog_read(void *, size_t); 48 49 #define KLOG_PRINTF(lvl, fmt, ...) ({ \ 50 char *_fmt = str_dup(fmt); \ 51 size_t _fmtsize = str_size(_fmt); \ 52 if (_fmtsize > 0 && _fmt[_fmtsize - 1] == '\n') \ 53 _fmt[_fmtsize - 1] = 0; \ 54 char *_s; \ 55 int _c = asprintf(&_s, _fmt, ##__VA_ARGS__); \ 56 free(_fmt); \ 57 if (_c >= 0) { \ 58 _c = klog_write((lvl), _s, str_size(_s)); \ 59 free(_s); \ 60 }; \ 61 (_c >= 0); \ 62 }) 48 63 49 64 #endif
Note:
See TracChangeset
for help on using the changeset viewer.