[USER] Temporary write syscall

This commit is contained in:
2016-12-11 19:50:01 +01:00
parent 1693baaf6b
commit 19df873615
7 changed files with 76 additions and 0 deletions

38
libc/file_io.c Normal file
View File

@@ -0,0 +1,38 @@
#include "syscalls.h"
#include <stdio.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <sys/uio.h>
SYSCALL_DEF(ioctl)
{
SYSCALL_INIT(int, fd, unsigned long, request);
if(fd == 1 && request == TIOCGWINSZ)
{
return 0;
}
kernel_debug("==> IOCTL - unsupported request:%lx\n", request);
return -1;
}
SYSCALL_DEF(writev)
{
SYSCALL_INIT(int, fd, const struct iovec *, iov, int, iovcnt);
size_t len = 0;
for(int i=0; i < iovcnt; i++)
{
len += write(fd, iov[i].iov_base, iov[i].iov_len);
}
return (long)len;
}
SYSCALL_DEF(write)
{
SYSCALL_INIT(int, fd, void *, buffer, size_t, nbyte);
return kernel_syscall(SYS_WRITE, fd, buffer, nbyte);
}

View File

@@ -1,3 +1,4 @@
#pragma once
#define SYS_WRITE 0x001
#define SYS_DEBUG 0x3FF