lib: c: re-organise into separate static modules, plus a single shared library
This commit is contained in:
21
lib/libc/io/unistd/read.c
Normal file
21
lib/libc/io/unistd/read.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <errno.h>
|
||||
#include <mango/handle.h>
|
||||
#include <mango/msg.h>
|
||||
#include <rosetta/fs.h>
|
||||
#include <sys/remote.h>
|
||||
|
||||
int read(int fd, void *buf, size_t count)
|
||||
{
|
||||
int err;
|
||||
size_t nr_read;
|
||||
kern_status_t status = fs_read(fd, count, &err, &nr_read, buf, count);
|
||||
if (status != KERN_OK) {
|
||||
return __set_errno(__errno_from_kern_status(status));
|
||||
}
|
||||
|
||||
if (err != SUCCESS) {
|
||||
return __set_errno(err);
|
||||
}
|
||||
|
||||
return nr_read;
|
||||
}
|
||||
Reference in New Issue
Block a user