Read system call for input
Posted: Thu Jan 04, 2018 1:48 pm
Hello
I have my OS and i created an os specific toolkit with the newlib c library. I have some syscalls such as the write. I can write a program that uses printf and compile it and run it on user space on my os. Now i am trying to implement the read system call. I wrote the keyboard drivers, and also i wrote a kscanf and getchar functions and they work just fine on kernel space, but when i use scanf on user space through the read system call, it allow me to write and press enter but it doesn't save the value to show it when i printf the string. The read system call declaration is like the linux format,
and inside i have just a
in the write system call i have kprintf("%s", buf); and it works fine, but the read doesn't.
Can you help me?
Thanks in Advance
I have my OS and i created an os specific toolkit with the newlib c library. I have some syscalls such as the write. I can write a program that uses printf and compile it and run it on user space on my os. Now i am trying to implement the read system call. I wrote the keyboard drivers, and also i wrote a kscanf and getchar functions and they work just fine on kernel space, but when i use scanf on user space through the read system call, it allow me to write and press enter but it doesn't save the value to show it when i printf the string. The read system call declaration is like the linux format,
Code: Select all
ssize_t read(int fd, void *buf, size_t count) {
Code: Select all
kscanf("%s", buf);
return 0;
}
Can you help me?
Thanks in Advance