Changeset 312cc68 in mainline
- Timestamp:
- 2009-03-18T10:48:46Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8015eeec
- Parents:
- 65513a5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/console.c
r65513a5 r312cc68 40 40 #include <synch/spinlock.h> 41 41 #include <arch/types.h> 42 #include <ddi/device.h>43 42 #include <ddi/irq.h> 44 43 #include <ddi/ddi.h> … … 48 47 #include <print.h> 49 48 #include <atomic.h> 49 #include <syscall/copy.h> 50 #include <errno.h> 50 51 51 52 #define KLOG_SIZE PAGE_SIZE … … 121 122 silent = true; 122 123 arch_release_console(); 124 } 125 126 /** Tell kernel to get keyboard/console access again */ 127 unative_t sys_debug_enable_console(void) 128 { 129 #ifdef CONFIG_KCONSOLE 130 grab_console(); 131 return true; 132 #else 133 return false; 134 #endif 135 } 136 137 /** Tell kernel to relinquish keyboard/console access */ 138 unative_t sys_debug_disable_console(void) 139 { 140 release_console(); 141 return true; 123 142 } 124 143 … … 276 295 } 277 296 297 /** Print using kernel facility 298 * 299 * Print to kernel log. 300 * 301 */ 302 unative_t sys_klog(int fd, const void * buf, size_t count) 303 { 304 char *data; 305 int rc; 306 307 if (count > PAGE_SIZE) 308 return ELIMIT; 309 310 if (count > 0) { 311 data = (char *) malloc(count + 1, 0); 312 if (!data) 313 return ENOMEM; 314 315 rc = copy_from_uspace(data, buf, count); 316 if (rc) { 317 free(data); 318 return rc; 319 } 320 data[count] = 0; 321 322 printf("%s", data); 323 free(data); 324 } else 325 klog_update(); 326 327 return count; 328 } 329 278 330 /** @} 279 331 */
Note:
See TracChangeset
for help on using the changeset viewer.