Changes in / [fd07e57b:aacdb8e] in mainline
- Files:
-
- 3 added
- 11 deleted
- 62 edited
Legend:
- Unmodified
- Added
- Removed
-
.bzrignore
rfd07e57b raacdb8e 33 33 uspace/app/kill/kill 34 34 uspace/app/killall/killall 35 uspace/app/k io/kio35 uspace/app/klog/klog 36 36 uspace/app/loc/loc 37 37 uspace/app/logset/logset … … 82 82 uspace/dist/app/kill 83 83 uspace/dist/app/killall 84 uspace/dist/app/k io84 uspace/dist/app/klog 85 85 uspace/dist/app/loc 86 86 uspace/dist/app/logset … … 285 285 uspace/lib/posix/redefs-hide-libc-symbols.list 286 286 uspace/lib/posix/redefs-show-posix-symbols.list 287 uspace/srv/klog/klog288 uspace/dist/srv/klog -
abi/include/abi/ipc/event.h
rfd07e57b raacdb8e 38 38 /** Global events */ 39 39 typedef enum event_type { 40 /** New data available in kernel character buffer*/41 EVENT_K IO= 0,40 /** New data available in kernel log */ 41 EVENT_KLOG = 0, 42 42 /** Returning from kernel console to uspace */ 43 43 EVENT_KCONSOLE, 44 44 /** A task/thread has faulted and will be terminated */ 45 45 EVENT_FAULT, 46 /** New data available in kernel log */47 EVENT_KLOG,48 46 EVENT_END 49 47 } event_type_t; -
abi/include/abi/klog.h
rfd07e57b raacdb8e 1 1 /* 2 * Copyright (c) 201 4 Martin Sucha2 * Copyright (c) 2012 Jakub Jermar 3 3 * All rights reserved. 4 4 * … … 36 36 #define ABI_KLOG_H_ 37 37 38 typedef enum { 38 enum { 39 KLOG_UNKNOW, 39 40 KLOG_WRITE, 40 KLOG_READ 41 } klog_operation_t; 41 KLOG_UPDATE, 42 KLOG_COMMAND 43 }; 42 44 43 45 #endif -
abi/include/abi/syscall.h
rfd07e57b raacdb8e 37 37 38 38 typedef enum { 39 SYS_K IO= 0,39 SYS_KLOG = 0, 40 40 SYS_TLS_SET = 1, /* Hardcoded for AMD64, IA-32 (fibril.S in uspace) */ 41 41 … … 99 99 SYS_DEBUG_ACTIVATE_CONSOLE, 100 100 101 SYS_KLOG,102 103 101 SYSCALL_END 104 102 } syscall_t; -
boot/Makefile.common
rfd07e57b raacdb8e 96 96 $(USPACE_PATH)/srv/devman/devman \ 97 97 $(USPACE_PATH)/srv/fs/locfs/locfs \ 98 $(USPACE_PATH)/srv/hid/compositor/compositor \ 99 $(USPACE_PATH)/srv/klog/klog 98 $(USPACE_PATH)/srv/hid/compositor/compositor 100 99 101 100 RD_SRVS_NON_ESSENTIAL = \ … … 162 161 $(USPACE_PATH)/app/bdsh/bdsh \ 163 162 $(USPACE_PATH)/app/getterm/getterm \ 164 $(USPACE_PATH)/app/k io/kio\163 $(USPACE_PATH)/app/klog/klog \ 165 164 $(USPACE_PATH)/app/vlaunch/vlaunch \ 166 165 $(USPACE_PATH)/app/vterm/vterm -
contrib/arch/HelenOS.adl
rfd07e57b raacdb8e 22 22 23 23 /* Kernel log */ 24 inst k io kio;24 inst klog klog; 25 25 26 26 [/uspace/lib/libc/bind%ns] … … 30 30 [/uspace/lib/libc/bind%vfs] 31 31 [/uspace/lib/libc/bind%console] 32 [/uspace/lib/libc/bind%k io]32 [/uspace/lib/libc/bind%klog] 33 33 34 34 bind ns:kbd to console:kbd; … … 58 58 bind console:sys_console to kernel:sys_console; 59 59 60 bind k io:ns to ns:ns;60 bind klog:ns to ns:ns; 61 61 }; -
contrib/arch/kernel/kernel.adl
rfd07e57b raacdb8e 3 3 *****************************/ 4 4 5 interface sys_k io{5 interface sys_klog { 6 6 /* Print using kernel facility */ 7 sysarg_t sys_k io(int fd, const void *buf, size_t size);8 protocol: 9 ?sys_k io*7 sysarg_t sys_klog(int fd, const void *buf, size_t size); 8 protocol: 9 ?sys_klog* 10 10 }; 11 11 … … 251 251 frame sys_console { 252 252 provides: 253 sys_k io sys_kio;253 sys_klog sys_klog; 254 254 sys_console sys_console; 255 255 }; … … 316 316 inst sys_debug sys_debug; 317 317 318 delegate sys_k io to sys_console:sys_kio;318 delegate sys_klog to sys_console:sys_klog; 319 319 delegate sys_console to sys_console:sys_console; 320 320 delegate sys_tls to sys_proc:sys_tls; -
contrib/arch/uspace/lib/libc/bind
rfd07e57b raacdb8e 1 1 /* Bind %% to kernel interfaces */ 2 bind %%:sys_k io to kernel:sys_kio;2 bind %%:sys_klog to kernel:sys_klog; 3 3 bind %%:sys_tls to kernel:sys_tls; 4 4 bind %%:sys_thread to kernel:sys_thread; -
contrib/arch/uspace/lib/libc/protocol
rfd07e57b raacdb8e 1 1 /* Protocol according to which libc uses kernel syscalls */ 2 2 ( 3 !sys_k io.sys_kio+3 !sys_klog.sys_klog + 4 4 !sys_tls.sys_tls_set + 5 5 !sys_thread.sys_thread_create + -
contrib/arch/uspace/lib/libc/requires
rfd07e57b raacdb8e 1 1 /* Kernel interfaces required by libc */ 2 sys_k io sys_kio;2 sys_klog sys_klog; 3 3 sys_tls sys_tls; 4 4 sys_thread sys_thread; -
contrib/arch/uspace/lib/libc/subsume
rfd07e57b raacdb8e 1 1 /* Subsume %% to kernel interfaces */ 2 subsume %%:sys_k io to sys_kio;2 subsume %%:sys_klog to sys_klog; 3 3 subsume %%:sys_tls to sys_tls; 4 4 subsume %%:sys_thread to sys_thread; -
contrib/arch/uspace/srv/ns/ns.adl
rfd07e57b raacdb8e 6 6 sysarg_t ipc_m_connect_me_to(in sysarg_t service, in sysarg_t arg2, in sysarg_t arg3, in sysarg_t flags); 7 7 8 /* Share real-time clock page or k iopage */8 /* Share real-time clock page or klog page */ 9 9 sysarg_t ipc_m_share_in(in sysarg_t as_area_base, in sysarg_t as_area_size, in sysarg_t service); 10 10 -
kernel/Makefile
rfd07e57b raacdb8e 212 212 generic/src/debug/debug.c \ 213 213 generic/src/interrupt/interrupt.c \ 214 generic/src/log/log.c \215 214 generic/src/main/main.c \ 216 215 generic/src/main/kinit.c \ -
kernel/arch/amd64/src/interrupt.c
rfd07e57b raacdb8e 35 35 #include <arch/interrupt.h> 36 36 #include <print.h> 37 #include <log.h>38 37 #include <debug.h> 39 38 #include <panic.h> … … 67 66 void istate_decode(istate_t *istate) 68 67 { 69 log_printf("cs =%0#18" PRIx64 "\trip=%0#18" PRIx64 "\t"68 printf("cs =%0#18" PRIx64 "\trip=%0#18" PRIx64 "\t" 70 69 "rfl=%0#18" PRIx64 "\terr=%0#18" PRIx64 "\n", 71 70 istate->cs, istate->rip, istate->rflags, istate->error_word); 72 71 73 72 if (istate_from_uspace(istate)) 74 log_printf("ss =%0#18" PRIx64 "\n", istate->ss);75 76 log_printf("rax=%0#18" PRIx64 "\trbx=%0#18" PRIx64 "\t"73 printf("ss =%0#18" PRIx64 "\n", istate->ss); 74 75 printf("rax=%0#18" PRIx64 "\trbx=%0#18" PRIx64 "\t" 77 76 "rcx=%0#18" PRIx64 "\trdx=%0#18" PRIx64 "\n", 78 77 istate->rax, istate->rbx, istate->rcx, istate->rdx); 79 78 80 log_printf("rsi=%0#18" PRIx64 "\trdi=%0#18" PRIx64 "\t"79 printf("rsi=%0#18" PRIx64 "\trdi=%0#18" PRIx64 "\t" 81 80 "rbp=%0#18" PRIx64 "\trsp=%0#18" PRIx64 "\n", 82 81 istate->rsi, istate->rdi, istate->rbp, … … 84 83 (uintptr_t) &istate->rsp); 85 84 86 log_printf("r8 =%0#18" PRIx64 "\tr9 =%0#18" PRIx64 "\t"85 printf("r8 =%0#18" PRIx64 "\tr9 =%0#18" PRIx64 "\t" 87 86 "r10=%0#18" PRIx64 "\tr11=%0#18" PRIx64 "\n", 88 87 istate->r8, istate->r9, istate->r10, istate->r11); 89 88 90 log_printf("r12=%0#18" PRIx64 "\tr13=%0#18" PRIx64 "\t"89 printf("r12=%0#18" PRIx64 "\tr13=%0#18" PRIx64 "\t" 91 90 "r14=%0#18" PRIx64 "\tr15=%0#18" PRIx64 "\n", 92 91 istate->r12, istate->r13, istate->r14, istate->r15); … … 194 193 */ 195 194 #ifdef CONFIG_DEBUG 196 log(LF_ARCH, LVL_DEBUG, "cpu%u: spurious interrupt (inum=%u)", 197 CPU->id, inum); 195 printf("cpu%u: spurious interrupt (inum=%u)\n", CPU->id, inum); 198 196 #endif 199 197 } -
kernel/arch/arm32/src/mach/gta02/gta02.c
rfd07e57b raacdb8e 49 49 #include <ddi/ddi.h> 50 50 #include <ddi/device.h> 51 #include <log.h>52 51 53 52 #define GTA02_MEMORY_START 0x30000000 /* physical */ … … 150 149 } else { 151 150 /* Spurious interrupt.*/ 152 log(LF_ARCH, LVL_DEBUG, "cpu%d: spurious interrupt (inum=%d)",151 printf("cpu%d: spurious interrupt (inum=%d)\n", 153 152 CPU->id, inum); 154 153 } -
kernel/arch/arm32/src/mach/integratorcp/integratorcp.c
rfd07e57b raacdb8e 43 43 #include <console/console.h> 44 44 #include <sysinfo/sysinfo.h> 45 #include <print.h> 45 46 #include <ddi/device.h> 46 47 #include <mm/page.h> … … 52 53 #include <abi/fb/visuals.h> 53 54 #include <ddi/ddi.h> 54 #include <log.h> 55 55 #include <print.h> 56 56 57 57 … … 275 275 } else { 276 276 /* Spurious interrupt.*/ 277 log(LF_ARCH, LVL_DEBUG, 278 "cpu%d: spurious interrupt (inum=%d)", 277 printf("cpu%d: spurious interrupt (inum=%d)\n", 279 278 CPU->id, i); 280 279 } -
kernel/arch/ia32/src/drivers/i8259.c
rfd07e57b raacdb8e 42 42 #include <arch/asm.h> 43 43 #include <arch.h> 44 #include < log.h>44 #include <print.h> 45 45 #include <interrupt.h> 46 46 … … 129 129 { 130 130 #ifdef CONFIG_DEBUG 131 log(LF_ARCH, LVL_DEBUG, "cpu%u: PIC spurious interrupt", CPU->id);131 printf("cpu%u: PIC spurious interrupt\n", CPU->id); 132 132 #endif 133 133 } -
kernel/arch/ia32/src/smp/apic.c
rfd07e57b raacdb8e 42 42 #include <interrupt.h> 43 43 #include <arch/interrupt.h> 44 #include < log.h>44 #include <print.h> 45 45 #include <arch/asm.h> 46 46 #include <arch.h> … … 135 135 { 136 136 #ifdef CONFIG_DEBUG 137 log(LF_ARCH, LVL_DEBUG, "cpu%u: APIC spurious interrupt", CPU->id);137 printf("cpu%u: APIC spurious interrupt\n", CPU->id); 138 138 #endif 139 139 } … … 241 241 esr.value = l_apic[ESR]; 242 242 243 if (esr.err_bitmap) { 244 log_begin(LF_ARCH, LVL_ERROR); 245 log_printf("APIC errors detected:"); 246 if (esr.send_checksum_error) 247 log_printf("\nSend Checksum Error"); 248 if (esr.receive_checksum_error) 249 log_printf("\nReceive Checksum Error"); 250 if (esr.send_accept_error) 251 log_printf("\nSend Accept Error"); 252 if (esr.receive_accept_error) 253 log_printf("\nReceive Accept Error"); 254 if (esr.send_illegal_vector) 255 log_printf("\nSend Illegal Vector"); 256 if (esr.received_illegal_vector) 257 log_printf("\nReceived Illegal Vector"); 258 if (esr.illegal_register_address) 259 log_printf("\nIllegal Register Address"); 260 log_end(); 261 } 243 if (esr.send_checksum_error) 244 printf("Send Checksum Error\n"); 245 if (esr.receive_checksum_error) 246 printf("Receive Checksum Error\n"); 247 if (esr.send_accept_error) 248 printf("Send Accept Error\n"); 249 if (esr.receive_accept_error) 250 printf("Receive Accept Error\n"); 251 if (esr.send_illegal_vector) 252 printf("Send Illegal Vector\n"); 253 if (esr.received_illegal_vector) 254 printf("Received Illegal Vector\n"); 255 if (esr.illegal_register_address) 256 printf("Illegal Register Address\n"); 262 257 263 258 return !esr.err_bitmap; … … 275 270 retries = 0; 276 271 #ifdef CONFIG_DEBUG 277 log(LF_ARCH, LVL_DEBUG, "IPI is pending.");272 printf("IPI is pending.\n"); 278 273 #endif 279 274 delay(20); … … 494 489 { 495 490 #ifdef LAPIC_VERBOSE 496 log_begin(LF_ARCH, LVL_DEBUG); 497 log_printf("LVT on cpu%u, LAPIC ID: %" PRIu8 "\n", 491 printf("LVT on cpu%u, LAPIC ID: %" PRIu8 "\n", 498 492 CPU->id, l_apic_id()); 499 493 500 494 lvt_tm_t tm; 501 495 tm.value = l_apic[LVT_Tm]; 502 log_printf("LVT Tm: vector=%" PRIu8 ", %s, %s, %s\n",496 printf("LVT Tm: vector=%" PRIu8 ", %s, %s, %s\n", 503 497 tm.vector, delivs_str[tm.delivs], mask_str[tm.masked], 504 498 tm_mode_str[tm.mode]); … … 506 500 lvt_lint_t lint; 507 501 lint.value = l_apic[LVT_LINT0]; 508 log_printf("LVT LINT0: vector=%" PRIu8 ", %s, %s, %s, irr=%u, %s, %s\n",502 printf("LVT LINT0: vector=%" PRIu8 ", %s, %s, %s, irr=%u, %s, %s\n", 509 503 tm.vector, delmod_str[lint.delmod], delivs_str[lint.delivs], 510 504 intpol_str[lint.intpol], lint.irr, trigmod_str[lint.trigger_mode], … … 512 506 513 507 lint.value = l_apic[LVT_LINT1]; 514 log_printf("LVT LINT1: vector=%" PRIu8 ", %s, %s, %s, irr=%u, %s, %s\n",508 printf("LVT LINT1: vector=%" PRIu8 ", %s, %s, %s, irr=%u, %s, %s\n", 515 509 tm.vector, delmod_str[lint.delmod], delivs_str[lint.delivs], 516 510 intpol_str[lint.intpol], lint.irr, trigmod_str[lint.trigger_mode], … … 519 513 lvt_error_t error; 520 514 error.value = l_apic[LVT_Err]; 521 log_printf("LVT Err: vector=%" PRIu8 ", %s, %s\n", error.vector,515 printf("LVT Err: vector=%" PRIu8 ", %s, %s\n", error.vector, 522 516 delivs_str[error.delivs], mask_str[error.masked]); 523 log_end();524 517 #endif 525 518 } -
kernel/arch/ia32/src/smp/mps.c
rfd07e57b raacdb8e 36 36 37 37 #include <config.h> 38 #include < log.h>38 #include <print.h> 39 39 #include <debug.h> 40 40 #include <arch/smp/mps.h> … … 181 181 buf[6] = 0; 182 182 183 log(LF_ARCH, LVL_DEBUG, "MPS: bus=%" PRIu8 " (%s)", bus->bus_id, buf);183 printf("MPS: bus=%" PRIu8 " (%s)\n", bus->bus_id, buf); 184 184 #endif 185 185 } … … 205 205 { 206 206 #ifdef MPSCT_VERBOSE 207 log_begin(LF_ARCH, LVL_DEBUG); 208 log_printf("MPS: "); 207 printf("MPS: "); 209 208 210 209 switch (iointr->intr_type) { 211 210 case 0: 212 log_printf("INT");213 break; 214 case 1: 215 log_printf("NMI");216 break; 217 case 2: 218 log_printf("SMI");219 break; 220 case 3: 221 log_printf("ExtINT");222 break; 223 } 224 225 log_printf(", ");211 printf("INT"); 212 break; 213 case 1: 214 printf("NMI"); 215 break; 216 case 2: 217 printf("SMI"); 218 break; 219 case 3: 220 printf("ExtINT"); 221 break; 222 } 223 224 printf(", "); 226 225 227 226 switch (iointr->poel & 3) { 228 227 case 0: 229 log_printf("bus-like");230 break; 231 case 1: 232 log_printf("active high");233 break; 234 case 2: 235 log_printf("reserved");236 break; 237 case 3: 238 log_printf("active low");239 break; 240 } 241 242 log_printf(", ");228 printf("bus-like"); 229 break; 230 case 1: 231 printf("active high"); 232 break; 233 case 2: 234 printf("reserved"); 235 break; 236 case 3: 237 printf("active low"); 238 break; 239 } 240 241 printf(", "); 243 242 244 243 switch ((iointr->poel >> 2) & 3) { 245 244 case 0: 246 log_printf("bus-like");247 break; 248 case 1: 249 log_printf("edge-triggered");250 break; 251 case 2: 252 log_printf("reserved");253 break; 254 case 3: 255 log_printf("level-triggered");256 break; 257 } 258 259 log_printf(", bus=%" PRIu8 " irq=%" PRIu8 " io_apic=%" PRIu8" pin=%"260 PRIu8 , iointr->src_bus_id, iointr->src_bus_irq,245 printf("bus-like"); 246 break; 247 case 1: 248 printf("edge-triggered"); 249 break; 250 case 2: 251 printf("reserved"); 252 break; 253 case 3: 254 printf("level-triggered"); 255 break; 256 } 257 258 printf(", bus=%" PRIu8 " irq=%" PRIu8 " io_apic=%" PRIu8" pin=%" 259 PRIu8 "\n", iointr->src_bus_id, iointr->src_bus_irq, 261 260 iointr->dst_io_apic_id, iointr->dst_io_apic_pin); 262 log_end();263 261 #endif 264 262 } … … 268 266 { 269 267 #ifdef MPSCT_VERBOSE 270 log_begin(LF_ARCH, LVL_DEBUG); 271 log_printf("MPS: "); 268 printf("MPS: "); 272 269 273 270 switch (lintr->intr_type) { 274 271 case 0: 275 log_printf("INT");276 break; 277 case 1: 278 log_printf("NMI");279 break; 280 case 2: 281 log_printf("SMI");282 break; 283 case 3: 284 log_printf("ExtINT");285 break; 286 } 287 288 log_printf(", ");272 printf("INT"); 273 break; 274 case 1: 275 printf("NMI"); 276 break; 277 case 2: 278 printf("SMI"); 279 break; 280 case 3: 281 printf("ExtINT"); 282 break; 283 } 284 285 printf(", "); 289 286 290 287 switch (lintr->poel & 3) { 291 288 case 0: 292 log_printf("bus-like");293 break; 294 case 1: 295 log_printf("active high");296 break; 297 case 2: 298 log_printf("reserved");299 break; 300 case 3: 301 log_printf("active low");302 break; 303 } 304 305 log_printf(", ");289 printf("bus-like"); 290 break; 291 case 1: 292 printf("active high"); 293 break; 294 case 2: 295 printf("reserved"); 296 break; 297 case 3: 298 printf("active low"); 299 break; 300 } 301 302 printf(", "); 306 303 307 304 switch ((lintr->poel >> 2) & 3) { 308 305 case 0: 309 log_printf("bus-like");310 break; 311 case 1: 312 log_printf("edge-triggered");313 break; 314 case 2: 315 log_printf("reserved");316 break; 317 case 3: 318 log_printf("level-triggered");319 break; 320 } 321 322 log_printf(", bus=%" PRIu8 " irq=%" PRIu8 " l_apic=%" PRIu8" pin=%"323 PRIu8 , lintr->src_bus_id, lintr->src_bus_irq,306 printf("bus-like"); 307 break; 308 case 1: 309 printf("edge-triggered"); 310 break; 311 case 2: 312 printf("reserved"); 313 break; 314 case 3: 315 printf("level-triggered"); 316 break; 317 } 318 319 printf(", bus=%" PRIu8 " irq=%" PRIu8 " l_apic=%" PRIu8" pin=%" 320 PRIu8 "\n", lintr->src_bus_id, lintr->src_bus_irq, 324 321 lintr->dst_l_apic_id, lintr->dst_l_apic_pin); 325 log_end();326 322 #endif 327 323 } … … 336 332 switch (cur[CT_EXT_ENTRY_TYPE]) { 337 333 default: 338 log(LF_ARCH, LVL_NOTE, "MPS: Skipping MP Configuration" 339 " Table extended entry type %" PRIu8, 340 cur[CT_EXT_ENTRY_TYPE]); 334 printf("MPS: Skipping MP Configuration Table extended " 335 "entry type %" PRIu8 "\n", cur[CT_EXT_ENTRY_TYPE]); 341 336 } 342 337 } … … 346 341 { 347 342 if (ct->signature != CT_SIGNATURE) { 348 log(LF_ARCH, LVL_WARN, "MPS: Wrong ct->signature");343 printf("MPS: Wrong ct->signature\n"); 349 344 return; 350 345 } 351 346 352 347 if (!mps_ct_check()) { 353 log(LF_ARCH, LVL_WARN, "MPS: Wrong ct checksum");348 printf("MPS: Wrong ct checksum\n"); 354 349 return; 355 350 } 356 351 357 352 if (ct->oem_table) { 358 log(LF_ARCH, LVL_WARN, "MPS: ct->oem_table not supported");353 printf("MPS: ct->oem_table not supported\n"); 359 354 return; 360 355 } … … 407 402 * Something is wrong. Fallback to UP mode. 408 403 */ 409 log(LF_ARCH, LVL_WARN, "MPS: ct badness %" PRIu8, *cur);404 printf("MPS: ct badness %" PRIu8 "\n", *cur); 410 405 return; 411 406 } … … 423 418 * Not yet implemented. 424 419 */ 425 log(LF_ARCH, LVL_WARN, "MPS: Default configuration not supported");420 printf("MPS: Default configuration not supported\n"); 426 421 } 427 422 … … 454 449 455 450 fs_found: 456 log(LF_ARCH, LVL_NOTE, "%p: MPS Floating Pointer Structure", fs);451 printf("%p: MPS Floating Pointer Structure\n", fs); 457 452 458 453 if ((fs->config_type == 0) && (fs->configuration_table)) { 459 454 if (fs->mpfib2 >> 7) { 460 log(LF_ARCH, LVL_WARN,"MPS: PIC mode not supported\n");455 printf("MPS: PIC mode not supported\n"); 461 456 return; 462 457 } -
kernel/arch/ia32/src/smp/smp.c
rfd07e57b raacdb8e 52 52 #include <mm/slab.h> 53 53 #include <mm/as.h> 54 #include < log.h>54 #include <print.h> 55 55 #include <memstr.h> 56 56 #include <arch/drivers/i8259.h> … … 129 129 130 130 if (ops->cpu_apic_id(i) == bsp_l_apic) { 131 log(LF_ARCH, LVL_ERROR, "kmp: bad processor entry #%u,"132 " will not send IPI to myself", i);131 printf("kmp: bad processor entry #%u, will not send IPI " 132 "to myself\n", i); 133 133 continue; 134 134 } … … 162 162 if (waitq_sleep_timeout(&ap_completion_wq, 1000000, 163 163 SYNCH_FLAGS_NONE) == ESYNCH_TIMEOUT) { 164 log(LF_ARCH, LVL_NOTE, "%s: waiting for cpu%u"165 " (APIC ID = %d) timed out", __FUNCTION__,166 i,ops->cpu_apic_id(i));164 printf("%s: waiting for cpu%u (APIC ID = %d) " 165 "timed out\n", __FUNCTION__, i, 166 ops->cpu_apic_id(i)); 167 167 } 168 168 } else 169 log(LF_ARCH, LVL_ERROR, "INIT IPI for l_apic%d failed",169 printf("INIT IPI for l_apic%d failed\n", 170 170 ops->cpu_apic_id(i)); 171 171 } -
kernel/arch/mips32/src/debugger.c
rfd07e57b raacdb8e 39 39 #include <console/cmd.h> 40 40 #include <print.h> 41 #include <log.h>42 41 #include <panic.h> 43 42 #include <arch.h> … … 295 294 cmd_initialize(&bkpts_info); 296 295 if (!cmd_register(&bkpts_info)) 297 log(LF_OTHER, LVL_WARN, "Cannot register command %s", 298 bkpts_info.name); 296 printf("Cannot register command %s\n", bkpts_info.name); 299 297 300 298 cmd_initialize(&delbkpt_info); 301 299 if (!cmd_register(&delbkpt_info)) 302 log(LF_OTHER, LVL_WARN, "Cannot register command %s", 303 delbkpt_info.name); 300 printf("Cannot register command %s\n", delbkpt_info.name); 304 301 305 302 cmd_initialize(&addbkpt_info); 306 303 if (!cmd_register(&addbkpt_info)) 307 log(LF_OTHER, LVL_WARN, "Cannot register command %s", 308 addbkpt_info.name); 304 printf("Cannot register command %s\n", addbkpt_info.name); 309 305 310 306 cmd_initialize(&addbkpte_info); 311 307 if (!cmd_register(&addbkpte_info)) 312 log(LF_OTHER, LVL_WARN, "Cannot register command %s", 313 addbkpte_info.name); 308 printf("Cannot register command %s\n", addbkpte_info.name); 314 309 #endif /* CONFIG_KCONSOLE */ 315 310 } -
kernel/arch/mips32/src/exception.c
rfd07e57b raacdb8e 48 48 #include <arch/debugger.h> 49 49 #include <symtab.h> 50 #include <log.h>51 50 52 51 static const char *exctable[] = { … … 75 74 void istate_decode(istate_t *istate) 76 75 { 77 log_printf("epc=%#010" PRIx32 "\tsta=%#010" PRIx32 "\t"76 printf("epc=%#010" PRIx32 "\tsta=%#010" PRIx32 "\t" 78 77 "lo =%#010" PRIx32 "\thi =%#010" PRIx32 "\n", 79 78 istate->epc, istate->status, istate->lo, istate->hi); 80 79 81 log_printf("a0 =%#010" PRIx32 "\ta1 =%#010" PRIx32 "\t"80 printf("a0 =%#010" PRIx32 "\ta1 =%#010" PRIx32 "\t" 82 81 "a2 =%#010" PRIx32 "\ta3 =%#010" PRIx32 "\n", 83 82 istate->a0, istate->a1, istate->a2, istate->a3); 84 83 85 log_printf("t0 =%#010" PRIx32 "\tt1 =%#010" PRIx32 "\t"84 printf("t0 =%#010" PRIx32 "\tt1 =%#010" PRIx32 "\t" 86 85 "t2 =%#010" PRIx32 "\tt3 =%#010" PRIx32 "\n", 87 86 istate->t0, istate->t1, istate->t2, istate->t3); 88 87 89 log_printf("t4 =%#010" PRIx32 "\tt5 =%#010" PRIx32 "\t"88 printf("t4 =%#010" PRIx32 "\tt5 =%#010" PRIx32 "\t" 90 89 "t6 =%#010" PRIx32 "\tt7 =%#010" PRIx32 "\n", 91 90 istate->t4, istate->t5, istate->t6, istate->t7); 92 91 93 log_printf("t8 =%#010" PRIx32 "\tt9 =%#010" PRIx32 "\t"92 printf("t8 =%#010" PRIx32 "\tt9 =%#010" PRIx32 "\t" 94 93 "v0 =%#010" PRIx32 "\tv1 =%#010" PRIx32 "\n", 95 94 istate->t8, istate->t9, istate->v0, istate->v1); 96 95 97 log_printf("s0 =%#010" PRIx32 "\ts1 =%#010" PRIx32 "\t"96 printf("s0 =%#010" PRIx32 "\ts1 =%#010" PRIx32 "\t" 98 97 "s2 =%#010" PRIx32 "\ts3 =%#010" PRIx32 "\n", 99 98 istate->s0, istate->s1, istate->s2, istate->s3); 100 99 101 log_printf("s4 =%#010" PRIx32 "\ts5 =%#010" PRIx32 "\t"100 printf("s4 =%#010" PRIx32 "\ts5 =%#010" PRIx32 "\t" 102 101 "s6 =%#010" PRIx32 "\ts7 =%#010" PRIx32 "\n", 103 102 istate->s4, istate->s5, istate->s6, istate->s7); 104 103 105 log_printf("s8 =%#010" PRIx32 "\tat =%#010" PRIx32 "\t"104 printf("s8 =%#010" PRIx32 "\tat =%#010" PRIx32 "\t" 106 105 "kt0=%#010" PRIx32 "\tkt1=%#010" PRIx32 "\n", 107 106 istate->s8, istate->at, istate->kt0, istate->kt1); 108 107 109 log_printf("sp =%#010" PRIx32 "\tra =%#010" PRIx32 "\t"108 printf("sp =%#010" PRIx32 "\tra =%#010" PRIx32 "\t" 110 109 "gp =%#010" PRIx32 "\n", 111 110 istate->sp, istate->ra, istate->gp); … … 195 194 */ 196 195 #ifdef CONFIG_DEBUG 197 log(LF_ARCH, LVL_DEBUG, 198 "cpu%u: spurious interrupt (inum=%u)", 196 printf("cpu%u: spurious interrupt (inum=%u)\n", 199 197 CPU->id, i); 200 198 #endif -
kernel/arch/mips32/src/mm/tlb.c
rfd07e57b raacdb8e 43 43 #include <synch/mutex.h> 44 44 #include <print.h> 45 #include <log.h>46 45 #include <debug.h> 47 46 #include <align.h> … … 218 217 */ 219 218 if (index.p) { 220 log(LF_ARCH, LVL_WARN,"%s: TLBP failed in exception handler (badvaddr=%#"219 printf("%s: TLBP failed in exception handler (badvaddr=%#" 221 220 PRIxn ", ASID=%d).\n", __func__, badvaddr, 222 221 AS ? AS->asid : -1); -
kernel/arch/ppc32/src/interrupt.c
rfd07e57b raacdb8e 44 44 #include <arch/mm/pht.h> 45 45 #include <print.h> 46 #include <log.h>47 46 48 47 void start_decrementer(void) … … 56 55 void istate_decode(istate_t *istate) 57 56 { 58 log_printf("r0 =%0#10" PRIx32 "\tr1 =%0#10" PRIx32 "\t"57 printf("r0 =%0#10" PRIx32 "\tr1 =%0#10" PRIx32 "\t" 59 58 "r2 =%0#10" PRIx32 "\n", istate->r0, istate->sp, istate->r2); 60 59 61 log_printf("r3 =%0#10" PRIx32 "\tr4 =%0#10" PRIx32 "\t"60 printf("r3 =%0#10" PRIx32 "\tr4 =%0#10" PRIx32 "\t" 62 61 "r5 =%0#10" PRIx32 "\n", istate->r3, istate->r4, istate->r5); 63 62 64 log_printf("r6 =%0#10" PRIx32 "\tr7 =%0#10" PRIx32 "\t"63 printf("r6 =%0#10" PRIx32 "\tr7 =%0#10" PRIx32 "\t" 65 64 "r8 =%0#10" PRIx32 "\n", istate->r6, istate->r7, istate->r8); 66 65 67 log_printf("r9 =%0#10" PRIx32 "\tr10=%0#10" PRIx32 "\t"66 printf("r9 =%0#10" PRIx32 "\tr10=%0#10" PRIx32 "\t" 68 67 "r11=%0#10" PRIx32 "\n", istate->r9, istate->r10, istate->r11); 69 68 70 log_printf("r12=%0#10" PRIx32 "\tr13=%0#10" PRIx32 "\t"69 printf("r12=%0#10" PRIx32 "\tr13=%0#10" PRIx32 "\t" 71 70 "r14=%0#10" PRIx32 "\n", istate->r12, istate->r13, istate->r14); 72 71 73 log_printf("r15=%0#10" PRIx32 "\tr16=%0#10" PRIx32 "\t"72 printf("r15=%0#10" PRIx32 "\tr16=%0#10" PRIx32 "\t" 74 73 "r17=%0#10" PRIx32 "\n", istate->r15, istate->r16, istate->r17); 75 74 76 log_printf("r18=%0#10" PRIx32 "\tr19=%0#10" PRIx32 "\t"75 printf("r18=%0#10" PRIx32 "\tr19=%0#10" PRIx32 "\t" 77 76 "r20=%0#10" PRIx32 "\n", istate->r18, istate->r19, istate->r20); 78 77 79 log_printf("r21=%0#10" PRIx32 "\tr22=%0#10" PRIx32 "\t"78 printf("r21=%0#10" PRIx32 "\tr22=%0#10" PRIx32 "\t" 80 79 "r23=%0#10" PRIx32 "\n", istate->r21, istate->r22, istate->r23); 81 80 82 log_printf("r24=%0#10" PRIx32 "\tr25=%0#10" PRIx32 "\t"81 printf("r24=%0#10" PRIx32 "\tr25=%0#10" PRIx32 "\t" 83 82 "r26=%0#10" PRIx32 "\n", istate->r24, istate->r25, istate->r26); 84 83 85 log_printf("r27=%0#10" PRIx32 "\tr28=%0#10" PRIx32 "\t"84 printf("r27=%0#10" PRIx32 "\tr28=%0#10" PRIx32 "\t" 86 85 "r29=%0#10" PRIx32 "\n", istate->r27, istate->r28, istate->r29); 87 86 88 log_printf("r30=%0#10" PRIx32 "\tr31=%0#10" PRIx32 "\n",87 printf("r30=%0#10" PRIx32 "\tr31=%0#10" PRIx32 "\n", 89 88 istate->r30, istate->r31); 90 89 91 log_printf("cr =%0#10" PRIx32 "\tpc =%0#10" PRIx32 "\t"90 printf("cr =%0#10" PRIx32 "\tpc =%0#10" PRIx32 "\t" 92 91 "lr =%0#10" PRIx32 "\n", istate->cr, istate->pc, istate->lr); 93 92 94 log_printf("ctr=%0#10" PRIx32 "\txer=%0#10" PRIx32 "\t"93 printf("ctr=%0#10" PRIx32 "\txer=%0#10" PRIx32 "\t" 95 94 "dar=%0#10" PRIx32 "\n", istate->ctr, istate->xer, istate->dar); 96 95 97 log_printf("srr1=%0#10" PRIx32 "\n", istate->srr1);96 printf("srr1=%0#10" PRIx32 "\n", istate->srr1); 98 97 } 99 98 … … 131 130 */ 132 131 #ifdef CONFIG_DEBUG 133 log(LF_ARCH, LVL_DEBUG, "cpu%u: spurious interrupt"134 " (inum=%" PRIu8 ")",CPU->id, inum);132 printf("cpu%u: spurious interrupt (inum=%" PRIu8 ")\n", 133 CPU->id, inum); 135 134 #endif 136 135 } -
kernel/arch/sparc64/src/drivers/kbd.c
rfd07e57b raacdb8e 44 44 #include <align.h> 45 45 #include <str.h> 46 #include < log.h>46 #include <print.h> 47 47 #include <sysinfo/sysinfo.h> 48 48 … … 71 71 ofw_tree_property_t *prop = ofw_tree_getprop(node, "interrupts"); 72 72 if ((!prop) || (!prop->value)) { 73 log(LF_ARCH, LVL_ERROR, 74 "ns16550: Unable to find interrupts property"); 73 printf("ns16550: Unable to find interrupts property\n"); 75 74 return false; 76 75 } … … 83 82 prop = ofw_tree_getprop(node, "reg"); 84 83 if ((!prop) || (!prop->value)) { 85 log(LF_ARCH, LVL_ERROR, 86 "ns16550: Unable to find reg property"); 84 printf("ns16550: Unable to find reg property\n"); 87 85 return false; 88 86 } … … 93 91 if (!ofw_ebus_apply_ranges(node->parent, 94 92 ((ofw_ebus_reg_t *) prop->value), &pa)) { 95 log(LF_ARCH, LVL_ERROR, 96 "ns16550: Failed to determine address"); 93 printf("ns16550: Failed to determine address\n"); 97 94 return false; 98 95 } … … 104 101 ((ofw_ebus_reg_t *) prop->value), interrupts, &inr, &cir, 105 102 &cir_arg)) { 106 log(LF_ARCH, LVL_ERROR, 107 "ns16550: Failed to determine interrupt"); 103 printf("ns16550: Failed to determine interrupt\n"); 108 104 return false; 109 105 } … … 121 117 PAGE_WRITE | PAGE_NOT_CACHEABLE) + offset); 122 118 123 ns16550_instance_t *ns16550_instance = ns16550_init(ns16550, inr, cir, 124 cir_arg, NULL); 119 ns16550_instance_t *ns16550_instance = ns16550_init(ns16550, inr, cir, cir_arg); 125 120 if (ns16550_instance) { 126 121 kbrd_instance_t *kbrd_instance = kbrd_init(); -
kernel/arch/sparc64/src/drivers/pci.c
rfd07e57b raacdb8e 43 43 #include <typedefs.h> 44 44 #include <debug.h> 45 #include < log.h>45 #include <print.h> 46 46 #include <str.h> 47 47 #include <arch/asm.h> … … 213 213 * Unsupported model. 214 214 */ 215 log(LF_ARCH, LVL_WARN, "Unsupported PCI controller model (%s).",215 printf("Unsupported PCI controller model (%s).\n", 216 216 (char *) prop->value); 217 217 } -
kernel/arch/sparc64/src/drivers/scr.c
rfd07e57b raacdb8e 81 81 82 82 if (scr_type == SCR_UNKNOWN) { 83 log(LF_ARCH, LVL_ERROR, "Unknown screen device.");83 printf("Unknown screen device.\n"); 84 84 return; 85 85 } … … 117 117 case SCR_ATYFB: 118 118 if (prop->size / sizeof(ofw_pci_reg_t) < 2) { 119 log(LF_ARCH, LVL_ERROR, "Too few screen registers.");119 printf("Too few screen registers.\n"); 120 120 return; 121 121 } … … 124 124 125 125 if (!ofw_pci_reg_absolutize(node, pci_reg, &pci_abs_reg)) { 126 log(LF_ARCH, LVL_ERROR, 127 "Failed to absolutize fb register."); 126 printf("Failed to absolutize fb register.\n"); 128 127 return; 129 128 } … … 131 130 if (!ofw_pci_apply_ranges(node->parent, &pci_abs_reg, 132 131 &fb_addr)) { 133 log(LF_ARCH, LVL_ERROR, 134 "Failed to determine screen address."); 132 printf("Failed to determine screen address.\n"); 135 133 return; 136 134 } … … 154 152 break; 155 153 default: 156 log(LF_ARCH, LVL_ERROR, 157 "Unsupported bits per pixel."); 154 printf("Unsupported bits per pixel.\n"); 158 155 return; 159 156 } … … 162 159 case SCR_XVR: 163 160 if (prop->size / sizeof(ofw_pci_reg_t) < 2) { 164 log(LF_ARCH, LVL_ERROR, 165 "Too few screen registers."); 161 printf("Too few screen registers.\n"); 166 162 return; 167 163 } … … 170 166 171 167 if (!ofw_pci_reg_absolutize(node, pci_reg, &pci_abs_reg)) { 172 log(LF_ARCH, LVL_ERROR, 173 "Failed to absolutize fb register."); 168 printf("Failed to absolutize fb register.\n"); 174 169 return; 175 170 } … … 177 172 if (!ofw_pci_apply_ranges(node->parent, &pci_abs_reg, 178 173 &fb_addr)) { 179 log(LF_ARCH, LVL_ERROR, 180 "Failed to determine screen address."); 174 printf("Failed to determine screen address.\n"); 181 175 return; 182 176 } … … 202 196 break; 203 197 default: 204 log(LF_ARCH, LVL_ERROR, 205 "Unsupported bits per pixel."); 198 printf("Unsupported bits per pixel.\n"); 206 199 return; 207 200 } … … 214 207 upa_reg = &((ofw_upa_reg_t *) prop->value)[FFB_REG_24BPP]; 215 208 if (!ofw_upa_apply_ranges(node->parent, upa_reg, &fb_addr)) { 216 log(LF_ARCH, LVL_ERROR, 217 "Failed to determine screen address."); 209 printf("Failed to determine screen address.\n"); 218 210 return; 219 211 } … … 227 219 break; 228 220 default: 229 log(LF_ARCH, LVL_WARN, "Not implemented.");221 printf("Not implemented.\n"); 230 222 return; 231 223 } … … 233 225 sbus_reg = &((ofw_sbus_reg_t *) prop->value)[0]; 234 226 if (!ofw_sbus_apply_ranges(node->parent, sbus_reg, &fb_addr)) { 235 log(LF_ARCH, LVL_ERROR, 236 "Failed to determine screen address."); 227 printf("Failed to determine screen address.\n"); 237 228 return; 238 229 } … … 242 233 case SCR_QEMU_VGA: 243 234 if (prop->size / sizeof(ofw_pci_reg_t) < 2) { 244 log(LF_ARCH, LVL_ERROR, "Too few screen registers.");235 printf("Too few screen registers.\n"); 245 236 return; 246 237 } … … 249 240 250 241 if (!ofw_pci_reg_absolutize(node, pci_reg, &pci_abs_reg)) { 251 log(LF_ARCH, LVL_ERROR, 252 "Failed to absolutize fb register."); 242 printf("Failed to absolutize fb register.\n"); 253 243 return; 254 244 } … … 256 246 if (!ofw_pci_apply_ranges(node->parent, &pci_abs_reg, 257 247 &fb_addr)) { 258 log(LF_ARCH, LVL_ERROR, 259 "Failed to determine screen address."); 248 printf("Failed to determine screen address.\n"); 260 249 return; 261 250 } … … 279 268 break; 280 269 default: 281 log(LF_ARCH, LVL_ERROR, "Unsupported bits per pixel.");270 printf("Unsupported bits per pixel.\n"); 282 271 return; 283 272 } -
kernel/arch/sparc64/src/mm/sun4v/tlb.c
rfd07e57b raacdb8e 46 46 #include <arch.h> 47 47 #include <print.h> 48 #include <log.h>49 48 #include <typedefs.h> 50 49 #include <config.h> … … 336 335 void tlb_print(void) 337 336 { 338 log(LF_ARCH, LVL_WARN, "Operation not possible on Niagara.");337 printf("Operation not possible on Niagara.\n"); 339 338 } 340 339 -
kernel/arch/sparc64/src/smp/sun4u/smp.c
rfd07e57b raacdb8e 43 43 #include <typedefs.h> 44 44 #include <synch/waitq.h> 45 #include < log.h>45 #include <print.h> 46 46 #include <arch/cpu_node.h> 47 47 … … 108 108 if (waitq_sleep_timeout(&ap_completion_wq, 1000000, SYNCH_FLAGS_NONE) == 109 109 ESYNCH_TIMEOUT) 110 log(LF_ARCH, LVL_NOTE,"%s: waiting for processor (mid = %" PRIu32111 ") timed out ", __func__, mid);110 printf("%s: waiting for processor (mid = %" PRIu32 111 ") timed out\n", __func__, mid); 112 112 } 113 113 -
kernel/arch/sparc64/src/sun4v/md.c
rfd07e57b raacdb8e 36 36 #include <panic.h> 37 37 #include <func.h> 38 #include < log.h>38 #include <print.h> 39 39 #include <str.h> 40 40 #include <arch/sun4v/md.h> … … 310 310 retval = retval; 311 311 if (retval != HV_EOK) { 312 log(LF_ARCH, LVL_ERROR, "Could not retrieve machine"313 " description, error=%" PRIu64 ".", retval);312 printf("Could not retrieve machine description, " 313 "error=%" PRIu64 ".\n", retval); 314 314 } 315 315 } -
kernel/arch/sparc64/src/trap/sun4u/interrupt.c
rfd07e57b raacdb8e 42 42 #include <arch/asm.h> 43 43 #include <arch/barrier.h> 44 #include < log.h>44 #include <print.h> 45 45 #include <arch.h> 46 46 #include <mm/tlb.h> … … 96 96 */ 97 97 #ifdef CONFIG_DEBUG 98 log(LF_ARCH, LVL_DEBUG, 99 "cpu%u: spurious interrupt (intrcv=%#" PRIx64 ", data0=%#" 100 PRIx64 ")", CPU->id, intrcv, data0); 98 printf("cpu%u: spurious interrupt (intrcv=%#" PRIx64 99 ", data0=%#" PRIx64 ")\n", CPU->id, intrcv, data0); 101 100 #else 102 101 (void) intrcv; -
kernel/arch/sparc64/src/trap/sun4v/interrupt.c
rfd07e57b raacdb8e 42 42 #include <arch/asm.h> 43 43 #include <arch/barrier.h> 44 #include < log.h>44 #include <print.h> 45 45 #include <arch.h> 46 46 #include <mm/tlb.h> … … 111 111 ((void (*)(void)) data1)(); 112 112 } else { 113 log(LF_ARCH, LVL_DEBUG, "Spurious interrupt on %" PRIu64114 ", data = %" PRIx64 ".",CPU->arch.id, data1);113 printf("Spurious interrupt on %" PRIu64 ", data = %" PRIx64 ".\n", 114 CPU->arch.id, data1); 115 115 } 116 116 } -
kernel/doc/doxygroups.h
rfd07e57b raacdb8e 167 167 */ 168 168 169 /** @defgroup generick io KIO170 * @brief Kernel character input/outputfacility169 /** @defgroup genericklog KLog 170 * @brief Kernel logging facility 171 171 * @ingroup genericconsole 172 172 */ -
kernel/genarch/src/acpi/acpi.c
rfd07e57b raacdb8e 41 41 #include <mm/page.h> 42 42 #include <mm/km.h> 43 #include < log.h>43 #include <print.h> 44 44 45 45 #define RSDP_SIGNATURE "RSD PTR " … … 211 211 212 212 if ((acpi_rsdt) && (!acpi_sdt_check((uint8_t *) acpi_rsdt))) { 213 log(LF_ARCH, LVL_ERROR, "RSDT: bad checksum");213 printf("RSDT: bad checksum\n"); 214 214 return; 215 215 } 216 216 217 217 if ((acpi_xsdt) && (!acpi_sdt_check((uint8_t *) acpi_xsdt))) { 218 log(LF_ARCH, LVL_ERROR, "XSDT: bad checksum");218 printf("XSDT: bad checksum\n"); 219 219 return; 220 220 } -
kernel/genarch/src/acpi/madt.c
rfd07e57b raacdb8e 43 43 #include <debug.h> 44 44 #include <config.h> 45 #include < log.h>45 #include <print.h> 46 46 #include <mm/slab.h> 47 47 #include <memstr.h> … … 236 236 case MADT_L_SAPIC: 237 237 case MADT_PLATFORM_INTR_SRC: 238 log(LF_ARCH, LVL_WARN, 239 "MADT: Skipping %s entry (type=%" PRIu8 ")", 238 printf("MADT: Skipping %s entry (type=%" PRIu8 ")\n", 240 239 entry[hdr->type], hdr->type); 241 240 break; … … 243 242 if ((hdr->type >= MADT_RESERVED_SKIP_BEGIN) 244 243 && (hdr->type <= MADT_RESERVED_SKIP_END)) 245 log(LF_ARCH, LVL_NOTE, 246 "MADT: Skipping reserved entry (type=%" PRIu8 ")", 244 printf("MADT: Skipping reserved entry (type=%" PRIu8 ")\n", 247 245 hdr->type); 248 246 249 247 if (hdr->type >= MADT_RESERVED_OEM_BEGIN) 250 log(LF_ARCH, LVL_NOTE, 251 "MADT: Skipping OEM entry (type=%" PRIu8 ")", 248 printf("MADT: Skipping OEM entry (type=%" PRIu8 ")\n", 252 249 hdr->type); 253 250 -
kernel/genarch/src/drivers/via-cuda/cuda.c
rfd07e57b raacdb8e 118 118 } 119 119 120 #include < log.h>120 #include <print.h> 121 121 void cuda_wire(cuda_instance_t *instance, indev_t *kbrdin) 122 122 { … … 197 197 198 198 if ((b & TREQ) != 0) { 199 log(LF_OTHER, LVL_ERROR, "cuda_irq_listen: no TREQ?!");199 printf("cuda_irq_listen: no TREQ?!\n"); 200 200 return; 201 201 } -
kernel/generic/include/console/console.h
rfd07e57b raacdb8e 39 39 #include <print.h> 40 40 #include <console/chardev.h> 41 #include <synch/spinlock.h>42 41 43 42 #define PAGING(counter, increment, before, after) \ … … 63 62 extern void console_init(void); 64 63 65 extern void kio_init(void); 66 extern void kio_update(void *); 67 extern void kio_flush(void); 68 extern void kio_push_char(const wchar_t); 69 SPINLOCK_EXTERN(kio_lock); 64 extern void klog_init(void); 65 extern void klog_update(void *); 70 66 71 67 extern wchar_t getc(indev_t *indev); 72 68 extern size_t gets(indev_t *indev, char *buf, size_t buflen); 73 extern sysarg_t sys_k io(int cmd, const void *buf, size_t size);69 extern sysarg_t sys_klog(int cmd, const void *buf, size_t size); 74 70 75 71 extern void grab_console(void); -
kernel/generic/include/debug.h
rfd07e57b raacdb8e 107 107 #define LOG(format, ...) \ 108 108 do { \ 109 log(LF_OTHER, LVL_DEBUG, \ 110 "%s() from %s at %s:%u: " format,__func__, \ 109 printf("%s() from %s at %s:%u: " format "\n", __func__, \ 111 110 symtab_fmt_name_lookup(CALLER), __FILE__, __LINE__, \ 112 111 ##__VA_ARGS__); \ -
kernel/generic/include/synch/spinlock.h
rfd07e57b raacdb8e 137 137 #ifdef CONFIG_DEBUG_SPINLOCK 138 138 139 #include < log.h>139 #include <print.h> 140 140 141 141 #define DEADLOCK_THRESHOLD 100000000 … … 146 146 if ((pname)++ > (value)) { \ 147 147 (pname) = 0; \ 148 log(LF_OTHER, LVL_WARN, \ 149 "Deadlock probe %s: exceeded threshold %u\n" \ 148 printf("Deadlock probe %s: exceeded threshold %u\n" \ 150 149 "cpu%u: function=%s, line=%u\n", \ 151 150 #pname, (value), CPU->id, __func__, __LINE__); \ -
kernel/generic/src/console/cmd.c
rfd07e57b raacdb8e 45 45 #include <console/kconsole.h> 46 46 #include <print.h> 47 #include <log.h>48 47 #include <panic.h> 49 48 #include <typedefs.h> … … 640 639 for (i = 0; basic_commands[i]; i++) { 641 640 if (!cmd_register(basic_commands[i])) { 642 log(LF_OTHER, LVL_ERROR, 643 "Cannot register command %s", 641 printf("Cannot register command %s\n", 644 642 basic_commands[i]->name); 645 643 } … … 667 665 unsigned int _len = (unsigned int) len; 668 666 if ((_len != len) || (((int) _len) < 0)) { 669 log(LF_OTHER, LVL_ERROR, "Command length overflow");667 printf("Command length overflow\n"); 670 668 return 1; 671 669 } -
kernel/generic/src/console/console.c
rfd07e57b raacdb8e 52 52 #include <errno.h> 53 53 #include <str.h> 54 #include <abi/k io.h>55 56 #define K IO_PAGES 857 #define K IO_LENGTH (KIO_PAGES * PAGE_SIZE / sizeof(wchar_t))54 #include <abi/klog.h> 55 56 #define KLOG_PAGES 8 57 #define KLOG_LENGTH (KLOG_PAGES * PAGE_SIZE / sizeof(wchar_t)) 58 58 59 59 /** Kernel log cyclic buffer */ 60 wchar_t k io[KIO_LENGTH] __attribute__((aligned(PAGE_SIZE)));60 wchar_t klog[KLOG_LENGTH] __attribute__((aligned(PAGE_SIZE))); 61 61 62 62 /** Kernel log initialized */ 63 static atomic_t k io_inited = {false};63 static atomic_t klog_inited = {false}; 64 64 65 65 /** First kernel log characters */ 66 static size_t k io_start = 0;66 static size_t klog_start = 0; 67 67 68 68 /** Number of valid kernel log characters */ 69 static size_t k io_len = 0;69 static size_t klog_len = 0; 70 70 71 71 /** Number of stored (not printed) kernel log characters */ 72 static size_t k io_stored = 0;72 static size_t klog_stored = 0; 73 73 74 74 /** Number of stored kernel log characters for uspace */ 75 static size_t k io_uspace = 0;75 static size_t klog_uspace = 0; 76 76 77 77 /** Kernel log spinlock */ 78 SPINLOCK_ INITIALIZE_NAME(kio_lock, "kio_lock");79 80 /** Physical memory area used for k iobuffer */81 static parea_t k io_parea;78 SPINLOCK_STATIC_INITIALIZE_NAME(klog_lock, "klog_lock"); 79 80 /** Physical memory area used for klog buffer */ 81 static parea_t klog_parea; 82 82 83 83 static indev_t stdin_sink; … … 146 146 * 147 147 */ 148 void k io_init(void)149 { 150 void *faddr = (void *) KA2PA(k io);148 void klog_init(void) 149 { 150 void *faddr = (void *) KA2PA(klog); 151 151 152 152 ASSERT((uintptr_t) faddr % FRAME_SIZE == 0); 153 153 154 k io_parea.pbase = (uintptr_t) faddr;155 k io_parea.frames = SIZE2FRAMES(sizeof(kio));156 k io_parea.unpriv = false;157 k io_parea.mapped = false;158 ddi_parea_register(&k io_parea);159 160 sysinfo_set_item_val("k io.faddr", NULL, (sysarg_t) faddr);161 sysinfo_set_item_val("k io.pages", NULL, KIO_PAGES);162 163 event_set_unmask_callback(EVENT_K IO, kio_update);164 atomic_set(&k io_inited, true);154 klog_parea.pbase = (uintptr_t) faddr; 155 klog_parea.frames = SIZE2FRAMES(sizeof(klog)); 156 klog_parea.unpriv = false; 157 klog_parea.mapped = false; 158 ddi_parea_register(&klog_parea); 159 160 sysinfo_set_item_val("klog.faddr", NULL, (sysarg_t) faddr); 161 sysinfo_set_item_val("klog.pages", NULL, KLOG_PAGES); 162 163 event_set_unmask_callback(EVENT_KLOG, klog_update); 164 atomic_set(&klog_inited, true); 165 165 } 166 166 … … 247 247 } 248 248 249 void k io_update(void *event)250 { 251 if (!atomic_get(&k io_inited))249 void klog_update(void *event) 250 { 251 if (!atomic_get(&klog_inited)) 252 252 return; 253 253 254 spinlock_lock(&kio_lock); 255 256 if (kio_uspace > 0) { 257 if (event_notify_3(EVENT_KIO, true, kio_start, kio_len, 258 kio_uspace) == EOK) 259 kio_uspace = 0; 260 } 261 262 spinlock_unlock(&kio_lock); 263 } 264 265 /** Flush characters that are stored in the output buffer 266 * 267 */ 268 void kio_flush(void) 254 spinlock_lock(&klog_lock); 255 256 if (klog_uspace > 0) { 257 if (event_notify_3(EVENT_KLOG, true, klog_start, klog_len, 258 klog_uspace) == EOK) 259 klog_uspace = 0; 260 } 261 262 spinlock_unlock(&klog_lock); 263 } 264 265 void putchar(const wchar_t ch) 269 266 { 270 267 bool ordy = ((stdout) && (stdout->op->write)); 271 268 272 if (!ordy) 273 return; 274 275 spinlock_lock(&kio_lock); 276 277 /* Print characters that weren't printed earlier */ 278 while (kio_stored > 0) { 279 wchar_t tmp = kio[(kio_start + kio_len - kio_stored) % KIO_LENGTH]; 280 kio_stored--; 281 269 spinlock_lock(&klog_lock); 270 271 /* Print charaters stored in kernel log */ 272 if (ordy) { 273 while (klog_stored > 0) { 274 wchar_t tmp = klog[(klog_start + klog_len - klog_stored) % KLOG_LENGTH]; 275 klog_stored--; 276 277 /* 278 * We need to give up the spinlock for 279 * the physical operation of writting out 280 * the character. 281 */ 282 spinlock_unlock(&klog_lock); 283 stdout->op->write(stdout, tmp); 284 spinlock_lock(&klog_lock); 285 } 286 } 287 288 /* Store character in the cyclic kernel log */ 289 klog[(klog_start + klog_len) % KLOG_LENGTH] = ch; 290 if (klog_len < KLOG_LENGTH) 291 klog_len++; 292 else 293 klog_start = (klog_start + 1) % KLOG_LENGTH; 294 295 if (!ordy) { 296 if (klog_stored < klog_len) 297 klog_stored++; 298 } 299 300 /* The character is stored for uspace */ 301 if (klog_uspace < klog_len) 302 klog_uspace++; 303 304 spinlock_unlock(&klog_lock); 305 306 if (ordy) { 282 307 /* 283 * We need to give up the spinlock for 284 * the physical operation of writing out 285 * the character. 308 * Output the character. In this case 309 * it should be no longer buffered. 286 310 */ 287 spinlock_unlock(&kio_lock); 288 stdout->op->write(stdout, tmp); 289 spinlock_lock(&kio_lock); 290 } 291 292 spinlock_unlock(&kio_lock); 293 } 294 295 /** Put a character into the output buffer. 296 * 297 * The caller is required to hold kio_lock 298 */ 299 void kio_push_char(const wchar_t ch) 300 { 301 kio[(kio_start + kio_len) % KIO_LENGTH] = ch; 302 if (kio_len < KIO_LENGTH) 303 kio_len++; 304 else 305 kio_start = (kio_start + 1) % KIO_LENGTH; 306 307 if (kio_stored < kio_len) 308 kio_stored++; 309 310 /* The character is stored for uspace */ 311 if (kio_uspace < kio_len) 312 kio_uspace++; 313 } 314 315 void putchar(const wchar_t ch) 316 { 317 bool ordy = ((stdout) && (stdout->op->write)); 318 319 spinlock_lock(&kio_lock); 320 kio_push_char(ch); 321 spinlock_unlock(&kio_lock); 322 323 /* Output stored characters */ 324 kio_flush(); 325 326 if (!ordy) { 311 stdout->op->write(stdout, ch); 312 } else { 327 313 /* 328 314 * No standard output routine defined yet. … … 340 326 /* Force notification on newline */ 341 327 if (ch == '\n') 342 k io_update(NULL);328 klog_update(NULL); 343 329 } 344 330 … … 348 334 * 349 335 */ 350 sysarg_t sys_k io(int cmd, const void *buf, size_t size)336 sysarg_t sys_klog(int cmd, const void *buf, size_t size) 351 337 { 352 338 char *data; … … 354 340 355 341 switch (cmd) { 356 case K IO_UPDATE:357 k io_update(NULL);342 case KLOG_UPDATE: 343 klog_update(NULL); 358 344 return EOK; 359 case K IO_WRITE:360 case K IO_COMMAND:345 case KLOG_WRITE: 346 case KLOG_COMMAND: 361 347 break; 362 348 default: … … 380 366 381 367 switch (cmd) { 382 case K IO_WRITE:368 case KLOG_WRITE: 383 369 printf("%s", data); 384 370 break; 385 case K IO_COMMAND:371 case KLOG_COMMAND: 386 372 if (!stdin) 387 373 break; -
kernel/generic/src/lib/func.c
rfd07e57b raacdb8e 37 37 38 38 #include <func.h> 39 #include < log.h>39 #include <print.h> 40 40 #include <cpu.h> 41 41 #include <arch/asm.h> … … 72 72 73 73 if (CPU) 74 log(LF_OTHER, LVL_NOTE, "cpu%u: halted", CPU->id);74 printf("cpu%u: halted\n", CPU->id); 75 75 else 76 log(LF_OTHER, LVL_NOTE, "cpu: halted");76 printf("cpu: halted\n"); 77 77 78 78 cpu_halt(); -
kernel/generic/src/lib/rd.c
rfd07e57b raacdb8e 38 38 */ 39 39 40 #include < log.h>40 #include <print.h> 41 41 #include <lib/rd.h> 42 42 #include <mm/frame.h> … … 68 68 sysinfo_set_item_val("rd.address.physical", NULL, (sysarg_t) base); 69 69 70 log(LF_OTHER, LVL_NOTE, "RAM disk at %p (size %zu bytes)", (void *) base, 71 size); 70 printf("RAM disk at %p (size %zu bytes)\n", (void *) base, size); 72 71 } 73 72 -
kernel/generic/src/main/kinit.c
rfd07e57b raacdb8e 59 59 #include <mm/km.h> 60 60 #include <print.h> 61 #include <log.h>62 61 #include <memstr.h> 63 62 #include <console/console.h> … … 141 140 thread_ready(thread); 142 141 } else 143 log(LF_OTHER, LVL_ERROR, 144 "Unable to create kcpulb thread for cpu%u", i); 142 printf("Unable to create kcpulb thread for cpu%u\n", i); 145 143 } 146 144 } … … 158 156 thread_ready(thread); 159 157 else 160 log(LF_OTHER, LVL_ERROR, "Unable to create kload thread");158 printf("Unable to create kload thread\n"); 161 159 162 160 #ifdef CONFIG_KCONSOLE … … 170 168 thread_ready(thread); 171 169 else 172 log(LF_OTHER, LVL_ERROR, 173 "Unable to create kconsole thread"); 170 printf("Unable to create kconsole thread\n"); 174 171 } 175 172 #endif /* CONFIG_KCONSOLE */ … … 213 210 for (i = 0; i < init.cnt; i++) { 214 211 if (init.tasks[i].paddr % FRAME_SIZE) { 215 log(LF_OTHER, LVL_ERROR, 216 "init[%zu]: Address is not frame aligned", i); 212 printf("init[%zu]: Address is not frame aligned\n", i); 217 213 programs[i].task = NULL; 218 214 continue; … … 277 273 init_rd((void *) init.tasks[i].paddr, init.tasks[i].size); 278 274 } else 279 log(LF_OTHER, LVL_ERROR, 280 "init[%zu]: Init binary load failed " 281 "(error %d, loader status %u)", i, rc, 275 printf("init[%zu]: Init binary load failed " 276 "(error %d, loader status %u)\n", i, rc, 282 277 programs[i].loader_status); 283 278 } -
kernel/generic/src/main/main.c
rfd07e57b raacdb8e 62 62 #include <console/kconsole.h> 63 63 #include <console/console.h> 64 #include <log.h>65 64 #include <cpu.h> 66 65 #include <align.h> … … 282 281 ipc_init(); 283 282 event_init(); 284 kio_init(); 285 log_init(); 283 klog_init(); 286 284 stats_init(); 287 285 -
kernel/generic/src/main/shutdown.c
rfd07e57b raacdb8e 39 39 #include <func.h> 40 40 #include <print.h> 41 #include <log.h>42 41 43 42 void reboot(void) … … 46 45 47 46 #ifdef CONFIG_DEBUG 48 log(LF_OTHER, LVL_DEBUG, "Rebooting the system");47 printf("Rebooting the system\n"); 49 48 #endif 50 49 -
kernel/generic/src/mm/frame.c
rfd07e57b raacdb8e 54 54 #include <arch.h> 55 55 #include <print.h> 56 #include <log.h>57 56 #include <align.h> 58 57 #include <mm/slab.h> … … 122 121 { 123 122 if (zones.count + 1 == ZONES_MAX) { 124 log(LF_OTHER, LVL_ERROR, "Maximum zone count %u exceeded!", 125 ZONES_MAX); 123 printf("Maximum zone count %u exceeded!\n", ZONES_MAX); 126 124 return (size_t) -1; 127 125 } … … 143 141 (!iswithin(zones.info[i].base, zones.info[i].count, 144 142 base, count))) { 145 log(LF_OTHER, LVL_WARN, 146 "Zone (%p, %p) overlaps " 147 "with previous zone (%p %p)!", 143 printf("Zone (%p, %p) overlaps " 144 "with previous zone (%p %p)!\n", 148 145 (void *) PFN2ADDR(base), (void *) PFN2ADDR(count), 149 146 (void *) PFN2ADDR(zones.info[i].base), … … 916 913 917 914 #ifdef CONFIG_DEBUG 918 log(LF_OTHER, LVL_DEBUG, 919 "Thread %" PRIu64 " waiting for %zu frames " 920 "%zu available.", THREAD->tid, count, avail); 915 printf("Thread %" PRIu64 " waiting for %zu frames " 916 "(%zu available).\n", THREAD->tid, count, avail); 921 917 #endif 922 918 … … 942 938 943 939 #ifdef CONFIG_DEBUG 944 log(LF_OTHER, LVL_DEBUG, "Thread %" PRIu64 " woken up.", 945 THREAD->tid); 940 printf("Thread %" PRIu64 " woken up.\n", THREAD->tid); 946 941 #endif 947 942 -
kernel/generic/src/proc/program.c
rfd07e57b raacdb8e 49 49 #include <lib/elf_load.h> 50 50 #include <errno.h> 51 #include < log.h>51 #include <print.h> 52 52 #include <syscall/copy.h> 53 53 #include <proc/program.h> … … 155 155 156 156 program_loader = image_addr; 157 log(LF_OTHER, LVL_NOTE, "Program loader at %p", (void *) image_addr);157 printf("Program loader at %p\n", (void *) image_addr); 158 158 159 159 return EOK; … … 181 181 if (!loader) { 182 182 as_destroy(as); 183 log(LF_OTHER, LVL_ERROR, 184 "Cannot spawn loader as none was registered"); 183 printf("Cannot spawn loader as none was registered\n"); 185 184 return ENOENT; 186 185 } … … 190 189 if (prg->loader_status != EE_OK) { 191 190 as_destroy(as); 192 log(LF_OTHER, LVL_ERROR, "Cannot spawn loader (%s)",191 printf("Cannot spawn loader (%s)\n", 193 192 elf_error(prg->loader_status)); 194 193 return ENOENT; -
kernel/generic/src/proc/scheduler.c
rfd07e57b raacdb8e 61 61 #include <cpu.h> 62 62 #include <print.h> 63 #include <log.h>64 63 #include <debug.h> 65 64 #include <stacktrace.h> … … 518 517 519 518 #ifdef SCHEDULER_VERBOSE 520 log(LF_OTHER, LVL_DEBUG, 521 "cpu%u: tid %" PRIu64 " (priority=%d, ticks=%" PRIu64 522 ", nrdy=%" PRIua ")", CPU->id, THREAD->tid, THREAD->priority, 519 printf("cpu%u: tid %" PRIu64 " (priority=%d, ticks=%" PRIu64 520 ", nrdy=%" PRIua ")\n", CPU->id, THREAD->tid, THREAD->priority, 523 521 THREAD->ticks, atomic_get(&CPU->nrdy)); 524 522 #endif … … 665 663 666 664 #ifdef KCPULB_VERBOSE 667 log(LF_OTHER, LVL_DEBUG, 668 "kcpulb%u: TID %" PRIu64 " -> cpu%u, " 669 "nrdy=%ld, avg=%ld", CPU->id, t->tid, 665 printf("kcpulb%u: TID %" PRIu64 " -> cpu%u, " 666 "nrdy=%ld, avg=%ld\n", CPU->id, t->tid, 670 667 CPU->id, atomic_get(&CPU->nrdy), 671 668 atomic_get(&nrdy) / config.cpu_active); -
kernel/generic/src/syscall/syscall.c
rfd07e57b raacdb8e 56 56 #include <console/console.h> 57 57 #include <udebug/udebug.h> 58 #include <log.h>59 58 60 59 /** Dispatch system call */ … … 87 86 rc = syscall_table[id](a1, a2, a3, a4, a5, a6); 88 87 } else { 89 log(LF_OTHER, LVL_ERROR, 90 "Task %" PRIu64": Unknown syscall %#" PRIxn, TASK->taskid, id); 88 printf("Task %" PRIu64": Unknown syscall %#" PRIxn, TASK->taskid, id); 91 89 task_kill_self(true); 92 90 } … … 122 120 syshandler_t syscall_table[SYSCALL_END] = { 123 121 /* System management syscalls. */ 124 (syshandler_t) sys_k io,122 (syshandler_t) sys_klog, 125 123 (syshandler_t) sys_tls_set, 126 124 … … 192 190 193 191 /* Kernel console syscalls. */ 194 (syshandler_t) sys_debug_activate_console, 195 196 (syshandler_t) sys_klog, 192 (syshandler_t) sys_debug_activate_console 197 193 }; 198 194 -
uspace/Makefile
rfd07e57b raacdb8e 50 50 app/kill \ 51 51 app/killall \ 52 app/k io\52 app/klog \ 53 53 app/loc \ 54 54 app/logset \ … … 92 92 srv/locsrv \ 93 93 srv/logger \ 94 srv/klog \95 94 srv/devman \ 96 95 srv/loader \ -
uspace/app/init/init.c
rfd07e57b raacdb8e 336 336 srv_start("/srv/tmpfs"); 337 337 338 srv_start("/srv/klog");339 338 srv_start("/srv/locfs"); 340 339 srv_start("/srv/taskmon"); -
uspace/app/trace/syscalls.c
rfd07e57b raacdb8e 38 38 39 39 const sc_desc_t syscall_desc[] = { 40 [SYS_K IO] ={ "kio",3, V_INT_ERRNO },40 [SYS_KLOG] ={ "klog", 3, V_INT_ERRNO }, 41 41 [SYS_TLS_SET] = { "tls_set", 1, V_ERRNO }, 42 42 -
uspace/lib/c/Makefile
rfd07e57b raacdb8e 107 107 generic/io/log.c \ 108 108 generic/io/logctl.c \ 109 generic/io/kio.c \110 109 generic/io/klog.c \ 111 110 generic/io/snprintf.c \ -
uspace/lib/c/generic/assert.c
rfd07e57b raacdb8e 33 33 #include <assert.h> 34 34 #include <stdio.h> 35 #include <io/k io.h>35 #include <io/klog.h> 36 36 #include <stdlib.h> 37 37 #include <atomic.h> … … 44 44 { 45 45 /* 46 * Send the message safely to k io. Nested asserts should not occur.46 * Send the message safely to klog. Nested asserts should not occur. 47 47 */ 48 k io_printf("Assertion failed (%s) in file \"%s\", line %u.\n",48 klog_printf("Assertion failed (%s) in file \"%s\", line %u.\n", 49 49 cond, file, line); 50 50 -
uspace/lib/c/generic/io/io.c
rfd07e57b raacdb8e 42 42 #include <malloc.h> 43 43 #include <async.h> 44 #include <io/k io.h>44 #include <io/klog.h> 45 45 #include <vfs/vfs.h> 46 46 #include <vfs/vfs_sess.h> … … 57 57 .error = true, 58 58 .eof = true, 59 .k io= false,59 .klog = false, 60 60 .sess = NULL, 61 61 .btype = _IONBF, … … 67 67 }; 68 68 69 static FILE stdout_k io= {69 static FILE stdout_klog = { 70 70 .fd = -1, 71 71 .error = false, 72 72 .eof = false, 73 .k io= true,73 .klog = true, 74 74 .sess = NULL, 75 75 .btype = _IOLBF, … … 81 81 }; 82 82 83 static FILE stderr_k io= {83 static FILE stderr_klog = { 84 84 .fd = -1, 85 85 .error = false, 86 86 .eof = false, 87 .k io= true,87 .klog = true, 88 88 .sess = NULL, 89 89 .btype = _IONBF, … … 113 113 stdout = fdopen(1, "w"); 114 114 } else { 115 stdout = &stdout_k io;115 stdout = &stdout_klog; 116 116 list_append(&stdout->link, &files); 117 117 } … … 120 120 stderr = fdopen(2, "w"); 121 121 } else { 122 stderr = &stderr_k io;122 stderr = &stderr_klog; 123 123 list_append(&stderr->link, &files); 124 124 } … … 267 267 stream->error = false; 268 268 stream->eof = false; 269 stream->k io= false;269 stream->klog = false; 270 270 stream->sess = NULL; 271 271 stream->need_sync = false; … … 289 289 stream->error = false; 290 290 stream->eof = false; 291 stream->k io= false;291 stream->klog = false; 292 292 stream->sess = NULL; 293 293 stream->need_sync = false; … … 314 314 315 315 if ((stream != &stdin_null) 316 && (stream != &stdout_k io)317 && (stream != &stderr_k io))316 && (stream != &stdout_klog) 317 && (stream != &stderr_klog)) 318 318 free(stream); 319 319 … … 382 382 ssize_t wr; 383 383 384 if (stream->k io)385 wr = k io_write(buf + done, left);384 if (stream->klog) 385 wr = klog_write(buf + done, left); 386 386 else 387 387 wr = write(stream->fd, buf + done, left); … … 705 705 _fflushbuf(stream); 706 706 707 if (stream->k io) {708 k io_update();707 if (stream->klog) { 708 klog_update(); 709 709 return EOK; 710 710 } … … 740 740 int fileno(FILE *stream) 741 741 { 742 if (stream->k io) {742 if (stream->klog) { 743 743 errno = EBADF; 744 744 return -1; -
uspace/lib/c/generic/io/klog.c
rfd07e57b raacdb8e 1 1 /* 2 * Copyright (c) 2013 Martin Sucha 2 * Copyright (c) 2006 Josef Cejka 3 * Copyright (c) 2006 Jakub Vana 3 4 * All rights reserved. 4 5 * … … 40 41 #include <abi/klog.h> 41 42 #include <io/klog.h> 42 #include < abi/log.h>43 #include <io/printf_core.h> 43 44 44 size_t klog_write( log_level_t lvl,const void *buf, size_t size)45 size_t klog_write(const void *buf, size_t size) 45 46 { 46 ssize_t ret = (ssize_t) __SYSCALL4(SYS_KLOG, KLOG_WRITE, (sysarg_t) buf, 47 size, lvl); 47 ssize_t ret = (ssize_t) __SYSCALL3(SYS_KLOG, KLOG_WRITE, (sysarg_t) buf, size); 48 48 49 49 if (ret >= 0) … … 53 53 } 54 54 55 int klog_read(void *data, size_t size)55 void klog_update(void) 56 56 { 57 return (int) __SYSCALL4(SYS_KLOG, KLOG_READ, (uintptr_t) data, size, 0); 57 (void) __SYSCALL3(SYS_KLOG, KLOG_UPDATE, (uintptr_t) NULL, 0); 58 } 59 60 void klog_command(const void *buf, size_t size) 61 { 62 (void) __SYSCALL3(SYS_KLOG, KLOG_COMMAND, (sysarg_t) buf, (sysarg_t) size); 63 } 64 65 /** Print formatted text to klog. 66 * 67 * @param fmt Format string 68 * 69 * \see For more details about format string see printf_core. 70 * 71 */ 72 int klog_printf(const char *fmt, ...) 73 { 74 va_list args; 75 va_start(args, fmt); 76 77 int ret = klog_vprintf(fmt, args); 78 79 va_end(args); 80 81 return ret; 82 } 83 84 static int klog_vprintf_str_write(const char *str, size_t size, void *data) 85 { 86 size_t wr = klog_write(str, size); 87 return str_nlength(str, wr); 88 } 89 90 static int klog_vprintf_wstr_write(const wchar_t *str, size_t size, void *data) 91 { 92 size_t offset = 0; 93 size_t chars = 0; 94 95 while (offset < size) { 96 char buf[STR_BOUNDS(1)]; 97 size_t sz = 0; 98 99 if (chr_encode(str[chars], buf, &sz, STR_BOUNDS(1)) == EOK) 100 klog_write(buf, sz); 101 102 chars++; 103 offset += sizeof(wchar_t); 104 } 105 106 return chars; 107 } 108 109 /** Print formatted text to klog. 110 * 111 * @param fmt Format string 112 * @param ap Format parameters 113 * 114 * \see For more details about format string see printf_core. 115 * 116 */ 117 int klog_vprintf(const char *fmt, va_list ap) 118 { 119 printf_spec_t ps = { 120 klog_vprintf_str_write, 121 klog_vprintf_wstr_write, 122 NULL 123 }; 124 125 return printf_core(fmt, &ps, ap); 58 126 } 59 127 -
uspace/lib/c/generic/private/stdio.h
rfd07e57b raacdb8e 53 53 int eof; 54 54 55 /** K IOindicator */56 int k io;55 /** Klog indicator */ 56 int klog; 57 57 58 58 /** Session to the file provider */ -
uspace/lib/c/include/io/klog.h
rfd07e57b raacdb8e 1 1 /* 2 * Copyright (c) 20 13 Martin Sucha2 * Copyright (c) 2006 Jakub Vana 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>45 41 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 }) 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); 63 48 64 49 #endif -
uspace/lib/c/include/io/log.h
rfd07e57b raacdb8e 39 39 #include <io/verify.h> 40 40 41 #include <abi/log.h> 41 /** Log message level. */ 42 typedef enum { 43 /** Fatal error, program is not able to recover at all. */ 44 LVL_FATAL, 45 /** Serious error but the program can recover from it. */ 46 LVL_ERROR, 47 /** Easily recoverable problem. */ 48 LVL_WARN, 49 /** Information message that ought to be printed by default. */ 50 LVL_NOTE, 51 /** Debugging purpose message. */ 52 LVL_DEBUG, 53 /** More detailed debugging message. */ 54 LVL_DEBUG2, 55 56 /** For checking range of values */ 57 LVL_LIMIT 58 } log_level_t; 42 59 43 60 /** Log itself (logging target). */ -
uspace/lib/c/include/stdio.h
rfd07e57b raacdb8e 40 40 #include <str.h> 41 41 #include <io/verify.h> 42 #include <abi/k io.h>42 #include <abi/klog.h> 43 43 44 44 #define EOF (-1) … … 52 52 int _n = snprintf(_buf, sizeof(_buf), fmt, ##__VA_ARGS__); \ 53 53 if (_n > 0) \ 54 (void) __SYSCALL3(SYS_K IO, KIO_WRITE, (sysarg_t) _buf, str_size(_buf)); \54 (void) __SYSCALL3(SYS_KLOG, KLOG_WRITE, (sysarg_t) _buf, str_size(_buf)); \ 55 55 } 56 56 -
uspace/srv/logger/writer.c
rfd07e57b raacdb8e 40 40 #include <io/log.h> 41 41 #include <io/logctl.h> 42 #include <io/klog.h>43 42 #include <ns.h> 44 43 #include <async.h> … … 80 79 } 81 80 82 KLOG_PRINTF(level,"[%s] %s: %s\n",81 printf("[%s] %s: %s\n", 83 82 log->full_name, log_level_str(level), 84 83 (const char *) message);
Note:
See TracChangeset
for help on using the changeset viewer.