Changeset 312cc68 in mainline


Ignore:
Timestamp:
2009-03-18T10:48:46Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8015eeec
Parents:
65513a5
Message:

move syscall wrappers to more suitable location

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/console/console.c

    r65513a5 r312cc68  
    4040#include <synch/spinlock.h>
    4141#include <arch/types.h>
    42 #include <ddi/device.h>
    4342#include <ddi/irq.h>
    4443#include <ddi/ddi.h>
     
    4847#include <print.h>
    4948#include <atomic.h>
     49#include <syscall/copy.h>
     50#include <errno.h>
    5051
    5152#define KLOG_SIZE PAGE_SIZE
     
    121122        silent = true;
    122123        arch_release_console();
     124}
     125
     126/** Tell kernel to get keyboard/console access again */
     127unative_t sys_debug_enable_console(void)
     128{
     129#ifdef CONFIG_KCONSOLE
     130        grab_console();
     131        return true;
     132#else
     133        return false;
     134#endif
     135}
     136
     137/** Tell kernel to relinquish keyboard/console access */
     138unative_t sys_debug_disable_console(void)
     139{
     140        release_console();
     141        return true;
    123142}
    124143
     
    276295}
    277296
     297/** Print using kernel facility
     298 *
     299 * Print to kernel log.
     300 *
     301 */
     302unative_t sys_klog(int fd, const void * buf, size_t count)
     303{
     304        char *data;
     305        int rc;
     306
     307        if (count > PAGE_SIZE)
     308                return ELIMIT;
     309       
     310        if (count > 0) {
     311                data = (char *) malloc(count + 1, 0);
     312                if (!data)
     313                        return ENOMEM;
     314               
     315                rc = copy_from_uspace(data, buf, count);
     316                if (rc) {
     317                        free(data);
     318                        return rc;
     319                }
     320                data[count] = 0;
     321               
     322                printf("%s", data);
     323                free(data);
     324        } else
     325                klog_update();
     326       
     327        return count;
     328}
     329
    278330/** @}
    279331 */
Note: See TracChangeset for help on using the changeset viewer.