Changeset 9246016 in mainline
- Timestamp:
- 2017-12-08T21:03:35Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6ad454f
- Parents:
- f43742e2
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2017-12-08 05:21:59)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2017-12-08 21:03:35)
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/log.h
rf43742e2 r9246016 52 52 53 53 extern sysarg_t sys_klog(sysarg_t, void *buf, size_t size, 54 sysarg_t level );54 sysarg_t level, size_t *uspace_nread); 55 55 56 56 #endif /* KERN_LOG_H_ */ -
kernel/generic/src/log/log.c
rf43742e2 r9246016 294 294 */ 295 295 sysarg_t sys_klog(sysarg_t operation, void *buf, size_t size, 296 sysarg_t level )296 sysarg_t level, size_t *uspace_nread) 297 297 { 298 298 char *data; … … 376 376 return (sysarg_t) rc; 377 377 378 return copied; 378 return copy_to_uspace(uspace_nread, &copied, sizeof(copied)); 379 return EOK; 379 380 default: 380 381 return (sysarg_t) ENOTSUP; -
uspace/lib/c/generic/io/klog.c
rf43742e2 r9246016 42 42 #include <abi/log.h> 43 43 44 size_t klog_write(log_level_t lvl, const void *buf, size_t size)44 int klog_write(log_level_t lvl, const void *buf, size_t size) 45 45 { 46 ssize_t ret = (ssize_t) __SYSCALL4(SYS_KLOG, KLOG_WRITE, (sysarg_t) buf,46 return (int) __SYSCALL4(SYS_KLOG, KLOG_WRITE, (sysarg_t) buf, 47 47 size, lvl); 48 49 if (ret >= 0)50 return (size_t) ret;51 52 return 0;53 48 } 54 49 55 int klog_read(void *data, size_t size )50 int klog_read(void *data, size_t size, size_t *nread) 56 51 { 57 return (int) __SYSCALL4(SYS_KLOG, KLOG_READ, (uintptr_t) data, size, 0); 52 return (int) __SYSCALL5(SYS_KLOG, KLOG_READ, (uintptr_t) data, 53 size, 0, (sysarg_t) nread); 58 54 } 59 55 -
uspace/lib/c/include/io/klog.h
rf43742e2 r9246016 44 44 #include <abi/log.h> 45 45 46 extern size_t klog_write(log_level_t, const void *, size_t);47 extern int klog_read(void *, size_t );46 extern int klog_write(log_level_t, const void *, size_t); 47 extern int klog_read(void *, size_t, size_t *); 48 48 49 49 #define KLOG_PRINTF(lvl, fmt, ...) ({ \ -
uspace/srv/klog/klog.c
rf43742e2 r9246016 100 100 static void producer(void) 101 101 { 102 int read = klog_read(buffer, BUFFER_SIZE);103 104 if (r ead < 0) {105 log_msg(LOG_DEFAULT, LVL_ERROR, "klog_read failed, rc = % d",106 read);102 size_t len = 0; 103 int rc = klog_read(buffer, BUFFER_SIZE, &len); 104 if (rc != EOK) { 105 log_msg(LOG_DEFAULT, LVL_ERROR, "klog_read failed, rc = %s", 106 str_error_name(rc)); 107 107 return; 108 108 } 109 109 110 size_t len = read;111 110 size_t offset = 0; 112 111 while (offset < len) {
Note:
See TracChangeset
for help on using the changeset viewer.