Rev 3819 | Rev 3844 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3819 | Rev 3842 | ||
---|---|---|---|
Line 60... | Line 60... | ||
60 | * Print to kernel log. |
60 | * Print to kernel log. |
61 | * |
61 | * |
62 | */ |
62 | */ |
63 | static unative_t sys_klog(int fd, const void * buf, size_t count) |
63 | static unative_t sys_klog(int fd, const void * buf, size_t count) |
64 | { |
64 | { |
65 | size_t i; |
- | |
66 | char *data; |
65 | char *data; |
67 | int rc; |
66 | int rc; |
68 | 67 | ||
69 | if (count > PAGE_SIZE) |
68 | if (count > PAGE_SIZE) |
70 | return ELIMIT; |
69 | return ELIMIT; |
71 | 70 | ||
72 | if (count > 0) { |
71 | if (count > 0) { |
73 | data = (char *) malloc(count, 0); |
72 | data = (char *) malloc(count + 1, 0); |
74 | if (!data) |
73 | if (!data) |
75 | return ENOMEM; |
74 | return ENOMEM; |
76 | 75 | ||
77 | rc = copy_from_uspace(data, buf, count); |
76 | rc = copy_from_uspace(data, buf, count); |
78 | if (rc) { |
77 | if (rc) { |
79 | free(data); |
78 | free(data); |
80 | return rc; |
79 | return rc; |
81 | } |
80 | } |
- | 81 | data[count] = 0; |
|
82 | 82 | ||
83 | for (i = 0; i < count; i++) |
- | |
84 | putchar(data[i]); |
83 | printf("%s", data); |
85 | free(data); |
84 | free(data); |
86 | } else |
85 | } else |
87 | klog_update(); |
86 | klog_update(); |
88 | 87 | ||
89 | return count; |
88 | return count; |