Subversion Repositories HelenOS

Rev

Rev 4377 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4377 Rev 4692
Line 59... Line 59...
59
static wchar_t klog[KLOG_LENGTH] __attribute__ ((aligned (PAGE_SIZE)));
59
static wchar_t klog[KLOG_LENGTH] __attribute__ ((aligned (PAGE_SIZE)));
60
 
60
 
61
/** Kernel log initialized */
61
/** Kernel log initialized */
62
static bool klog_inited = false;
62
static bool klog_inited = false;
63
/** First kernel log characters */
63
/** First kernel log characters */
64
static index_t klog_start = 0;
64
static size_t klog_start = 0;
65
/** Number of valid kernel log characters */
65
/** Number of valid kernel log characters */
66
static size_t klog_len = 0;
66
static size_t klog_len = 0;
67
/** Number of stored (not printed) kernel log characters */
67
/** Number of stored (not printed) kernel log characters */
68
static size_t klog_stored = 0;
68
static size_t klog_stored = 0;
69
/** Number of stored kernel log characters for uspace */
69
/** Number of stored kernel log characters for uspace */
Line 168... Line 168...
168
 * @param buflen Size of the buffer.
168
 * @param buflen Size of the buffer.
169
 *
169
 *
170
 * @return Number of characters read.
170
 * @return Number of characters read.
171
 *
171
 *
172
 */
172
 */
173
count_t gets(indev_t *indev, char *buf, size_t buflen)
173
size_t gets(indev_t *indev, char *buf, size_t buflen)
174
{
174
{
175
    size_t offset = 0;
175
    size_t offset = 0;
176
    count_t count = 0;
176
    size_t count = 0;
177
    buf[offset] = 0;
177
    buf[offset] = 0;
178
   
178
   
179
    wchar_t ch;
179
    wchar_t ch;
180
    while ((ch = indev_pop_character(indev)) != '\n') {
180
    while ((ch = indev_pop_character(indev)) != '\n') {
181
        if (ch == '\b') {
181
        if (ch == '\b') {
Line 224... Line 224...
224
{
224
{
225
    spinlock_lock(&klog_lock);
225
    spinlock_lock(&klog_lock);
226
   
226
   
227
    if ((klog_stored > 0) && (stdout) && (stdout->op->write)) {
227
    if ((klog_stored > 0) && (stdout) && (stdout->op->write)) {
228
        /* Print charaters stored in kernel log */
228
        /* Print charaters stored in kernel log */
229
        index_t i;
229
        size_t i;
230
        for (i = klog_len - klog_stored; i < klog_len; i++)
230
        for (i = klog_len - klog_stored; i < klog_len; i++)
231
            stdout->op->write(stdout, klog[(klog_start + i) % KLOG_LENGTH], silent);
231
            stdout->op->write(stdout, klog[(klog_start + i) % KLOG_LENGTH], silent);
232
        klog_stored = 0;
232
        klog_stored = 0;
233
    }
233
    }
234
   
234