Subversion Repositories HelenOS

Rev

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

Rev 3150 Rev 3153
Line 55... Line 55...
55
/** Print using kernel facility
55
/** Print using kernel facility
56
 *
56
 *
57
 * Print to kernel log.
57
 * Print to kernel log.
58
 *
58
 *
59
 */
59
 */
60
static unative_t sys_io(int fd, const void * buf, size_t count)
60
static unative_t sys_klog(int fd, const void * buf, size_t count)
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 > PAGE_SIZE)
66
    if (count > PAGE_SIZE)
67
        return ELIMIT;
67
        return ELIMIT;
68
 
-
 
69
    data = (char *) malloc(count, 0);
-
 
70
    if (!data)
-
 
71
        return ENOMEM;
-
 
72
   
68
   
-
 
69
    if (count > 0) {
-
 
70
        data = (char *) malloc(count, 0);
-
 
71
        if (!data)
-
 
72
            return ENOMEM;
-
 
73
       
73
    rc = copy_from_uspace(data, buf, count);
74
        rc = copy_from_uspace(data, buf, count);
74
    if (rc) {
75
        if (rc) {
-
 
76
            free(data);
-
 
77
            return rc;
-
 
78
        }
-
 
79
   
-
 
80
        for (i = 0; i < count; i++)
-
 
81
            putchar(data[i]);
75
        free(data);
82
        free(data);
76
        return rc;
-
 
77
    }
83
    } else
78
 
-
 
79
    for (i = 0; i < count; i++)
-
 
80
        putchar(data[i]);
84
        klog_update();
81
    free(data);
-
 
82
   
85
   
83
    return count;
86
    return count;
84
}
87
}
85
 
88
 
86
/** Tell kernel to get keyboard/console access again */
89
/** Tell kernel to get keyboard/console access again */
Line 116... Line 119...
116
   
119
   
117
    return rc;
120
    return rc;
118
}
121
}
119
 
122
 
120
syshandler_t syscall_table[SYSCALL_END] = {
123
syshandler_t syscall_table[SYSCALL_END] = {
121
    (syshandler_t) sys_io,
124
    (syshandler_t) sys_klog,
122
    (syshandler_t) sys_tls_set,
125
    (syshandler_t) sys_tls_set,
123
   
126
   
124
    /* Thread and task related syscalls. */
127
    /* Thread and task related syscalls. */
125
    (syshandler_t) sys_thread_create,
128
    (syshandler_t) sys_thread_create,
126
    (syshandler_t) sys_thread_exit,
129
    (syshandler_t) sys_thread_exit,