Changes in kernel/generic/src/log/log.c [163e34c:28a5ebd] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/log/log.c
r163e34c r28a5ebd 33 33 */ 34 34 35 #include < abi/log.h>36 #include < arch.h>37 #include < atomic.h>38 #include < console/console.h>35 #include <sysinfo/sysinfo.h> 36 #include <synch/spinlock.h> 37 #include <typedefs.h> 38 #include <ddi/irq.h> 39 39 #include <ddi/ddi.h> 40 #include <ddi/irq.h>41 #include <errno.h>42 40 #include <ipc/event.h> 43 41 #include <ipc/irq.h> 42 #include <arch.h> 43 #include <panic.h> 44 #include <putchar.h> 45 #include <atomic.h> 46 #include <syscall/copy.h> 47 #include <errno.h> 48 #include <str.h> 49 #include <print.h> 50 #include <printf/printf_core.h> 51 #include <stdarg.h> 44 52 #include <log.h> 45 #include <panic.h> 46 #include <print.h> 47 #include <printf_core.h> 48 #include <putchar.h> 49 #include <stdarg.h> 53 #include <console/console.h> 54 #include <abi/log.h> 50 55 #include <stdlib.h> 51 #include <str.h>52 #include <synch/spinlock.h>53 #include <syscall/copy.h>54 #include <sysinfo/sysinfo.h>55 #include <typedefs.h>56 56 57 57 #define LOG_PAGES 8 … … 151 151 void log_begin(log_facility_t fac, log_level_t level) 152 152 { 153 console_lock();154 153 spinlock_lock(&log_lock); 155 154 spinlock_lock(&kio_lock); … … 187 186 kio_update(NULL); 188 187 log_update(NULL); 189 console_unlock();190 188 } 191 189 … … 204 202 { 205 203 size_t offset = 0; 206 207 while (offset < size) 204 size_t chars = 0; 205 206 while (offset < size) { 208 207 kio_push_char(str_decode(str, &offset, size)); 208 chars++; 209 } 209 210 210 211 log_append((const uint8_t *)str, size); 211 212 212 return EOK; 213 return chars; 214 } 215 216 static int log_printf_wstr_write(const char32_t *wstr, size_t size, void *data) 217 { 218 char buffer[16]; 219 size_t offset = 0; 220 size_t chars = 0; 221 222 for (offset = 0; offset < size; offset += sizeof(char32_t), chars++) { 223 kio_push_char(wstr[chars]); 224 225 size_t buffer_offset = 0; 226 errno_t rc = chr_encode(wstr[chars], buffer, &buffer_offset, 16); 227 if (rc != EOK) { 228 return EOF; 229 } 230 231 log_append((const uint8_t *)buffer, buffer_offset); 232 } 233 234 return chars; 213 235 } 214 236 … … 219 241 int log_vprintf(const char *fmt, va_list args) 220 242 { 243 int ret; 244 221 245 printf_spec_t ps = { 222 246 log_printf_str_write, 247 log_printf_wstr_write, 223 248 NULL 224 249 }; 225 250 226 return printf_core(fmt, &ps, args); 251 ret = printf_core(fmt, &ps, args); 252 253 return ret; 227 254 } 228 255
Note:
See TracChangeset
for help on using the changeset viewer.