Rev 3096 | Rev 3113 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3096 | Rev 3097 | ||
|---|---|---|---|
| Line 61... | Line 61... | ||
| 61 | { |
61 | { |
| 62 | size_t i; |
62 | size_t i; |
| 63 | char *data; |
63 | char *data; |
| 64 | int rc; |
64 | int rc; |
| 65 | 65 | ||
| 66 | if (count == 0) |
- | |
| 67 | return 0; |
- | |
| 68 | - | ||
| 69 | if (count > PAGE_SIZE) |
66 | if (count > PAGE_SIZE) |
| 70 | return ELIMIT; |
67 | return ELIMIT; |
| 71 | - | ||
| 72 | data = (char *) malloc(count, 0); |
- | |
| 73 | if (!data) |
- | |
| 74 | return ENOMEM; |
- | |
| 75 | 68 | ||
| - | 69 | if (count > 0) { |
|
| - | 70 | data = (char *) malloc(count, 0); |
|
| - | 71 | if (!data) |
|
| - | 72 | return ENOMEM; |
|
| - | 73 | ||
| 76 | rc = copy_from_uspace(data, buf, count); |
74 | rc = copy_from_uspace(data, buf, count); |
| 77 | if (rc) { |
75 | if (rc) { |
| - | 76 | free(data); |
|
| - | 77 | return rc; |
|
| - | 78 | } |
|
| - | 79 | ||
| - | 80 | for (i = 0; i < count; i++) |
|
| - | 81 | putchar(data[i]); |
|
| 78 | free(data); |
82 | free(data); |
| 79 | return rc; |
- | |
| 80 | } |
83 | } else |
| 81 | - | ||
| 82 | for (i = 0; i < count; i++) |
- | |
| 83 | putchar(data[i]); |
84 | klog_update(); |
| 84 | free(data); |
- | |
| 85 | 85 | ||
| 86 | return count; |
86 | return count; |
| 87 | } |
87 | } |
| 88 | 88 | ||
| 89 | /** Tell kernel to get keyboard/console access again */ |
89 | /** Tell kernel to get keyboard/console access again */ |